Here is how I like to solve this problem.
This method works by creating a ticket to download content on a single HTTP request ... Another attempt to use the same ticket to download content will fail, so any extensions that try to download the content again or the user manually tries not to do this, therefore a flash player will be the only way to download content. However, there is one recession for this approach, users will not be able to skip the part of the video that was not downloaded ... in some standard player implementation that may even stop the video from loading. Any ideas on this would be greatly appreciated.
I'll start by writing a PHP script that accepts video_id, file_name, or the local path to your video file (depending on the storage infrastructure of your video collection) in a GET request along with a unique hash value (itβs hard to guess and come up with, possibly generated by a secret key so that it can be was to check that it came from our receiver (flash player), if the hacker sent us a used hash or an invalid hash (does not satisfy our key), we will not send him a file). Then the PHP script opens the video file and sends its contents with the correct mime video type. for FLV, the mime type is video / x-flv. It ensures that after the unique hash has not been used before and will be correctly generated from your secret encryption key.
Then, as soon as the page with the flash player loads, we can provide the .php file with the correct settings for receiving the video player as a video. (If this is a simple player that only allows flv files, you can always program your .htaccess file to analyze .flv files as a php script in a specific folder only and rename your .php file as .flv and try your luck) ... in any case ... Also create a hash key ... maybe you can take the current server time and add it to the salt value, for example, to another key known by both scripts, and encrypt this final concatenation with the secret key.
So, as soon as the php script video gateway receives the file name or hash key ... it will decrypt the hash key and find out if it is really generated from the script's sister and should not send the video again to the same hash key ...
For added security, you can reset the private key using the cronjob or bootstrap mechanism. To prevent duplication of hashkeys usage, you can store them in mysql database, file operations or NOSQL (depending on your needs and infrastructure).
Make sure that the file is requested by the same user agent for which the hash key was created. In case the hacker tries to use CURL or Wget for your video with an unused URL, before the flash player gets a chance to use the hash key. In this case, the hacker will have to imitate the user agent of the browser or download the file using the command line tool ... However, note that this is not your average champion.
Asad Hasan Nov 26 '11 at 11:08 2011-11-26 11:08
source share