I'm writing a web app that serves H.264 encoded MP4 video. In Chrome and Safari, it does this via an HTML5 video tag.
In order to control access to these videos, their contents are served via PHP using a really simply mechanism:
header('Content-type: video/mp4');
readfile($filename);
exit;
No matter what I do, the videos will not stream. Additionally:
- If I change the source code to serve the files directly, using the same video tag but linking to an Apache-served copy of the video with no PHP pass-through, streaming works fine.
- Even when streaming doesn't work, I can always right click on the greyed-out HTML5 player and download the file through the PHP pass-through - and it plays great offline.
Any ideas? I'm pulling my hair out!