【问题标题】:Failed to execute 'updateIce' on 'RTCPeerConnection': Could not update the ICE Agent with the given configuration无法在“RTCPeerConnection”上执行“updateIce”:无法使用给定配置更新 ICE 代理
【发布时间】:2017-06-26 22:02:31
【问题描述】:

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

未捕获的 DOMException:无法在“RTCPeerConnection”上执行“updateIce”:无法使用给定配置更新 ICE 代理。 在: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);

为什么我没有为这个函数传递正确的参数?

【问题讨论】:

    标签: javascript webrtc


    【解决方案1】:

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

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

    【讨论】:

    • 我使用这种方法的原因,只是为了更新ice服务器而不是再次重新建立新的对等连接,这将需要很多时间,因为我有功能重新连接视频或刷新看这里gyazo.com/e9c81fd0779aad22a19e37659b9abbe1 和我使用的冰服务器有 20 秒 (TTL) 的限制并且以前的冰服务器已经过期我也尝试了 PeerConnection.setConfiguration() 但它似乎没有) 识别为函数
    • setConfiguration 仅在 Chrome 58 及更高版本中可用,请参阅链接的问题。在此之前,您将需要更长的凭据 TTL。
    • 所以这确实意味着除了找到具有更长 TTL 的 ice 服务器之外没有其他解决方案。好的,因为updateIce 从未正确实施,setConfiguration 仍处于实验阶段
    猜你喜欢
    • 1970-01-01
    • 2016-08-08
    • 2019-08-18
    • 1970-01-01
    • 2018-02-12
    • 2021-09-21
    • 1970-01-01
    • 1970-01-01
    • 2022-08-21
    相关资源
    最近更新 更多