【发布时间】:2015-03-02 13:43:09
【问题描述】:
我对 mp4 文件有疑问。 Html5 Video Tag 可以通过直接链接播放,但不能通过 PHP Header 播放(MP3 可以与 PHP Header 一起正常工作)。我已经在 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);
HTML
<video controls="" autoplay="" name="media">
<source src="http://localhost/videos/mp4.php" type="video/mp4">
</video>
我不知道为什么:(请帮帮我。
谢谢,
【问题讨论】: