Webrtc 流本地视频文件 [英] Webrtc stream local video file
问题描述
如何将本地媒体文件(视频文件)流式传输到同行?(我正在使用 janus-gateway - 为此使用视频室插件).
How would one stream a local media file(video file) to peers?( i am using janus-gateway - videoroom plugin for this ).
音频有 webAudio,但视频呢?
For audio there is webAudio, but what about the video?
谢谢!
更新:也许有人举个例子?或者一个小的代码片段?也许是某个库的链接?
Update: Maybe someone has an example? Or a small code snippet? Maybe a link to some lib?
推荐答案
在 Canvas 上渲染本地视频 &从 Canvas 元素创建流对象.然后您可以将流添加到 PeerConnection.然后流将被发送到远程对等方(Janus/浏览器/任何服务器).
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).
演示: https://webrtc.github.io/samples/src/content/capture/canvas-pc/
来源: https://github.com/webrtc/samples/blob/gh-pages/src/content/capture/canvas-pc/js/main.js#L45
这篇关于Webrtc 流本地视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!