-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial Pass at TTS * Rename and fix index * Remove unnecessary window in reference closes #311
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {Plugin, Cordova} from './plugin'; | ||
|
||
export interface TTSOptions { | ||
/** text to speak */ | ||
text: string; | ||
/** a string like 'en-US', 'zh-CN', etc */ | ||
locale?: string; | ||
/** speed rate, 0 ~ 1 */ | ||
rate?: number; | ||
} | ||
|
||
/** | ||
* @name TTS | ||
* @description | ||
* Text to Speech plugin | ||
* | ||
* @usage | ||
* ``` | ||
* import {TTS} from 'ionic-native'; | ||
* | ||
* TTS.speak('Hello World') | ||
* .then(() => console.log('Success')) | ||
* .catch((reason: any) => console.log(reason)); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
plugin: 'cordova-plugin-tts', | ||
pluginRef: 'TTS', | ||
repo: 'https://github.com/vilic/cordova-plugin-tts' | ||
}) | ||
export class TextToSpeech { | ||
|
||
/** | ||
* This function speaks | ||
* @param options {string | TTSOptions} Text to speak or TTSOptions | ||
* @return {Promise<any>} Returns a promise that resolves when the speaking finishes | ||
*/ | ||
@Cordova({ | ||
successIndex: 1, | ||
errorIndex: 2 | ||
}) | ||
static speak(options: string | TTSOptions): Promise<any> { | ||
return; | ||
} | ||
|
||
} |