首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在SimpleWebRTC中使用推流器

在SimpleWebRTC中使用推流器
EN

Stack Overflow用户
提问于 2016-07-14 11:29:15
回答 0查看 229关注 0票数 0

我偶然发现了SimpleWebRTC包。正在尝试使其工作,但似乎无法使远程流通过。我还使用Pusher来发送信号,而不是使用SimpleWebRTC附带的默认设置。

我已经建立了我自己的连接:

代码语言:javascript
复制
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初始化:

代码语言:javascript
复制
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“没有触发。

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38364989

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档