Text To Speech

Improve this doc

$ ionic plugin add cordova-plugin-tts
$ npm install --save @ionic-native/text-to-speech

Repo: https://github.com/vilic/cordova-plugin-tts

Text to Speech plugin

Usage

import { TextToSpeech } from '@ionic-native/text-to-speech';

constructor(private tts: TextToSpeech) { }

...

this.tts.speak('Hello World')
  .then(() => console.log('Success'))
  .catch((reason: any) => console.log(reason));

Instance Members

speak(options)

This function speaks

Param Type Details
options string|TTSOptions

Text to speak or TTSOptions

Returns: Promise<any> Returns a promise that resolves when the speaking finishes

stop()

Stop any current TTS playback

Returns: Promise<any>

TTSOptions

Param Type Details
text string

text to speak

locale string

a string like 'en-US', 'zh-CN', etc

(optional)
rate number

speed rate, 0 ~ 1

(optional)

API

Native

General