How to stream video data to a video element?

前端 未结 3 1617
盖世英雄少女心
盖世英雄少女心 2021-02-06 02:47

I have a Node.js process which outputs a video stream into my Node.js app.

On the client end, there is a tag. I would like to stream the video

3条回答
  •  天涯浪人
    2021-02-06 03:11

    Probably you might want to look at the following options:

    1. BinaryJS. It's bidrectional realtime binary data transfer tool based on websockets.

    2. JSMpeg stream-server (in case of capturing) from Phoboslab guys. All you need to do is start ffmpeg and point it to the domain and port where the nodejs script is running. More info you can find here.

    3. Pipe a stream directly. Good answer is posted here. In few words you just need to specify Accept-Ranges, Content-Range, Content-Length and Content-Type headers, then create relevant Read stream (with start and end options) and pipe it to the response object.

提交回复
热议问题