Skip to content

Commit bab8415

Browse files
authored
SF-3605 Stop microphone when the record dialog is closed mid-countdown (#3541)
1 parent 5008a69 commit bab8415

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/shared/audio-recorder-dialog/audio-recorder-dialog.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ export class AudioRecorderDialogComponent implements ControlValueAccessor, OnIni
178178
},
179179
complete: () => {
180180
this.showCountdown = false;
181-
if (!this.destroyed) this.startRecording(mediaStream);
181+
if (this.destroyed) {
182+
// If the dialog was closed during countdown, stop the media stream
183+
mediaStream.getAudioTracks().forEach(track => track.stop());
184+
} else {
185+
this.startRecording(mediaStream);
186+
}
182187
}
183188
});
184189
}

0 commit comments

Comments
 (0)