Restart ICE in client on up connection failures.
This commit is contained in:
+12
-1
@@ -1168,7 +1168,7 @@ async function newUpStream(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pc.onicecandidate = function(e) {
|
pc.onicecandidate = e => {
|
||||||
if(!e.candidate)
|
if(!e.candidate)
|
||||||
return;
|
return;
|
||||||
send({type: 'ice',
|
send({type: 'ice',
|
||||||
@@ -1177,6 +1177,17 @@ async function newUpStream(id) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pc.oniceconnectionstatechange = e => {
|
||||||
|
if(pc.iceConnectionState === 'failed') {
|
||||||
|
try {
|
||||||
|
pc.restartIce();
|
||||||
|
} catch(e) {
|
||||||
|
console.error(e);
|
||||||
|
displayError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pc.ontrack = console.error;
|
pc.ontrack = console.error;
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
Reference in New Issue
Block a user