1
Fork 0

Restart ICE in client on up connection failures.

This commit is contained in:
Juliusz Chroboczek 2020-06-11 19:11:36 +02:00
parent 9c25696d01
commit 4b32c55a57
1 changed files with 12 additions and 1 deletions

View File

@ -1168,7 +1168,7 @@ async function newUpStream(id) {
}
}
pc.onicecandidate = function(e) {
pc.onicecandidate = e => {
if(!e.candidate)
return;
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;
return id;