嘿,我正在尝试从我的本地服务器编写流媒体直播视频的网页。我想使用线程。所以我试图使用file_get_content,我的网页上出现了乱码。这是线程,是否有人知道在线程中呈现视频的不同方法?
class stream extends Thread {
public function run() {
$file = "/var/www/html/movie.mp4"; // The media file's location
$f = fopen($file, 'rb'); // Open the file in binary mode
$chunkSize = 8192; // The size of each chunk to output
// Start outputting the data
while(true){
fpassthru($f);
echo file_get_contents('/var/www/html/movie.mp4');
//echo fread($f, $chunkSize);
//$data = fread($f, $chunkSize);
// echo $data;
flush();
}
}
}