Passer au contenu

@capgo/capacitor-speech-synthesis

Speech Synthesis Plugin for synthesizing speech from text.

Speech Synthesis Plugin for synthesizing speech from text.

  • speak - Speaks the given text with specified options. The utterance is added to the speech queue.
  • synthesizeToFile - Synthesizes speech to an audio file (Android/iOS only). Returns the file path where the audio was saved.
  • cancel - Cancels all queued utterances and stops current speech.
  • pause - Pauses speech immediately.
MethodDescription
speakSpeaks the given text with specified options. The utterance is added to the speech queue.
synthesizeToFileSynthesizes speech to an audio file (Android/iOS only). Returns the file path where the audio was saved.
cancelCancels all queued utterances and stops current speech.
pausePauses speech immediately.
resumeResumes paused speech.
isSpeakingChecks if speech synthesis is currently speaking.
isAvailableChecks if speech synthesis is available on the device.
getVoicesGets all available voices.
getLanguagesGets all available languages.
isLanguageAvailableChecks if a specific language is available.
isVoiceAvailableChecks if a specific voice is available.
initializeInitializes the speech synthesis engine (iOS optimization). This can reduce latency for the first speech request.
activateAudioSessionActivates the audio session with a specific category (iOS only).
deactivateAudioSessionDeactivates the audio session (iOS only).
getPluginVersionGets the native plugin version.
addListenerListens for when an utterance starts speaking.
addListenerListens for when an utterance finishes speaking.
addListenerListens for word boundaries during speech.
addListenerListens for synthesis errors.
removeAllListenersRemoves all event listeners.

This reference is synced from src/definitions.ts in capacitor-speech-synthesis.