From d01eeced8d011b02eabfa7807eec8245bc5dc26d Mon Sep 17 00:00:00 2001 From: Brendan Moore Date: Sun, 29 May 2022 10:22:16 +0100 Subject: [PATCH] fix: iOS restartIce on failed iceConnectionState (#231) looks good --- src/client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index a7c66dfa..52c9ef34 100644 --- a/src/client.ts +++ b/src/client.ts @@ -55,7 +55,8 @@ export class Transport { }; this.pc.oniceconnectionstatechange = async (e) => { - if (this.pc.iceConnectionState === 'disconnected') { + // iOS iceConnectionState can go straight to "failed" without emitting "disconnected" + if (this.pc.iceConnectionState === 'disconnected' || this.pc.iceConnectionState === 'failed') { if (this.pc.restartIce !== undefined) { // this will trigger onNegotiationNeeded this.pc.restartIce();