fix: fix issue with call voice recording starting before voice detection

This commit is contained in:
vincent-thevenin 2025-03-03 13:59:28 +01:00
parent 3d6e48b05e
commit 4d6132b9de

View File

@ -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;