WebRTC-在onIceCandidate中首次将候选者获取为null

时间:2020-06-08 10:32:17

标签: webrtc rtcpeerconnection

我进行了几次跨浏览器测试,并且在从Chrome到Firefox(在接收方)上进行测试时,我总是第一次遇到此问题。刷新后,似乎工作正常。

我有一个绑定到peerConnection的事件处理程序,如下所示。

peerconnection.onicecandidate = handleIceCandidate;

function handleIceCandidate(event) {
   console.log('icecandidate event: ', event);
   if (event.candidate) {
       sendMessage({
           type: 'candidate',
           label: event.candidate.sdpMLineIndex,
           id: event.candidate.sdpMid,
           candidate: event.candidate.candidate
       });
   } else {
       console.log('End of candidates.');    
   }
}

第一次,我的候选者为空。 event.candidate = null

任何线索,这里可能会发生什么?让我知道您是否需要更多信息。

谢谢!

0 个答案:

没有答案