mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-26 21:05:36 +08:00
Merge branch 'master' of https://github.com/driftyco/ionic-native
This commit is contained in:
commit
bcd46eea9d
@ -80,6 +80,7 @@ import {StatusBar} from './plugins/statusbar';
|
|||||||
import {ThreeDeeTouch} from './plugins/3dtouch';
|
import {ThreeDeeTouch} from './plugins/3dtouch';
|
||||||
import {Toast} from './plugins/toast';
|
import {Toast} from './plugins/toast';
|
||||||
import {TouchID} from './plugins/touchid';
|
import {TouchID} from './plugins/touchid';
|
||||||
|
import {TextToSpeech} from './plugins/text-to-speech';
|
||||||
import {TwitterConnect} from './plugins/twitter-connect';
|
import {TwitterConnect} from './plugins/twitter-connect';
|
||||||
import {Vibration} from './plugins/vibration';
|
import {Vibration} from './plugins/vibration';
|
||||||
import {VideoPlayer} from './plugins/video-player';
|
import {VideoPlayer} from './plugins/video-player';
|
||||||
@ -166,6 +167,7 @@ export {
|
|||||||
StatusBar,
|
StatusBar,
|
||||||
TouchID,
|
TouchID,
|
||||||
Transfer,
|
Transfer,
|
||||||
|
TextToSpeech,
|
||||||
Vibration,
|
Vibration,
|
||||||
WebIntent,
|
WebIntent,
|
||||||
Zip
|
Zip
|
||||||
@ -250,6 +252,7 @@ window['IonicNative'] = {
|
|||||||
Toast: Toast,
|
Toast: Toast,
|
||||||
TouchID: TouchID,
|
TouchID: TouchID,
|
||||||
Transfer: Transfer,
|
Transfer: Transfer,
|
||||||
|
TextToSpeech: TextToSpeech,
|
||||||
TwitterConnect: TwitterConnect,
|
TwitterConnect: TwitterConnect,
|
||||||
VideoPlayer: VideoPlayer,
|
VideoPlayer: VideoPlayer,
|
||||||
Vibration: Vibration,
|
Vibration: Vibration,
|
||||||
|
47
src/plugins/text-to-speech.ts
Normal file
47
src/plugins/text-to-speech.ts
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user