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

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

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

問題描述

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

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>

當我直接在瀏覽器中檢查它們時,所有 .php 文件都可以正常播放.但是上面的所有 .php 作為源文件的設置將無法播放.如果我提供一個直接的 .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 后,它確實有效.現在它在 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.

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

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

相關文檔推薦

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 中的部分(視圖),以便我的應用程序中的所有視圖都可以訪問?) - IT屋-程序員軟件開發技術
Having a single entry point to a website. Bad? Good? Non-issue?(有一個網站的單一入口點.壞的?好的?沒問題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務層在 Zend 或 PHP 中常見嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 日韩精品一区二区三区在线 | 91色站| 国产日韩精品一区 | 日韩理论电影在线观看 | 在线视频 亚洲 | 成人a在线观看 | www.操.com| 国产欧美一区二区三区免费 | 999久久久| 成人黄色网址大全 | 日韩在线精品强乱中文字幕 | 色射综合 | 男女羞羞视频网站 | 91视视频在线观看入口直接观看 | 91成人免费观看 | 国产福利91精品一区二区三区 | 久久久91精品国产一区二区三区 | 欧美一区二区三区精品免费 | 一级做a | 91精品国产欧美一区二区成人 | 91精品国产综合久久婷婷香蕉 | 二区不卡 | 男女羞羞视频在线 | 四虎影视1304t | 欧美日本一区二区 | 欧美a∨| 在线观看视频中文字幕 | 亚洲欧美激情网 | 天堂网色 | 亚洲字幕在线观看 | 久久精品一区二区三区四区 | 中文一区 | 国产成人综合一区二区三区 | 91色啪| 国产精品久久免费观看 | 亚洲欧美中文日韩在线v日本 | 国产一区 在线视频 | 一区二区三区小视频 | 尤物在线精品视频 | 欧美三级在线 | 日韩在线不卡视频 |