From 4f08056c59c98990f0afe8901c61917fc08023e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Wed, 31 May 2023 22:24:03 +0200 Subject: [PATCH] do not fail on remote ICE candidate error in offer. --- src/component/internal/webrtc.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/component/internal/webrtc.ts b/src/component/internal/webrtc.ts index 19bb8b64..047a16a9 100644 --- a/src/component/internal/webrtc.ts +++ b/src/component/internal/webrtc.ts @@ -238,11 +238,17 @@ export class NekoWebRTC extends EventEmitter { await this._peer.setRemoteDescription({ type: 'offer', sdp }) if (this._candidates.length > 0) { + let candidates = 0 for (const candidate of this._candidates) { - await this._peer.addIceCandidate(candidate) + try { + await this._peer.addIceCandidate(candidate) + candidates++ + } catch (error: any) { + this._log.warn(`unable to add remote ICE candidate`, { error }) + } } - this._log.debug(`added ${this._candidates.length} remote ICE candidates`, { candidates: this._candidates }) + this._log.debug(`added ${candidates} remote ICE candidates`, { candidates: this._candidates }) this._candidates = [] }