How to serve .flv files using PHP?

I am creating a streaming video site. The idea is that customers have to pay for membership, log in and watch the video. I am going with FlowPlayer to show the actual videos.

Now the problem is that the video needs to be stored somewhere publicly, and the URL of the .flv files must be passed to flowplayer so that it can display them. This creates a problem because anyone can use the source of the view, download the video and distribute it all over the Internet.

I know that some people serve images using php, creating a header() image, and then they can do something like:

 <img src="image.php?userId=1828&img=test.gif" /> 

The PHP script checks the user ID and serves the .gif file, and the actual gif url is never displayed.

Is there a way to do this with .flv or any other video format? For example, the file and user ID passed in to the PHP script, does it check them and return the video?

+6
security php video streaming
source share
5 answers

You can set up a directory containing FLV files on your web server, which can only be accessed by PHP, and then on your PHP script you can authenticate the user as usual and just send a header to the browser telling him to expect FLV, then echo the raw data FLV:

 <?php // here is where // you want your // user authentication if ($isAuthenticated) { header("Content-type: video/flv"); echo file_get_contents($pathToFLV); } ?> 

As Chad Birch discussed, this will prevent people from directly contacting the video - you cannot prevent piracy this way.

+5
source share

Short answer: no, you can never stop people from uploading your videos if they want to. There are various ways to make this more difficult for them, but there is no reliable method. You hit the main problem with DRM - you cannot show someone your content without telling him unencrypted at some point, and if they can see it, they can break it.

+3
source share

Since your FLV player is a flash application, it can always be downloaded and decompiled. When decompiling, the actual url on flv will be visible. So this will not make any difference if you use a direct url for flv movies or something like described in your question.

 <img src="image.php?userId=1828&img=test.gif" /> 
0
source share

Tell google the word Pseudostreaming , you will get an answer. There are some servers, such as lighttpd , which has flv streaming support built in ....

I hope you get an answer .........

0
source share

Apache with mod_flvx also has the same effect as lighttpd.

0
source share

All Articles