小编amb*_* 66的帖子

Webrtc 将 ice 候选添加到远程对等点

以下是来自 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)

javascript node.js webrtc

2
推荐指数
1
解决办法
1759
查看次数

标签 统计

javascript ×1

node.js ×1

webrtc ×1