HTML5视频无法播放

时间:2015-10-20 05:41:49

标签: html video

我正在使用video标记在我的浏览器(Chrome)上播放视频。只有当文件低于(大约)135MB时,我才能使用此标签播放我的mp4视频。如果文件大于135MB,则无法播放视频(格式相同且扩展名相同)。任何人都知道发生了什么以及如何解决这个问题?

我打开文件的代码:

<?php
   $filename=$_GET['filename']; //parameter identifying the file to be downloaded. Should not be direct path as in this simple example, rather than the id of the file's data stored in a database. You need to add that piece of code.
   header('Content-Type: text/plain'); //set MIME type - you need to store this along your path to the file, you can get it from $_FILES['uploadedfilename']['type'] when a file is uploaded via php
   header("Content-disposition: attachment;filename=$filename"); //advises the browser to open the file outside of the browser, not within a plugin
   readfile($filename); //outputs the file
?>

我的代码来读取文件:

<video controls width="320">
     <source src="video_view.php?filename='.$query['v_drive'].'://upload/'.$query['c_group'].'/'.$query['c_name'].'/'.$query['v_link'].'" type="video/mp4">
     <source src="video_view.php?filename='.$query['v_drive'].'://upload/'.$query['c_group'].'/'.$query['c_name'].'/'.$query['v_link'].'" type="video/webm">
     <object type="application/x-shockwave-flash" data="eh5v.files/html5video/flashfox.swf" width="720" height="576" style="position:relative;">
        <param name="movie" value="assets/flashfox.swf" />
        <param name="allowFullScreen" value="true" />
        <param name="flashVars" value="autoplay=true&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;src=video_view.php?filename='.$query['v_drive'].'://upload/'.$query['c_group'].'/'.$query['c_name'].'/'.$query['v_link'].'"" />
        <embed src="assets/flashfox.swf" width="320" style="position:relative;"  flashVars="controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;src=video_view.php?filename='.$query['v_drive'].'://upload/'.$query['c_group'].'/'.$query['c_name'].'/'.$query['v_link'].'"    allowFullScreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />          
    </object>
     Your browser does not support the video element.
</video>

1 个答案:

答案 0 :(得分:0)

最后我发现谷歌的这个链接:http://licson.net/post/stream-videos-php/可以用来播放php文件中的任何视频,效果非常好。