release mic after use

This commit is contained in:
Joel Mathew Thomas
2025-03-22 22:32:29 +05:30
parent 85bb67078c
commit 505f2b7055
+2
View File
@@ -52,6 +52,8 @@ function UploadPage() {
recorder.onstop = () => {
const blob = new Blob(chunks, { type: "audio/wav" });
const file = new File([blob], "recording.wav", { type: "audio/wav" });
const tracks = stream.getTracks();
tracks.forEach(track => track.stop());
validateAndSetFile(file);
handleUpload(file);
};