I faced a strange issue. I created peerconnection with that code
const pc = new RTCPeerConnection(
pcConfig: { iceServers, iceTransportPolicy: "relay" },
localStream: localStream
});
pc.addEventListener("icecandidate", iceCandidateListener);
iceCandidateListener = (event, p) => {
if (event.candidate) {
// unreachable code becuse event.candidate = null
const { candidate } = event;
console.warn("[iceCandidateListener] Candidate", candidate);
} else if (event.candidate === null) {
console.warn("[iceCandidateListener] event.candidate === null", type);
switch (type) {
case "offer":
// send offer here
break;
case "answer":
// send answer here
break;
default:
break;
}
}
};
After I added onicecandidate event to my peerconnection, I started to get candidates. But the problem is that I can retrieve relay candidates in react-native-application only when debug enabled via react-native-debug-menu. For other platforms like Web, candidates are easily gathered. Do you have any idea what’s happening and where to look how gathering candidates process is organized?
Any help will be highly appreciated, because I got stuck for days.