的 更新 强> :下面的解决方案实际上并不向服务器提供视频。我不确定最好的(Node)解决方案是什么。在C ++中,尝试libJingle。
听起来像webrtc.io将允许您创建一个对等的节点应用程序。在这里查看github项目: https://github.com/webRTC/webRTC.io 。
目前该项目似乎没有超级活跃的开发,但它有100个分叉,节点模块现在每月下载500次,所以看起来人们在乎。
<video id="local" autoplay="autoplay"></video> <video id="remote" autoplay="autoplay"></video> <script src="/webrtc.io.js"></script> <script> // note: make sure hostname available to all connecting clients // (ie. probably not `localhost`) rtc.connect('ws://yourserveraddress:8001'); rtc.createStream({"video": true, "audio":false}, function(stream){ // get local stream for manipulation rtc.attachStream(stream, 'local'); }); rtc.on('add remote stream', function(stream){ // show the remote video rtc.attachStream(stream, 'remote'); }); // more rtc callbacks are available </script>
var webRTC = require('webrtc.io').listen(8001);
您可能想要使用此实现: https://github.com/andyet/SimpleWebRTC
我已将它用于我的项目,并且很容易集成。
这个 解 提供从原生到网络的视频流。即,不需要浏览器来捕获视频,并且它将视频广播到客户端浏览器。有一个 websocket示例 工作得很好。
您的挑战实际上是构建和链接webrtc.node,并在上面的链接中对此进行了解释。
我遇到了同样的问题,偶然发现了这两个宝石:
https://github.com/helloIAmPau/node-rtc 可悲的是,它缺乏任何文件。
然而 https://github.com/js-platform/node-webrtc 对我来说似乎更可靠。
怎么样 simple-peer 和 rtc-everywhere ?
simple-peer
rtc-everywhere
https://github.com/feross/simple-peer
https://github.com/contra/rtc-everywhere
可以建立从node.js到浏览器的WebRTC数据连接 serverless-webrtc包 它使用的 wrtc包 作为WebRTC的实现。
不幸的是,当我尝试将wrtc模块与PeerJS或EasyRTC等信令库一起使用时,连接未建立(错误消息为“ICE failed”)。如果有人在wrtc之上使用任何高级库有任何成功,我将不胜感激。