fix(tts): apply speed changes immediately during playback

This commit is contained in:
Gigi
2025-10-20 22:03:05 +02:00
parent c82fb65745
commit 81aa414d2e

View File

@@ -105,6 +105,12 @@ export function useTextToSpeech(options: UseTTSOptions = {}): UseTTS {
}
}, [supported, synth])
// Update rate in real-time if utterance is playing
useEffect(() => {
if (!supported || !utteranceRef.current || !synth!.speaking) return
utteranceRef.current.rate = rate
}, [rate, supported, synth])
// stop TTS when unmounting
useEffect(() => stop, [stop])