Release microphone stream immediately after capture stops
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user