以下是来自 google webrtc 教程的示例 webrtc 对等连接代码。这个链接。我无法正确理解 addIceCandidate() 如何使用 onIceCandidate() 将其 Ice 候选者添加到其远程对等点。event.candidate 在这里是什么意思。一个明确的解释将不胜感激
function onIceCandidate(pc, event) { //pc1.onicecandidate
if (event.candidate) {
getOtherPc(pc).addIceCandidate(
new RTCIceCandidate(event.candidate)
).then(
function() {
onAddIceCandidateSuccess(pc);
},
function(err) {
onAddIceCandidateError(pc, err);
}
);
Run Code Online (Sandbox Code Playgroud)