Timothy J. Baek 8 달 전
부모
커밋
8a99eaa68f
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      src/lib/components/chat/MessageInput/CallOverlay.svelte

+ 11 - 0
src/lib/components/chat/MessageInput/CallOverlay.svelte

@@ -243,6 +243,15 @@
 		mediaRecorder.start();
 	};
 
+	const stopAudioStream = async () => {
+		if (audioStream) {
+			const tracks = audioStream.getTracks();
+			tracks.forEach((track) => track.stop());
+		}
+
+		audioStream = null;
+	};
+
 	// Function to calculate the RMS level from time domain data
 	const calculateRMS = (data: Uint8Array) => {
 		let sumSquares = 0;
@@ -911,6 +920,8 @@
 				<button
 					class=" p-3 rounded-full bg-gray-50 dark:bg-gray-900"
 					on:click={async () => {
+						stopAudioStream();
+						stopVideoStream();
 						showCallOverlay.set(false);
 					}}
 					type="button"