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 = [] }