webrtcjanus-gateway

Webrtc stream local video file


How would one stream a local media file(video file) to peers?( i am using janus-gateway - videoroom plugin for this ).

For audio there is webAudio, but what about the video?

Thanks!

Update: Maybe someone has an example? Or a small code snippet? Maybe a link to some lib?


Solution

  • Render the local video on Canvas & create stream object from Canvas element. And then you can add the stream to PeerConnection. Then stream will be sent to remote peer(Janus/Browser/any server).

    Demo: https://webrtc.github.io/samples/src/content/capture/canvas-pc/

    Source: https://github.com/webrtc/samples/blob/gh-pages/src/content/capture/canvas-pc/js/main.js#L45