Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/pwa-audio-recorder/app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,13 @@ function visualizeRecording({stream, outlineIndicator, waveformIndicator}) {
/** Repeatedly draws the waveform and loudness indicator. */
function draw() {
if (!stream.active) {
return; // Stop drawing loop once the recording stopped.
// Stop drawing loop once the recording stopped, and release the
// AudioContext. Browsers limit the number of concurrent AudioContexts, so
// failing to close it here leaks one context per recording and, after a
// few dozen recordings, prevents new contexts from starting (the waveform
// stops appearing and playback breaks until the page is refreshed).
audioCtx.close();
return;
}

analyser.getByteFrequencyData(dataArray);
Expand Down
Loading