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 });
|
const mr = new MediaRecorder(streamRef.current, { mimeType });
|
||||||
mr.ondataavailable = e => { if (e.data.size > 0) chunksRef.current.push(e.data); };
|
mr.ondataavailable = e => { if (e.data.size > 0) chunksRef.current.push(e.data); };
|
||||||
mr.onstop = async () => {
|
mr.onstop = async () => {
|
||||||
|
// Release microphone immediately after stopping
|
||||||
|
streamRef.current?.getTracks().forEach(t => t.stop());
|
||||||
|
streamRef.current = null;
|
||||||
|
|
||||||
if (chunksRef.current.length === 0) return;
|
if (chunksRef.current.length === 0) return;
|
||||||
setState('transcribing');
|
setState('transcribing');
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user