How to stream video in Laravel
13,148
The class you're using is to handle the actual range requests. you need to provide a route that uses that as well:
Route::get('stream', function () {
$video_path = 'my_video_path';
$tmp = new \App\VideoStream($video_path);
$tmp->start();
})->name('stream');
Then the HTML will be:
<video controls preload="auto" src="{{ route('stream') }}" width="100%"></video>'
Author by
Mohammed Sabir
Updated on June 24, 2022Comments
-
Mohammed Sabir almost 2 years
I am trying to stream the video in the blade file. Normally video is loading but I am not able to go to and fro.
Here is the link which I followed: https://codesamplez.com/programming/php-html5-video-streaming-tutorial
I have added the class things in my
App/VideoStream.php
class and in the blade<?php $video_path = 'my_video_ath'; $tmp = new \App\VideoStream($video_path); $tmp->start(); ?> <video controls preload="auto" src="{{ $tmp }}" width="100%"></video>'
Whats issue in this, please help me out.