useSpeechSynthesis
Reactive SpeechSynthesis.
Package: @vueuse/core
Category: Sensors
Usage
import { useSpeechSynthesis } from '@vueuse/core'
const {
isSupported,
isPlaying,
status,
voiceInfo,
utterance,
error,
stop,
toggle,
speak,
} = useSpeechSynthesis()Options
| Option | Type | Default | Description |
|---|---|---|---|
| lang | MaybeRefOrGetter<string> |
en-US | Language for SpeechSynthesis |
| pitch | MaybeRefOrGetter<SpeechSynthesisUtterance['pitch']> |
1 | Gets and sets the pitch at which the utterance will be spoken at. |
| rate | MaybeRefOrGetter<SpeechSynthesisUtterance['rate']> |
1 | Gets and sets the speed at which the utterance will be spoken at. |
| voice | MaybeRef<SpeechSynthesisVoice> |
- | Gets and sets the voice that will be used to speak the utterance. |
| volume | MaybeRefOrGetter<SpeechSynthesisUtterance['volume']> |
1 | Gets and sets the volume that the utterance will be spoken at. |
| onBoundary | (event: SpeechSynthesisEvent) => void |
- | Callback function that is called when the boundary event is triggered. |
Returns
| Name | Type |
|---|---|
| isSupported | useSupported |
| isPlaying | shallowRef |
| status | shallowRef<UseSpeechSynthesisStatus> |
| utterance | computed |
| error | shallowRef<SpeechSynthesisErrorEvent | undefined> |
| stop | Ref |
| toggle | Ref |
| speak | Ref |