Webrtc stream local video file

こ雲淡風輕ζ 提交于 2021-02-07 10:24:01

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/40363110/webrtc-stream-local-video-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!