Reputation: 527
I have built a php crud app that allows users to upload videos and queue them for conversion where I use FFMPEG to convert them to M3U8 Playlist format. I now need to build a streaming server that will allow me to playback those files in realtime so that when a user browses to the page they see the video playing at its current time. I know that nodejs has streaming capabilities and have done a great amount of research on video streaming and am coming up short. Can someone point me in the right direction with this. I have a concept in mind by using web sockets but I can't find an example that will help me solve my problem.
Upvotes: 1
Views: 4892
Reputation: 31209
If you want to play the uploaded videos as video-on-demand (VOD)
you just need to put the resulting segments and the m3u8 playlist in a web-accessible directory to be served via your web-server.
You can easily emulate a live playlist
based on your complete playlist using node.js by serving an on-the-fly generated m3u8.
Eg:
i - n
segments where n
is your desired sliding-window size. Increase n
if the current window size is less than three time the target duration. Use i - n
as the #EXT-X-MEDIA-SEQUENCE
value.n
resulting segmentsBy managing the time offsets properly you can also time-shift etc. Keep the segments indexed by play time in something like memcached
for performance's sake.
Upvotes: 3
Reputation: 3734
You are looking at building a video streaming platform, which is something significantly difficult to do (it is much more than simply piping a binary stream from a node server to a client, of that's what you were thinking of).
You are looking at using services that provide that capability, like Microsoft Azure Media Services. I understand Amazon AWS also has such a service, but you'll need to check it out, I have experience with Microsoft AMS only.
Indeed, such a service will allow to playback an HLS, MP4 fragmented, and MPEG-DASH formats to clients as a live event, even providing adaptive streaming capabilities for different bitrates/resolutions. You can see an example HERE and check if that is what you are looking for.
Upvotes: 1