Просмотр исходного кода

fix: voice note mic not stopping issue

Timothy J. Baek 7 месяцев назад
Родитель
Сommit
466eea1a4c
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      src/lib/components/chat/MessageInput/VoiceRecording.svelte

+ 7 - 0
src/lib/components/chat/MessageInput/VoiceRecording.svelte

@@ -269,6 +269,13 @@
 			await mediaRecorder.stop();
 		}
 		clearInterval(durationCounter);
+
+		if (stream) {
+			const tracks = stream.getTracks();
+			tracks.forEach((track) => track.stop());
+		}
+
+		stream = null;
 	};
 </script>