Recently in my application, I have added a feature for ICE Restart whenever we detect ICE Connection state as 'disconected'
Basically here is what I do
STEP 1:
if (peerConnection.iceConnectionState === "disconnected") {
// nothing
republishForIceRestart();
}
STEP 2:
var republishForIceRestart = function () {
peerConnection.onicecandidate = function() {
console.log("no actionTaken on republish for onicecandidate")
}
handleIceConnectionStateChange(peerConnection);
var publisherConstraints = {
}
publisherConstraints.iceRestart = true;
peerConnection
.createOffer(createdDescriptionIceRestart, errorHandler, publisherConstraints);
}
OBSERVATION:
1. In Janus logs, I see this
[WARN] [1601494747650989] ICE restart detected
[1601494747650989] Restarting ICE...
[8403247280081227] Updating existing session
2. But in Google Chrome's console of the browser on which ICE failed occurred, I see this.
~~~~ Setting up remote description for the received answer from remote
purple-breeze-5946#live:1 Uncaught (in promise) DOMException: Failed to set remote answer sdp: Called in wrong state: kStable
So looks like for the sent offer with iceRestart = true, Janus is sending the answer back and somehow there is an exception in setting up remote answer SDP with setRemoteDescription
Does anyone know if this flow for ICE restart is correct or am I missing anything?
--