久久久久久久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 示例)
主站蜘蛛池模板: 男女羞羞的网站 | 亚洲福利一区二区 | aacc678成免费人电影网站 | www.天堂av.com| 精品国产乱码久久久久久88av | 色先锋影音 | 国产一级免费视频 | 国产在线观看一区二区 | 欧美天堂在线观看 | 精品美女 | 国产精品99久久久久久久久久久久 | 欧美一级网站 | 国产乱xxav | 91久久婷婷 | 天天操天天射综合网 | 国产精品视频500部 a久久 | 久久久久久免费看 | 欧美日韩亚洲一区 | 日韩欧美成人一区二区三区 | 亚洲永久免费 | 天天天插 | 99久久精品免费看国产小宝寻花 | 黄网站免费在线看 | 国产视频福利一区 | 亚洲一区二区三区在线免费观看 | 国产欧美精品一区二区 | 天天做日日做 | 欧美激情精品久久久久久变态 | 国产一区二区三区免费 | 精品国产乱码久久久久久闺蜜 | 污污的网站在线观看 | 极品一区 | 国产精品久久国产精品久久 | 国产精品国产亚洲精品看不卡15 | 精品视频一区二区三区在线观看 | 色免费看 | 天堂视频一区 | 久久精品国产一区老色匹 | 亚洲精品一区av在线播放 | 国产精品久久久久久二区 | 久久夜视频 |