Skip to content

Commit

Permalink
fix audio deinit
Browse files Browse the repository at this point in the history
  • Loading branch information
streamer45 committed Aug 4, 2019
1 parent 941d4c2 commit 4e0739d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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');
});
Expand Down

0 comments on commit 4e0739d

Please sign in to comment.