WebRTC实践:无法添加icecandidate

时间:2016-05-14 12:15:33

标签: node.js html5 webrtc

我在完成优惠和回答后添加了IceCandidate,但它仍然会调用错误:' RTCPeerConnection':无法添加icecandidate。这是我的代码的一部分:

else if (data.user_type == 'signaling') {
  if (!rtcPeerConn)
    startSignaling();
  var message = JSON.parse(data.user_data);
  if (message.sdp) {
    rtcPeerConn.setRemoteDescription(new RTCSessionDescription(message.sdp),
        function () { // if we received an offer, we need to answer
      if (rtcPeerConn.remoteDescription.type == 'offer' && myUserType=="doctor") {
        rtcPeerConn.createAnswer(sendLocalDesc, logError);
      }
    }, logError);
  } else {
    rtcPeerConn.addIceCandidate(new RTCIceCandidate(message.candidate));
  }
}

0 个答案:

没有答案