Skip to content

Web Speech API (Native)

The built-in browser provider wraps the Web Speech API. No API key, no network requests, works offline.

Setup

ts
import { createApp } from 'vue'
import { VueSpeech } from 'vue-text-to-speech'

createApp(App)
  .use(VueSpeech, { provider: 'web' })
  .mount('#app')

Configuration

ts
interface WebSpeechConfig {
  provider: 'web'
  /** Default BCP-47 language for STT, e.g. 'en-US' */
  lang?: string
}
OptionTypeDefaultDescription
provider'web'Required discriminant
langstringBrowser UI langDefault BCP-47 language for useSpeechRecognition

Voices

Voices are loaded from the browser's speechSynthesis.getVoices(). Chrome has a known race condition — the library handles this by listening for the voiceschanged event with a 3-second timeout fallback.

ts
const { voices, isLoadingVoices } = useSpeechSynthesis()
// voices.value is populated after the voiceschanged event fires

Limitations

LimitationNotes
Voice qualityOS-bundled voices vary significantly across platforms
STT supportFirefox does not support SpeechRecognition
Concurrent utterancesOnly one utterance at a time across the entire page
pause() / resume()Supported; AI providers are no-ops

SSR

The provider is fully SSR-safe — all browser API access is guarded by typeof window !== 'undefined'.

Released under the MIT License.