Skip to content

Commit 602eb62

Browse files
committed
Fix closing of AudioContext that is already closed
When you were retrying after being done, the 'retry' handler was trying to close the AudioContext that had already been closed by the 'done' handler thus throwing an exception. Fixed by checking the AudioContext's state for being closed already before trying to close it.
1 parent 532a8a6 commit 602eb62

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/Recorder.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ export default class Recorder extends H5P.EventDispatcher {
248248
this.stream.getAudioTracks().forEach(track => track.stop());
249249
this.sourceNode.disconnect();
250250
this.scriptProcessorNode.disconnect();
251-
this.audioContext.close();
251+
if (this.audioContext.state !== 'closed') {
252+
this.audioContext.close();
253+
}
252254

253255
delete this.userMedia;
254256
}

0 commit comments

Comments
 (0)