Release microphone stream immediately after capture stops

This commit is contained in:
2026-04-26 19:02:26 -04:00
parent cf383205bf
commit 4d087e2ec7
+4
View File
@@ -55,6 +55,10 @@ export default function CapturePage() {
const mr = new MediaRecorder(streamRef.current, { mimeType });
mr.ondataavailable = e => { if (e.data.size > 0) chunksRef.current.push(e.data); };
mr.onstop = async () => {
// Release microphone immediately after stopping
streamRef.current?.getTracks().forEach(t => t.stop());
streamRef.current = null;
if (chunksRef.current.length === 0) return;
setState('transcribing');
try {