我在我的服务器上有一个视频,我希望通过html 5视频播放器与PHP流.我找到了一个类(https://gist.github.com/ranacseruet/9826293),但它不适用于大文件.我该怎么做才能正确显示视频?
class VideoStream
{
private $path = "";
private $stream = "";
private $buffer = 102400;
private $start = -1;
private $end = -1;
private $size = 0;
function __construct($filePath)
{
$this->path = $filePath;
}
/**
* Open stream
*/
private function open()
{
if (!($this->stream = fopen($this->path, 'rb'))) {
die('Could not open stream for reading');
}
}
/**
* Set proper header to serve the video content
*/
private function setHeader()
{
ob_get_clean();
header("Content-Type: video/mp4");
header("Cache-Control: …
Run Code Online (Sandbox Code Playgroud)