Edge上的WebRTC给出了;addRemoteCandidate的超时。考虑发送候选人候补通知“>;

Edge上的WebRTC给出了;addRemoteCandidate的超时。考虑发送候选人候补通知“>;,webrtc,microsoft-edge,ortc,Webrtc,Microsoft Edge,Ortc,注意:请检查最近的编辑 我对这个警告感到不安: Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification 我不明白如何解决这个问题。我使用adapter.js,找到了一个人们谈论这个问题的地方。但解决办法并不奏效 我试图添加pc.addIceCandidate(null),但它什么也没做 在chrome上,ICE状态从检查变为连接非常快 在edge上,ICE状态将挂起检查,几秒钟后转到

注意:请检查最近的编辑

我对这个警告感到不安:

Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification
我不明白如何解决这个问题。我使用adapter.js,找到了一个人们谈论这个问题的地方。但解决办法并不奏效

我试图添加
pc.addIceCandidate(null)
,但它什么也没做


在chrome上,ICE状态从
检查
变为
连接
非常快

在edge上,ICE状态将挂起检查,几秒钟后转到新的,但它不应该是新的

编辑:

添加
pc.addIceCandidate(空)为我提供
0:InvalidStateError
。调用
pc.addIceCandidate之前的状态(null)是新的

我还尝试使用
pc.addIceCandidate({candidate:'}),但它什么也不做

下面是代码的相关部分,我尝试在其中添加修复:

function handleIceCandidate(event) {
  console.log('icecandidate event: ', event);
  if (event.candidate) {
    sendMessage([{
      type: 'candidate',
      label: event.candidate.sdpMLineIndex,
      id: event.candidate.sdpMid,
      candidate: event.candidate.candidate
    }, room]);
  } else {
    console.log("state in End of candidates: " + pc.iceConnectionState);
    if (window.navigator.userAgent.indexOf("Edge") > -1 && pc.iceConnectionState == "new") {
      //pc.addIceCandidate(null);
      pc.addIceCandidate({candidate:''});
    }
  }
}
在套接字调用中:

socket.on('message', function(message) {


  if (message.type === 'candidate' && isStarted) {

    var candidate = new RTCIceCandidate({
      sdpMLineIndex: message.label,
      candidate: message.candidate
    });
    pc.addIceCandidate(candidate);
    console.log("state in socket: " + pc.iceConnectionState);
    if (window.navigator.userAgent.indexOf("Edge") > -1 && pc.iceConnectionState == "new") {
      //pc.addIceCandidate(null);
      pc.addIceCandidate({candidate:''});
    }
  } 
});
编辑:

adapter.js中似乎存在问题:

if (!pc._remoteDescription) {
        return reject(makeError('InvalidStateError',
            'Can not add ICE candidate without a remote description'));
      } else if (!candidate || candidate.candidate === '') { 
        for (var j = 0; j < pc.transceivers.length; j++) {
          if (pc.transceivers[j].rejected) {
            continue;
          }
          pc.transceivers[j].iceTransport.addRemoteCandidate({});
          sections = SDPUtils.getMediaSections(pc._remoteDescription.sdp);
          sections[j] += 'a=end-of-candidates\r\n';
          console.log("tries to send end of candidates (I added this)");
          pc._remoteDescription.sdp =
              SDPUtils.getDescription(pc._remoteDescription.sdp) +
              sections.join('');
          if (pc.usingBundle) {
            break;
          }
        }
      }
这将进入adapter.js中的
else if
,在那里它尝试附加
a=候选项的结尾\r\n
,但在以下情况下失败:

0: InvalidAccessError
它在adapter.js中的这一行:

pc.transceivers[j].iceTransport.addRemoteCandidate({});
我想我需要在这里添加
null
候选者,我尝试了不同的语法变体,但没有成功:

pc.transceivers[j].iceTransport.addRemoteCandidate(null);
pc.transceivers[j].iceTransport.addRemoteCandidate({candidate:''});
pc.transceivers[j].iceTransport.addRemoteCandidate();
pc.transceivers[j].iceTransport.addRemoteCandidate({""});
来自Microsoft on Edge:

当远程RTICegherer提交其最终候选者时, 应使用RTCIceCandidateComplete调用addRemoteCandidate() 字典作为参数,以便本地RTICETransport可以知道 预期不再有远程候选人,可以输入 “完成”状态

我试过:

pc.transceivers[j].iceTransport.addRemoteCandidate(new RTCIceCandidateComplete({complete:true}));
pc.transceivers[j].iceTransport.addRemoteCandidate({complete:true});
第一个给了我:

RTCIceCandidateComplete is not defined

请检查这是否有帮助@Roman,你好。你解决这个问题了吗?我也有同样的问题Edge@user233428不,它似乎在旧的Edge版本上不起作用。但我注意到windows最近将Edge更新为基于铬的Edge。希望到那时这个问题会消失。
RTCIceCandidateComplete is not defined