ソースを参照

Merge pull request #11073 from vincent-thevenin/dev

fix: fix issue with call voice recording starting before voice detection
Timothy Jaeryang Baek 1 ヶ月 前
コミット
d78fe4decc
1 ファイル変更4 行追加2 行削除
  1. 4 2
      src/lib/components/chat/MessageInput/CallOverlay.svelte

+ 4 - 2
src/lib/components/chat/MessageInput/CallOverlay.svelte

@@ -231,7 +231,6 @@
 			mediaRecorder.onstart = () => {
 				console.log('Recording started');
 				audioChunks = [];
-				analyseAudio(audioStream);
 			};
 
 			mediaRecorder.ondataavailable = (event) => {
@@ -245,7 +244,7 @@
 				stopRecordingCallback();
 			};
 
-			mediaRecorder.start();
+			analyseAudio(audioStream);
 		}
 	};
 
@@ -321,6 +320,9 @@
 				if (hasSound) {
 					// BIG RED TEXT
 					console.log('%c%s', 'color: red; font-size: 20px;', '🔊 Sound detected');
+					if (mediaRecorder && mediaRecorder.state !== 'recording') {
+						mediaRecorder.start();
+					}
 
 					if (!hasStartedSpeaking) {
 						hasStartedSpeaking = true;