From 463ac8f44cb11e590720b62070874fcd0a56daa3 Mon Sep 17 00:00:00 2001 From: Gigi Date: Mon, 20 Oct 2025 22:10:18 +0200 Subject: [PATCH] fix(tts): apply rate changes whether utterance is speaking or paused --- src/hooks/useTextToSpeech.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hooks/useTextToSpeech.ts b/src/hooks/useTextToSpeech.ts index 00d6623f..b4256b81 100644 --- a/src/hooks/useTextToSpeech.ts +++ b/src/hooks/useTextToSpeech.ts @@ -116,11 +116,12 @@ export function useTextToSpeech(options: UseTTSOptions = {}): UseTTS { } }, [supported, synth]) - // Update rate in real-time if utterance is playing + // Update rate in real-time if utterance is playing or paused useEffect(() => { - if (!supported || !utteranceRef.current || !synth!.speaking) return + if (!supported || !utteranceRef.current) return + // Update rate whether speaking or paused utteranceRef.current.rate = rate - }, [rate, supported, synth]) + }, [rate, supported]) // stop TTS when unmounting useEffect(() => stop, [stop])