javascript - 无法在 'updateIce' : Could not update the ICE Agent with the given configuration 上执行 'RTCPeerConnection'

标签 javascript webrtc

您好,我目前正在使用 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 月到期

关于javascript - 无法在 'updateIce' : Could not update the ICE Agent with the given configuration 上执行 'RTCPeerConnection',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42127479/

相关文章:

javascript - 基于浏览器的实时视频聊天,没有闪光灯

javascript - 在页面加载时运行 jQuery 函数并使用按钮重复

javascript - Socket.io 在新连接上触发断开事件

javascript - webRTC错误未定义配置

javascript - PeerJS - 手动关闭对等点之间的连接

javascript - 带画中画功能的 WebRTC 视频通话

javascript - 从渲染方法中的嵌套函数 react 调用组件的方法

javascript - Google PageSpeed 建议使用小型内联 CSS

javascript - 在javascript中验证图像路径

javascript - WebRTC Server PeerJS 获取数据流