久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

來自 PHP 的 mp4 - 不在 HTML5 Video 標簽中播放

mp4 from PHP - Not playing in HTML5 Video tag(來自 PHP 的 mp4 - 不在 HTML5 Video 標簽中播放)
本文介紹了來自 PHP 的 mp4 - 不在 HTML5 Video 標簽中播放的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在使用視頻標簽來播放視頻.

I am using the video tag to play videos.

我使用 php 文件進行播放,如下所示:

I using php files for the playback like this:

    <video id="playvideo" preload="auto" width="845" height="395" 
    poster="http://video-js.zencoder.com/oceans-clip.png">

    <source src="../getvideo_webm.php" type='video/webm' />
    <source src="../getvideo_mp4.php" type='video/mp4'/>
    <source src="../getvideo_ogv.php" type='video/ogg' />

    </video>

當(dāng)我直接在瀏覽器中檢查它們時,所有 .php 文件都可以正常播放.但是上面的所有 .php 作為源文件的設(shè)置將無法播放.如果我提供一個直接的 .mp4 源,它會播放得很好.

All .php files are playing fine when i check them directly in the brower. But the above setup with all .php as source files will not play. If i give a straight .mp4 source it will play fine.

getvideo_mp4.php 看起來像這樣:

The getvideo_mp4.php looks like this:

 $path = 'oceans-clip.mp4';
 if (file_exists($path))
 {
 $size=filesize($path);
 $fm=@fopen($path,'rb');
 if(!$fm) {
 // You can also redirect here
 header ("HTTP/1.0 404 Not Found");
 die();
 }
 $begin=0;
 $end=$size;
 if(isset($_SERVER['HTTP_RANGE'])) {
 if(preg_match('/bytes=h*(d+)-(d*)[D.*]?/i',   
 $_SERVER['HTTP_RANGE'],$matches)){
 $begin=intval($matches[0]);
 if(!empty($matches[1])) {
 $end=intval($matches[1]);
 }
 }
 }
 if($begin>0||$end<$size)
 header('HTTP/1.0 206 Partial Content');
 else
 header('HTTP/1.0 200 OK');
 header("Content-Type: video/mp4");
 header('Accept-Ranges: bytes');
 header('Content-Length:'.($end-$begin));
 header("Content-Disposition: inline;");
 header("Content-Range: bytes $begin-$end/$size");
 header("Content-Transfer-Encoding: binary
");
 header('Connection: close');
 $cur=$begin;
 fseek($fm,$begin,0);
 while(!feof($fm)&&$cur<$end&&(connection_status()==0))
 { print fread($fm,min(1024*16,$end-$cur));
 $cur+=1024*16;
 usleep(1000);
 }
 die();
 }

那我做錯了什么?

推薦答案

以上代碼有效.在我更改 .php 文件的 src url 后,它確實有效.現(xiàn)在它在 moz 中播放,即 chrome,視頻標簽中只有 php 文件作為源.

The above code is working. After i changed the src url for .php files, it did actually work. Now it plays in moz, ie, chrome with only php files as sources in the video tag.

這篇關(guān)于來自 PHP 的 mp4 - 不在 HTML5 Video 標簽中播放的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Action View Helper in Zend - Work around?(Zend 中的動作視圖助手 - 解決方法?)
Is this a good way to match URI to class/method in PHP for MVC(這是將 URI 與 PHP 中用于 MVC 的類/方法匹配的好方法嗎)
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(視圖),以便我的應(yīng)用程序中的所有視圖都可以訪問?) - IT屋-程序員軟件開發(fā)技術(shù)
Having a single entry point to a website. Bad? Good? Non-issue?(有一個網(wǎng)站的單一入口點.壞的?好的?沒問題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務(wù)層在 Zend 或 PHP 中常見嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 国产精品一区在线观看 | 精品1区 | 国产精品一区在线观看 | 一区二区三区亚洲 | 免费视频一区 | 四虎永久免费影院 | 亚洲一区视频在线 | 免费av毛片 | 久草福利 | 在线日韩欧美 | 日韩美女在线看免费观看 | 欧美日韩一区二区三区四区 | 天堂综合网 | 99reav| 亚洲免费视频一区 | 免费看国产片在线观看 | 日韩电影一区二区三区 | 久久综合一区二区 | 国产精品久久久久久久久免费桃花 | 理论片87福利理论电影 | 热99精品视频 | 欧美精品a∨在线观看不卡 欧美日韩中文字幕在线播放 | 国产精品久久二区 | 免费精品久久久久久中文字幕 | 狠狠爱一区二区三区 | 欧美中文在线 | 亚洲精品自在在线观看 | 国产成人免费一区二区60岁 | 成人毛片在线视频 | 4h影视| 成人精品国产免费网站 | 中文字幕视频免费 | 成人精品福利 | 国产高清免费视频 | 国产在线精品一区二区 | 久久精品日产第一区二区三区 | 亚洲欧美日韩国产综合 | 伊人伊人 | 夜夜骚 | 免费激情av | 成人啊啊啊 |