How to view REALTIME Laravel/FFMpeg Dispatch Jobs Progress in Laravel 8 with Ajax?

Viewed 93

I use Laravel-FFMpeg and i try to converting some HLS videos, so I used a Laravel Job to do that.

But I have no idea how to view the REALTIME Progress Info from dispatched Jobs in my index.blade.php with jQuery AJAX.

I've spend days searching for an answer on Google and Youtube, but I found nothing fit.

I use this Job code for ConvertStreamingVideos:

FFMpeg::fromDisk('tmp')
    ->open('watermarked/' . $this->video->New_Name . '.mp4')
    ->exportForHLS()
    ->onProgress(function ($percentage, $remaining, $rate) {
        echo "{$percentage}";
    })
    ->addFormat($bitrate_144p)
    ->addFormat($bitrate_240p)
    ->addFormat($bitrate_360p)
    ->addFormat($bitrate_480p)
    ->addFormat($bitrate_720p)
    ->addFormat($bitrate_1080p)
    ->toDisk('public')
    ->save('videos/stream_videos/' . $this->video->New_Name . '.m3u8');

Is there any tutorials about it or can someone give me some example codes?

Thanks everyone

0 Answers
Related