2015-10-20 279 views
0

我使用video標記在我的瀏覽器(Chrome)上播放視頻。只有當文件低於(大約)135MB時,我才能使用此標記播放我的mp4視頻。如果文件大於135MB,則無法播放視頻(相同格式的&相同的擴展名)。任何人都知道發生了什麼事以及如何解決?HTML5視頻無法播放

我的代碼來打開文件:

<?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> 
+0

是在文件上運行qt-faststart(或等效)嗎?或者是後面的moov? – szatmary

+0

沒有。沒有qt-faststart。我正在使用文件來打開電影。已經更新我的代碼。 –

+0

不「快速啓動」該文件可能是您的問題。如果你可以發佈文件,我可以肯定地告訴你。 – szatmary

回答