在Chrome上重现重量视频缓冲php的问题

时间:2015-08-19 17:12:07

标签: php html5 google-chrome video streaming

我在Chrome中重现重量视频(400mb或更多)时遇到问题。在Opera和Mozilla Firefox Works中。

在"流媒体"期间,我无法浏览网站,始终是"充电"。

我的脚本是: http://codesamplez.com/programming/php-html5-video-streaming-tutorial

我尝试增加缓冲,但不起作用。

视频是关于根文件夹的,我必须使用HEADER进行访问。

我的脚本也有下载视频的问题,我无法浏览网站,总是"充电" :

$local_file = $url;
$download_file = $url;

// set the download rate limit (=> 20,5 kb/s)
$download_rate = 140;
if(file_exists($local_file) && is_file($local_file))
{
    header('Cache-control: private');
    header('Content-Type: application/force-download');
    header('Content-Length: '.filesize($local_file));
    header('Content-Disposition: filename='.basename($download_file));

    flush();
    $file = fopen($local_file, "r");
    while(!feof($file))
    {
        // send the current file part to the browser
        print fread($file, round($download_rate * 1024));
        // flush the content to the browser
        flush();
        // sleep one second
        sleep(1);
    }
    fclose($file);}
}

求你了。

0 个答案:

没有答案