Loading...
pc.oniceconnectionstatechange = () => {
console.log(pc.iceConnectionState);
};pc.oniceconnectionstatechange = () => {
if (pc.iceConnectionState === 'failed') {
pc.restartIce();
}
};restartIce() gathers new candidates and triggers renegotiation, so the call can recover after a network change.
icecandidate event handler sends every candidate to the other peer.Host is the device's local address, srflx is the public address found through STUN, relay is an address on a TURN server.
Gathering new candidates and renegotiating on an existing connection, used when the network changes or the connection fails.
Usually because no candidate pair can reach the other side, often due to strict NAT or firewalls with no TURN server configured.