我遇到过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');
});
在2台PC之间进行简单测试,它没有设置远程流。在开发控制台中除了初始事件挂钩之外,我没有看到任何其他活动发生,尤其是SimpleWebRTC" readyToCall"不开火。