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