I'm trying to rewrite a piece of code used for streaming video to clients from PHP to Node (it's a huge mess and nightmare, but..).
The concept is that the PHP script loads in videos or segments of videos from a sort of playlist with curl. After receiving the video, it just gets dumped to the client like so:
ob_start();
echo $videoData;
ob_end_flush();
That process is in a while(1)
loop so it constantly loads the stream with more video data. When a client opens the PHP file - videos are just sent in this continuous form and the stream can be accessed through any media player (VLC, MX Player, HTML5 player, etc.) as the videos themselves are in a .ts format and are essentially just jammed into this "container".
The main problem is hanging these instances, and PHP just uses way too much overhead for this thing, and I'd like to rewrite it in Node, but I don't have any experience with this kind of stuff.
My main questions is:
How can I stream in video form to a client over HTTP? Most of the examples I found revolve around a single file with a known file size etc. I just want to dump all the data I have when I have it to the client in a loop.
via Matt
No comments:
Post a Comment