Gossamer Forum
Home : General : Internet Technologies :

PHP Streaming

Quote Reply
PHP Streaming
Code:
function display_video($file, $mime) {
ob_start();
$fp = fopen($file, "rb");
$file_info = pathinfo($file);
$file_size = filesize($file);
header("Content-type: $mime");
header("Content-Length: " . $file_size);
while(! feof($fp)) {
set_time_limit(0);
print(fread($fp, 2048));
flush();
ob_flush();
}
fclose($fp);
exit;
}
This PHP function will output a video file. However, not until entire file read. Should stream the file, but cannot seem to get it work. Any ideas?

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Subject Author Views Date
Thread PHP Streaming dan 8929 Sep 4, 2008, 3:20 PM
Thread Re: [dan] PHP Streaming
LoisC 8738 Sep 6, 2008, 9:44 AM
Thread Re: [LoisC] PHP Streaming
dan 8749 Sep 6, 2008, 11:44 AM
Thread Re: [dan] PHP Streaming
brewt 8723 Sep 6, 2008, 6:19 PM
Thread Re: [brewt] PHP Streaming
dan 8731 Sep 6, 2008, 6:54 PM
Post Re: [dan] PHP Streaming
dan 8729 Sep 6, 2008, 10:00 PM