简体   繁体   English

如何让服务器使用 WebRTC 流式传输视频?

[英]How can I have a server stream a video with WebRTC?

My current use case is that I'm trying to mock a system that uses WebRTC for live video streaming (for a robot).我当前的用例是我正在尝试模拟一个使用 WebRTC 进行实时视频流(用于机器人)的系统。 This way, I don't have to be connected to the robot to develop the client.这样我就不用连接机器人来开发客户端了。

My issue as of now is that I have no idea how to stream a video using WebRTC to connected peers.到目前为止,我的问题是我不知道如何使用 WebRTC 将视频流式传输到连接的对等方。 I've seen many examples of how to do this from client to client using a signaling server, but other than directly sending the video buffer using socket.io, I haven't seen an example of server -> client WebRTC streaming.我已经看到很多关于如何使用信令服务器从客户端到客户端执行此操作的示例,但除了使用 socket.io 直接发送视频缓冲区之外,我还没有看到服务器 -> 客户端 WebRTC 流式传输的示例。

I'm planning to use Node.JS for mocking the video stream as I've been using it for the rest of the robot's systems.我打算使用 Node.JS 来模拟视频流,因为我一直在将它用于机器人的其他系统。

It really isn't that different though client to client or server to client.尽管客户端到客户端或服务器到客户端,但实际上并没有什么不同。 You want to stream/broadcast a video to all the connected peers.您想向所有连接的对等方流式传输/广播视频。 Think of your server will be a client in the setup.想想您的服务器将成为设置中的客户端。

You can also use a WebRTC solution like Janus Repo it is a simple gateway and completely open source.您还可以使用像Janus Repo这样的 WebRTC 解决方案,它是一个简单的网关并且完全开源。 Refer to - WebRTC & Dev API's for more info.有关更多信息,请参阅 - WebRTC & Dev API's

If you find latency issues after peers have increased in number you can check - Mesh , Routing , Multi peer architecture for some solutions for it.如果您在对等点数量增加后发现延迟问题,您可以检查 - MeshRoutingMulti peer architecture以获得一些解决方案。

Hope it helps.希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM