We need your help with one PHP project client restriction.
He wants full download security video from server, he wants video storage be out of public directory, and video streaming must be in HTML5, without Flash. I have one solution, load video in php buffer and response it changing header info, but video size, more or less 300MB is impossible to load in PHP buffer…
Any good idea to do it?
You don’t need to load anything into a buffer. Just send the headers, then follow them up with the file read using
readfile(). The file is in a directory whose.htaccessprohibits direct access (the download script, of course, is not), and Bob’s your uncle.Since you talked about loading the file into the buffer, mind, this is not “streaming”. What most Flash streamers do is actually issue Byte-Range requests. In those cases too, you can recognize the situation with
if (isset($_SERVER['HTTP_RANGE'])), parse the range, and do the rest withfseek‘s andfread‘s.