简体   繁体   中英

Live Streaming a Video File

I have to create a Theater effect on a website such that a Video needs to be streamed so that all the users of the website can see it simultaneously.

I have checked Ustream, Livstream etc but they allow my webcam to be streamed online.
The functionality I need is similar to how we see a Cricket/Soccer Match online where all the users see the same clip. The only difference is that I already have a video that needs to be streamed.

Please help.

It's not possible to do it with PHP because you can't handle multiple HTTP request in a PHP script. However, you can do it easily with node.js. You can first store each user's HTTP request and time in an array, then you find out the first one that watch the video. Calculate the video's elapsed time and slice the video. Finally send the video back to the current client.

Another solution (If you decided to use node.js)

Simulate the playing of the video on the server side by using setTimeout when the first user request the video. Then when other users request the video you slice it and send it to the client. Because you simulate the playing on the server side, you can then no need to calculate the elapsed time of the video.

The slicing of the video can be done with FFMpeg easily.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM