🎧 fix(TTS): Improve State of audio playback, hook patterns, and fix undefined MediaSource (#3632)

This commit is contained in:
Danny Avila 2024-08-13 12:08:55 -04:00 committed by GitHub
parent e3ebcfd2b1
commit dc8d30ad90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 108 additions and 72 deletions

View file

@ -7,9 +7,12 @@ interface VoiceOption {
label: string;
}
function useTextToSpeechBrowser() {
function useTextToSpeechBrowser({
setIsSpeaking,
}: {
setIsSpeaking: (isSpeaking: boolean) => void;
}) {
const [cloudBrowserVoices] = useRecoilState(store.cloudBrowserVoices);
const [isSpeaking, setIsSpeaking] = useState(false);
const [voiceName] = useRecoilState(store.voice);
const [voices, setVoices] = useState<VoiceOption[]>([]);
@ -61,7 +64,7 @@ function useTextToSpeechBrowser() {
setIsSpeaking(false);
};
return { generateSpeechLocal, cancelSpeechLocal, isSpeaking, voices };
return { generateSpeechLocal, cancelSpeechLocal, voices };
}
export default useTextToSpeechBrowser;