Commit 4b32c55a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Restart ICE in client on up connection failures.

parent 9c25696d
...@@ -1168,7 +1168,7 @@ async function newUpStream(id) { ...@@ -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) { ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment