我偶然发现了SimpleWebRTC包。正在尝试使其工作,但似乎无法使远程流通过。我还使用Pusher来发送信号,而不是使用SimpleWebRTC附带的默认设置。
我已经建立了我自己的连接:
var myConnection = {
pusher: new Pusher('mypusherkey', { cluster: 'ap1' } ),
channel: null,
on: function (event, callback) {
this.pusher.bind (event, callback);
},
emit: function () {
if (arguments.length == 1) {
if (arguments[0] === "join") {
this.channel = this.pusher.subscribe(arguments[1]);
}
}
else
this.channel.trigger(arguments);
},
getSessionId: function() {
return this.pusher.connection.socket_id;
},
disconnect: function() {
this.pusher.disconnect();
}
};然后我有了SimpleWebRTC初始化:
var webrtc = new SimpleWebRTC({
// the id/element dom element that will hold "our" video
localVideoEl: 'localVideo',
// the id/element dom element that will hold remote videos
remoteVideosEl: 'remotesVideos',
// immediately ask for camera access
autoRequestMedia: true,
debug: true,
connection: myConnection
});
// we have to wait until it's ready
webrtc.on('readyToCall', function () {
console.log('ready to join');
// you can name it anything
webrtc.joinRoom('test-video-chat');
});在两台PC之间做一个简单的测试,它没有设置远程流。在开发控制台中,除了初始事件挂钩之外,我没有看到任何其他活动发生,特别是SimpleWebRTC "readyToCall“没有触发。
https://stackoverflow.com/questions/38364989
复制相似问题