UNPKG

871 BTypeScriptView Raw
1export interface TTSOptions {
2 /** text to speak */
3 text: string;
4 /** a string like 'en-US', 'zh-CN', etc */
5 locale?: string;
6 /** speed rate, 0 ~ 1 */
7 rate?: number;
8}
9/**
10 * @name TextToSpeech
11 * @description
12 * Text to Speech plugin
13 *
14 * @usage
15 * ```
16 * import {TextToSpeech} from 'ionic-native';
17 *
18 * TextToSpeech.speak('Hello World')
19 * .then(() => console.log('Success'))
20 * .catch((reason: any) => console.log(reason));
21 *
22 * ```
23 * @interfaces
24 * TTSOptions
25 */
26export declare class TextToSpeech {
27 /**
28 * This function speaks
29 * @param options {string | TTSOptions} Text to speak or TTSOptions
30 * @return {Promise<any>} Returns a promise that resolves when the speaking finishes
31 */
32 static speak(options: string | TTSOptions): Promise<any>;
33 static stop(): Promise<any>;
34}