From 53a78140eada05d25847242e44e92be4f304915c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 12 Feb 2022 18:39:26 +0100 Subject: [PATCH] webrtc statsStop in diesconnect function. --- src/component/internal/webrtc.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/component/internal/webrtc.ts b/src/component/internal/webrtc.ts index 1b617b0c..5024184f 100644 --- a/src/component/internal/webrtc.ts +++ b/src/component/internal/webrtc.ts @@ -306,6 +306,11 @@ export class NekoWebRTC extends EventEmitter { this._peer = undefined } + if (this._statsStop && typeof this._statsStop === 'function') { + this._statsStop() + this._statsStop = undefined + } + this._track = undefined this._state = 'disconnected' this._connected = false @@ -459,11 +464,6 @@ export class NekoWebRTC extends EventEmitter { this._log.info(`disconnected`, { error }) this.emit('disconnected', error) this._connected = false - - if (this._statsStop && typeof this._statsStop === 'function') { - this._statsStop() - this._statsStop = undefined - } } private statsEmitter(ms: number = 2000) {