Setup your Amazon S3 Bucket Permissions to Protect videos you use in the video player element
Also works for any other files in your Amazon S3 bucket as well (such as MP3, PDF, etc..).
If you are using Amazon S3 to host your video files, we have recently became aware of a neat trick that will let you only allow your domain name to use the files within your Amazon S3 bucket.
This means that you no longer have to set the permissions on your video files to "public" and can just leave them set to private, and only the domain name you specify will be able to link to, or stream the files within this bucket.
This is great because you no longer have to worry about anyone getting access to your video file link, and sharing it. People would have to actually come to your site to access the files.
Here are the steps to setup an Amazon S3 Bucket Policy:
1. Login to your aws.amazon.com account
2. Go into your S3 Management Console (by clicking on the red S3 link on the left side of the screen after you login).
3. Move your mouse over the name of the bucket you need to do this for, right click on it and go to "Properties"
4. On the right side of the screen, click on "Permissions"
5. Then click on "Add Bucket Policy"
6. A new window will come up. Use the policy below making sure to copy/paste exactly
7. In the .txt file linked to above, after you replace the YOURBUCKETNAME with your bucket name, and yourdomain.com with your domain name (make sure you keep the * after the / in both cases. Once you make those changes, then paste in the entire contents of that text file into the bucket policy window. Then press the enter key once, and you'll see the grayed out button "save" become clickable, and you should be able to save the bucket policy at that time.
You must set your files to use AES 256 under "properties" and click on "details" to make the change. Here is an example of how this should look:
Here is how to test it to make sure it works.
Set the video's permissions to private (not public), and then copy the url - use it in a video player element within the live editor for OptimizePress. Save the page, and you should be able to play the video.
Then open a new browser window and paste in the url for the video to see if the security works - you should get an xml error. If you can play the video embedded into your website, but can't play the video by directly accessing the file's link then it works.
Note: You can also link to any files within your bucket as well, and they will work. If the link is refreshed however, it won't, so be aware of this.
Note: You should use a different bucket from any buckets you have integrated the membership files download element with to avoid any possible conflicts.
User Experience Tip: If you prefer that your files should download rather than loading in the browser window (such as mp3, mp4, pdf, etc..) then add a new metadata in Amazon for "File Disposition" and "attachment" and then it should download to the visitors computer instead of load in the browser. Here are the steps you need to take in order to do this:
NOTE: We have had a couple of reports that bucket polices may not work on some older mobile devices due to the HTTP referrer that is sent to the web browser. If this becomes an issue we would suggest checking out EasyVideoSuite.com or another video player program that uses Amazon S3 and can protect the files. This seems to only effect videos, however if you have downloadable files those shouldn't be effected.