Skip to content

Commit e09d340

Browse files
committed
fix: interview stuck after first question - listener restart race condition
- finishSpeaking was checking !isListening which could already be true from recognition.onend auto-restart, preventing startListening() - Now force-stops stale recognition, resets isListening=false, then restarts with 200ms delay to avoid collision with onend handler - Added debug logging for listener restart flow
1 parent cd4dafe commit e09d340

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

interview/proctored-room.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,11 +3205,17 @@ <h1><span class="brand-simp">Simpatico</span><span class="brand-hr">HR</span></h
32053205
try { if (state.voice.recognition) state.voice.recognition.stop(); } catch (e) { }
32063206
} else {
32073207
setTimeout(() => {
3208-
if (!state.voice.isProcessing && !state.voice.isListening) {
3208+
if (!state.voice.isProcessing) {
3209+
// Force-stop any stale recognition before restarting
3210+
try { if (state.voice.recognition) state.voice.recognition.stop(); } catch (e) { }
3211+
state.voice.isListening = false;
32093212
state.voice.finalTranscript = '';
32103213
state.voice.currentTranscript = '';
32113214
state.voice.lastSpeechTime = 0;
3212-
startListening();
3215+
console.log('[TTS] finishSpeaking → restarting listener (isProcessing=' + state.voice.isProcessing + ')');
3216+
setTimeout(() => startListening(), 200);
3217+
} else {
3218+
console.log('[TTS] finishSpeaking → skipped listener restart (isProcessing=true)');
32133219
}
32143220
}, 800);
32153221
}

0 commit comments

Comments
 (0)