0

hey i am trying to write web page that stream live video, from my locally server. i want to use threads. so i tried to use file_get_content and i got gibberish presenting in my web page . this is the thread, does anybody know different method for presenting video within the thread?

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();
}
}
}
Omer Anisfeld
  • 1,236
  • 12
  • 28
  • Does this help https://stackoverflow.com/questions/3785188/how-to-stream-a-media-file-using-php – RiggsFolly Jun 17 '17 at 16:54
  • @RiggsFolly the link in the accepted answer is dead. – LF00 Jun 17 '17 at 17:06
  • i've tried this tutorial, it return with the error of: This site can’t be reached The webpage at http://172.17.0.3/ might be temporarily down or it may have moved permanently to a new web address. ERR_CONTENT_DECODING_FAILED – Omer Anisfeld Jun 17 '17 at 17:30

0 Answers0