问题描述
请帮我处理这个 VideoStream,因为它不起作用。
我有视频链接 http://91.121.207.115/downloads/American.Traitor.The.Trial.of.Axis.Sally.007.BR.mp4
但它不能在普通的 html5 视频中播放
然后我来到这里并且它工作正常。 https://codesamplez.com/programming/php-html5-video-streaming-tutorial
我已经尽力了,但仍然无法工作。
index.PHP
<video width="320" height="240" controls>
<source src="stream.PHP" type="video/mp4">
</video>
stream.PHP
include "VideoStream.PHP";
$stream = new VideoStream("http://91.121.207.115/downloads/American.Traitor.The.Trial.of.Axis.Sally.007.BR.mp4");
$stream->start();exit;
请帮助我在 html5 视频中处理该视频流。谢谢。
解决方法
如果您只想使用 PHP 将视频文件字节提供到 HTML5 <video>
中,请尝试:
(1) index.php: (可以是index.html
)...
<video width="640" height="400" controls>
<source src="stream.php" type="video/mp4">
</video>
(2)stream.php:
<?php
$file = "http://91.121.207.115/downloads/American.Traitor.The.Trial.of.Axis.Sally.007.BR.mp4";
$contents = readfile( $file );
echo $contents; //# send back to HTML...
exit;
?>