From 4e0739d8f3144ec780d9cd9c32892f8f2c54a0b9 Mon Sep 17 00:00:00 2001 From: streamer45 Date: Sun, 4 Aug 2019 11:33:36 +0200 Subject: [PATCH] fix audio deinit --- src/recorder.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/recorder.js b/src/recorder.js index 1941101..5277c76 100644 --- a/src/recorder.js +++ b/src/recorder.js @@ -76,6 +76,7 @@ class Recorder { this.muteNode.disconnect(this.audioCtx.destination); this.procNode.disconnect(this.muteNode); this.srcNode.disconnect(this.procNode); + this.procNode.onaudioprocess = null; this.mediaStream.getTracks()[0].stop(); this.mediaStream = null; } @@ -173,9 +174,9 @@ class Recorder { return new Promise((res, rej) => { if (!this.audioCtx || !this.worker) return rej(new Error('Recorder not initialized')); if (!this.mediaStream) return rej(new Error('Recorder not started')); + this._stopCapture(); this.startTime = 0; this.stopTime = 0; - this._stopCapture(); this._onCancel = () => res(); this.worker.postMessage('cancel'); });