Peer Connections onicecandidate is returning NULL for candidates always

148 Views Asked by At

I am trying to get the group video call to work using WebRTC in React Native application.

The offers, local description and remote description part is working correctly. However, oniceCandidate function is always returning null for Candidate.

The code used for ice candidate is as below

pc.onicecandidate = (event) => {
    alert(JSON.stringify(event));
  if (event.candidate) {
    alert('Ice candidate 222222');
    // alert(`Sending ICE candidate to ${userId}: ${event.candidate}`);
    this.socket.emit('iceCandidate_multiple', { candidate: event.candidate, userId: this.state.userId, roomId: this.state.roomId });
  }
};

When alerting the event it gives the response as below

{"isTrusted": false, "candidate": null}

The above response is displaying always and no candidates are fetching and hence the remote stream is black always.

Could anyone help to get this sorted out and get the correct ice candidate and make remote stream to display.

Thanks in Advance.

0

There are 0 best solutions below