Extend speaking indicator duration to cover STT restart delay
User feedback: green speaker indicator was turning off too early, creating an awkward visual gap during the 300ms audio focus delay. Changes: - Added 300ms delay to setIsSpeaking(false) in TTS onDone callback - Keeps green "Speaking" indicator on until STT actually starts recording - onError and onStopped still turn off immediately (user interruption) - Smooth visual transition: TTS ends → 300ms delay → STT starts UX improvement: eliminates the brief "nothing is happening" moment between Julia finishing speech and microphone starting to listen. contexts/VoiceContext.tsx:393
This commit is contained in:
parent
e695b08561
commit
9422c32926
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user