bretanac93 bretanac93 - 1 year ago 105
PHP Question

How can I upload videos and convert it async in Laravel?

the thing is just like my title says, I am already uploading videos to the server, store their path in the db, and save them to the storage using the

facade, the videos have an average weight of 700MB or so, and they are for watching on the own website I am building, I'm using VideoJS to show them, but I need to convert them due to the incompatibility with different browsers, I already know that FFMPEG done this painless, but I want to know how to make it async, just like the Youtube upload video tool. The videos are uploaded from the admin dashboard only, so, there will be only one person uploading videos. Thanks for the time.

Answer Source

Have a look at Laravel's queue features:

You can create a job class that takes the path/filename of the video it is supposed to processed. Then in the job's handle method you do the conversion. The Laravel documentation explains how to create a Job class and use it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download