2017-08-14 504 views
0

我有以下的PHP腳本PHP返回一個MP4視頻文件

$file_name = 'Videos/'.$_GET['fileName'].'.mp4'; 

$file_size = (string)(filesize($file_name)); 
header('Content-Type: video/mp4'); 
header('Accept-Ranges: bytes'); 
header('Content-Length: '.$file_size); 



header("Content-Disposition: inline;"); 
header("Content-Range: bytes .$file_size"); 
header("Content-Transfer-Encoding: binary\n"); 
header('Connection: close'); 

readfile($file_name); 

有趣的是它僅適用以及服務一些視頻文件,但沒有記錄的人用不同的比特率。此外,如果視頻文件直接訪問,然後Chrome瀏覽器顯示視頻沒有問題。 我錯過了一些標題?

+0

這裏有什麼問題? – Eric

+0

爲什麼不與所有視頻一起工作,爲什麼只適用於某些視頻。 –

+0

由於某些比特率可能與瀏覽器中支持的mp4比特率不兼容。查看https://app.zencoder.com/docs/guides/encoding-settings/html5 – Eric

回答

0

其實我終於發現問題是appache服務器。 我只是不得不增加內存在php.ini 它不是一個比特率的問題,但與文件的大小。

memory_limit = 1280M