无法在 'RTCPeerConnection' 上执行 'updateIce':无法使用给定配置更新 ICE 代理

Failed to execute 'updateIce' on 'RTCPeerConnection': Could not update the ICE Agent with the given configuration

您好,我目前正在使用 webrtc 进行视频聊天,但在尝试使用时遇到错误 PeerConnection.updateIce(config) 它说

Uncaught DOMException: Failed to execute 'updateIce' on 'RTCPeerConnection': Could not update the ICE Agent with the given configuration. at :1:4

var ICE_config= {
  'iceServers': [
    {
      'url': 'stun:stun.l.google.com:19302'
    },
    {
      'url': 'turn:192.158.29.39:3478?transport=udp',
      'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
      'username': '28224511:1379330808'
    },
    {
      'url': 'turn:192.158.29.39:3478?transport=tcp',
      'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
      'username': '28224511:1379330808'
    }
  ]
}
var peerConnection = new RTCPeerConnection(ICE_config);

我更新我的 iceServers

var new_ICE_config= {
  'iceServers': [
    {
      'url': 'stun:stun.l.google.com:19302'
    },... and so on
  ]
}

peerConnection.updateIce(iceServers);

为什么会出现这个错误,我没有为这个函数传递正确的参数吗?

updateIce 方法从未在 Chrome 中正确实现,请参阅 here 了解其中一个错误。您认为需要调用 updateIce 的原因是什么?

您可能希望与 TURN 服务器创建对等连接,这些服务器可以正常工作并且由您操作,而不是 'turn:192.158.29.39:3478?transport=udp'(和另一个)。这些凭据最初来自 this html5rocks tutorial,已于 2013 年 9 月到期