Ice candidate failed

I am trying to create a sample video calling app, but from some reason ICE candidate fails, please help
and no video is shown,

The problem is when I am trying to send ice candidate to the other peer.
After the other peer has received the ice candidate and it is set, the oniceconnectionstatechange is being called, in it the event.target.iceConnectionStatus is “failed”

These are the candidate that the PEER A is sending to peer B after offer and answer are done

{"candidate":"candidate:3362660723 1 udp 2122260223 192.168.232.2 57905 typ host generation 0 ufrag 02Fh network-id 5 network-cost 10","sdpMLineIndex":0,"sdpMid":"audio"}
 {"candidate":"candidate:361502126 1 udp 2122187263 fec0::15:b2ff:fe00:0 42725 typ host generation 0 ufrag 02Fh network-id 6 network-cost 10","sdpMLineIndex":1,"sdpMid":"video"}

And when the Peer B is setting that candidate using this addIceCandidate(new RTCIceCandidate(candidate)) , oniceconnectionstatechange is being called and in that the connection is failing

TLDR: oniceconnectionstatechange should return iceConnectionState to be complete or successful in order to view remote stream

here’s the source code : https://github.com/alexakasanjeev/webrtc-react-native-client

What error message do you see?

Hi saghul

I am able to generate and send offer and answer successfully. No problem there.

The problem is when I am trying to send ice candidate to the other peer.
After the other peer has received the ice candidate and it is set, the oniceconnectionstatechange is being called, in it theevent.target.iceConnectionStatus is “failed”

This is the candidate that the PEER A is sending to peer B after offer and answer are done

{"candidate":"candidate:3362660723 1 udp 2122260223 192.168.232.2 57905 typ host generation 0 ufrag 02Fh network-id 5 network-cost 10","sdpMLineIndex":0,"sdpMid":"audio"}
 {"candidate":"candidate:361502126 1 udp 2122187263 fec0::15:b2ff:fe00:0 42725 typ host generation 0 ufrag 02Fh network-id 6 network-cost 10","sdpMLineIndex":1,"sdpMid":"video"}

And when the Peer B is setting that candidate using this addIceCandidate(new RTCIceCandidate(candidate)) , oniceconnectionstatechange is being called and in that the connection is failing

TLDR: oniceconnectionstatechange should return iceConnectionState to be complete or successful in order to view remote stream

Can you please help me, I have provided link to the repo, you can clone and test at your end

The video candidate is using a link local IPv6 address, I wonder if that’s why ICE cannot be established. Can you try using some STUN servers?

Hi, I don’t know how to use STUN servers, in my PeerConnection I am using this

const configuration = { "iceServers": [{ "url": "stun:stun.l.google.com:19302" }] };
pc = new RTCPeerConnection(configuration);

Is this a STUN server, if not, how can I add STUN server?

Also, I have made a demo in react for browser also, using the same signalling server, when I am trying to connect react-native demo(on my phone) with react demo(on browser) and when browser is sending ice candidate to the react native demo app, the video streaming is successful, but if react native demo is sending icecandidate to another react-native demo or react demo(on broswer) no video is being streamed.

This is the ice candidate send by browser(react demo) to the phone( react-native demo) which is working fine
candidate_2

1 Like