Onicecandidate event is not firing

I am very much tired of this issue and getting frustrated. I am trying to implement a peer-to-peer video call. My RTCPeerConnection is something like this :

const configuration = { iceServers: [{ url: 'stun:stun.l.google.com:19302' }] };

const peerConnection = new RTCPeerConnection(this.configuration);

peerConnection.onicecandidate = e => {
    try {
        console.log('remotePC icecandidate:', e.candidate);
        // if (e.candidate) {
        //     peerConnection.addIceCandidate(e.candidate);
        // }
    } catch (err) {
        console.error(`Error adding localPC iceCandidate: ${err}`);
    }
};

This onicecandidate event is not firing. That’s why I can’t exchange candidate between peers through my server. My server is running locally. Also, I have set local description and remote description successfully.

Any working example would be very helpful to me. Thanks in advance.

Anyone can help with that, please? react-native-webrtc version 1.75.3 and react-native version 0.62.2. I have checked this repo, it’s working for local-only calls but when I try with the signaling server it’s not working.

incase you still having this problem. It turns out you need to add stream audio/video or dataChannel to the connection to be able to get the candidate.

1 Like

Give it a try. It uses firebase for signalling.

1 Like

Thank you, this help me in solving the issue of the onicecandidate not firing

Kinda surprised this sort of issue still comes up :thinking:
As candidates contain information required to connect peers together.
It makes sense that they only get created when getting a peer ready to send something.
That being said i’ll put something in the future documentation to explain things better.