我有mp4文件的问题.Html5视频标签可以使用直接链接播放,但不能使用PHP标头播放(Mp3可以正常使用PHP标头).我在Stack中尝试了几乎所有的解决方案,但仍然无法解决我的问题:(
听到我的代码:
PHP mp4.php
error_reporting(0);
$local_file = 'z.mp4';//'b.mp3';
$download_file = 'out.mp4';
// send headers
header('Cache-control: private');
header('Content-Type: video/mp4');
header('Content-Length: '.filesize($local_file));
header('Content-Disposition: filename='.$download_file);
header('Accept-Ranges: bytes');
header("Content-Transfer-Encoding: binary");
readfile($local_file);
Run Code Online (Sandbox Code Playgroud)
HTML
<video controls="" autoplay="" name="media">
<source src="http://localhost/videos/mp4.php" type="video/mp4">
</video>
Run Code Online (Sandbox Code Playgroud)
我不知道为什么:(请帮帮我.
谢谢,