利用Firefox浏览器在局域网内建立WebRTC,报错:“ICE failed, add a STUN server and see about:webrtc for more details”。局域网不是不需要ice服务器吗?大家的ice服务器是怎么解决的?求教一下。
ICE failed, add a STUN server and see about:webrtc for more details
asdf5797
#4
您好,我建立RTCPeerConnection代码如下:
function makecall() {
showRtcMessage("new RTCPeerConnection !!!");
var servers = null;
window.peerConnection = peerConnection = new RTCPeerConnection(servers);
peerConnection.onicecandidate = onIceCandidate;
peerConnection.oniceconnectionstatechange = onIceStateChange;
showRtcMessage("Added local stream to peerConnection");
peerConnection.addStream(localStream);
//peerConnection.ontrack = gotRemoteStream;
peerConnection.onaddstream = gotRemoteStream;
sendMessage(JSON.stringify({
"event" : "_join"
}));
}
yusicheng
#5
感觉问题是在交换SDP上,看你的代码里没有交换SDP的步骤。
但你提的问题是“ICE failed, add a STUN server and see about:webrtc for more details”
这错误比较像peerConnection = new RTCPeerConnection(servers);这句里,servers填的不对。但是代码里没有具体信息吗,我也不好说有什么问题。
你如果有兴趣探讨可以留个仓库地址什么的,让我能调试完整的代码就好了