diff --git a/contexts/VoiceContext.tsx b/contexts/VoiceContext.tsx index f8bc4d4..b1a77bc 100644 --- a/contexts/VoiceContext.tsx +++ b/contexts/VoiceContext.tsx @@ -386,7 +386,11 @@ export function VoiceProvider({ children }: { children: ReactNode }) { }, onDone: () => { console.log('[VoiceContext] TTS completed'); - setIsSpeaking(false); + // Delay turning off green indicator to match STT restart delay (300ms) + // This keeps the visual indicator on during the transition period + setTimeout(() => { + setIsSpeaking(false); + }, 300); // Return to listening state after speaking (if session wasn't stopped) if (!sessionStoppedRef.current) { setStatus('listening'); @@ -395,6 +399,7 @@ export function VoiceProvider({ children }: { children: ReactNode }) { }, onError: (error) => { console.warn('[VoiceContext] TTS error:', error); + // On error, turn off indicator immediately (no delay) setIsSpeaking(false); if (!sessionStoppedRef.current) { setStatus('listening'); @@ -403,6 +408,7 @@ export function VoiceProvider({ children }: { children: ReactNode }) { }, onStopped: () => { console.log('[VoiceContext] TTS stopped (interrupted)'); + // When interrupted by user, turn off indicator immediately setIsSpeaking(false); // Don't set status to listening if session was stopped by user if (!sessionStoppedRef.current) {