mirror of
https://github.com/dergigi/boris.git
synced 2026-01-10 02:14:56 +01:00
fix(tts): apply speed changes immediately during playback
This commit is contained in:
@@ -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])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user