问题是只有当两台计算机处于同一 LAN 环境中时才能看到远程视频,即来自不同 ip 的远程视频看不到并且在 js 控制台中我得到错误ICE failed, see about:webrtc for more details
。
我正在尝试搜索解决方案,发现问题可能是因为“在发送答案之前收到了 ICE 候选人 RemoteDescription 应该设置”,但我不知道如何纠正它。
在其他 webrtc 脚本的一部分中,例如 RTCMultiConnection 没有这个问题。
有什么解决办法吗?
EasyRTC - http://easyrtc.com/download/
运行 EasyRTC- http://wdd.co.il:8280
更新:我的 onIceCandidate
pc.onicecandidate = function(event) {
if (newPeerConn.cancelled) {
return;
}
var candidateData;
if (event.candidate && peerConns[otherUser]) {
candidateData = {
type: 'candidate',
label: event.candidate.sdpMLineIndex,
id: event.candidate.sdpMid,
candidate: event.candidate.candidate
};
if( iceCandidateFilter ) {
candidateData = iceCandidateFilter(candidateData, false);
if( !candidateData ) {
return;
}
}
//
// some candidates include ip addresses of turn servers. we'll want those
// later so we can see if our actual connection uses a turn server.
// The keyword "relay" in the candidate identifies it as referencing a
// turn server. The \d symbol in the regular expression matches a number.
//
if (event.candidate.candidate.indexOf("typ relay") > 0) {
var ipAddress = event.candidate.candidate.match(/(udp|tcp) \d+ (\d+\.\d+\.\d+\.\d+)/i)[2];
self._turnServers[ipAddress] = true;
}
if (peerConns[otherUser].connectionAccepted) {
sendSignalling(otherUser, "candidate", candidateData, null, function() {
failureCB(self.errCodes.PEER_GONE, "Candidate disappeared");
});
}
else {
peerConns[otherUser].candidatesToSend.push(candidateData);
}
}
};