我现在正在实现WebRTC Samples的源代码,通过使用网状拓扑成为3个用户连接.
但是,我的代码不能像我想象的那样工作.我认为我停留在调用函数iceCallBack#(#指的是数字1,2,3),因为输出结果与原始结果相同.它只能连接2个用户.
我不知道如何以正确的方式解决它.
以下是我一直在研究的一些JavaScript代码:
var audio2 = document.querySelector('audio#audio2');
var audio3 = document.querySelector('audio#audio3');
var pc1;
var pc2;
var pc3;
function call() {
callButton.disabled = true;
codecSelector.disabled = true;
trace('Starting call');
var servers = null;
var pcConstraints = {
'optional': []
};
pc1 = new RTCPeerConnection(servers, pcConstraints);
trace('Created local peer connection object pc1');
pc1.onicecandidate = iceCallback1;
pc2 = new RTCPeerConnection(servers, pcConstraints);
trace('Created remote peer connection object pc2');
pc2.onicecandidate = iceCallback2;
pc2.onaddstream = gotRemoteStream;
trace('Requesting local stream');
pc3 …Run Code Online (Sandbox Code Playgroud)