1

I am getting this error when I addICECandidate

var candidate = new RTCIceCandidate({sdpMLineIndex:message.label,
                            candidate:message.candidate});
                        pc.addIceCandidate(candidate);

My candidate is forming correctly still I am getting this error.

Error is: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added.

My issue is while creating offer pc.createOffer(setLocalAndSendMessage, onSignalingError, sdpConstraints); here nothing happens neither setLocalAndSendMessage is called neither onSignalingError thats why later on candidate could not be added.

Tahlil
  • 2,680
  • 6
  • 43
  • 84
abcd
  • 95
  • 2
  • 8
  • Has the peerconnection set the remote SDP yet? You cannot add remote Ice candidates until you have set the remote SDP. – Benjamin Trent Oct 14 '14 at 12:13
  • what do you mean formed? LOCAL ice candidates are gathered and added automatically. The `addIceCandidate` function is to add REMOTE ice candidates AFTER you set the remote SDP from the other party. – Benjamin Trent Oct 14 '14 at 12:29
  • I have set the remote SDP as well as parsed it to extract the message label and message candidates, but when I addIceCandidate It throws an error. – abcd Oct 14 '14 at 12:33
  • Don't do that. Candidates that are included in the SDP are added automatically. You are trying to add duplicate candidates if you are parsing them out and re-adding them after setting the remote SDP. – Benjamin Trent Oct 14 '14 at 12:39
  • My issue is while creating offer pc.createOffer(setLocalAndSendMessage, onSignalingError, sdpConstraints); here nothing happens neither setLocalAndSendMessage is called neither onSignalingError – abcd Oct 15 '14 at 08:48
  • I am guessing your peerconnection object is not create properly or your callbacks are incorrect. Without the context of the code I cannot be sure what the issue is. – Benjamin Trent Oct 15 '14 at 12:46

0 Answers0