// // https://en.wikipedia.org/wiki/Chunked_transfer_encoding // https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#transfer-encoding-response-header header("HTTP/1.1 206 Partial Content"); header("Accept-Ranges: bytes"); header("Content-Range: bytes 0-1000/9999"); header("Content-Length: 5120"); header("Transfer-Encoding: chunked"); header("Content-Type: video/webm"); header("Content-Disposition: attachment; filename=stream.webm"); function flush_buffers(){ ob_end_flush(); ob_flush(); flush(); ob_start(); } $file="./stream.webm"; if(file_exists($file)) { $fh=fopen($file,'r'); $old=""; while(!feof($fh)) { rewind($fh); clearstatcache(); $new=fread($fh,filesize($file)); if($new!=$old) { $old=$new; echo $new; //echo "
"; } flush_buffers(); } //stream_copy_to_stream($fh,'php://output'); fclose($fh); } exit(1); ?>