【发布时间】:2018-05-24 15:41:18
【问题描述】:
以下是来自 google webrtc 教程的示例 webrtc 点对点连接代码。 this link. 我无法正确理解 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);
}
);
【问题讨论】:
-
html5rocks.com/en/tutorials/webrtc/infrastructure 解释了什么是冰候选(以及理解事物所需的许多其他概念)
标签: javascript node.js webrtc