I’m trying to feed an mp4 file to flash player via php and the video is downloaded completely before starting playback.
$src = '/var/www/user/data/www/domain.com/video.mp4';
if(file_exists($src) and is_readable($src)) {
header('Content-Type: video/mp4');
header('Content-Length: '.filesize($src));
readfile($src);
} else die('error');
I’ve tried curl with similar results. Any ideas what’s causing this delay?
Most likely your Flash player is hoping you’ll handle HTTP
Rangerequests so it can get started faster on the playback.The HTML5/Flash audio player jPlayer has a section in their developer guide about this. Scroll to the part about Byte-Range Requests:
Also note that they offer a PHP solution for handling
Rangerequests if you have to use PHP instead of a direct download.smartReadFile.php
https://groups.google.com/forum/#!msg/jplayer/nSM2UmnSKKA/bC-l3k0pCPMJ