发布网友
共1个回答
热心网友
吐槽, 你的分类错了, 导致不能贴代码。
github:
priologic/easyrtc
webRTC/webRTC.io
自己开发推荐使用priologic/easyrtc
只是玩玩 对于webRTC.io使用简单
npm install webrtc.io
Client
<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>
Server
var webRTC = require('webrtc.io').listen(8001);
//then a bunch of callbacks are available