mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 16:52:53 +08:00
feat(plugin): add SpeechKit plugin
feat(plugin): add SpeechKit plugin
This commit is contained in:
commit
1113bbad57
53
src/@ionic-native/plugins/speechkit/index.ts
Normal file
53
src/@ionic-native/plugins/speechkit/index.ts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name SpeechKit
|
||||||
|
* @description
|
||||||
|
* Implementation of Nuance SpeechKit SDK on Ionic
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { SpeechKit } from '@ionic-native/speechkit';
|
||||||
|
*
|
||||||
|
* constructor(private speechkit: SpeechKit) { }
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* this.speechkit.tts('Text to be read out loud', 'ENG-GBR').then(
|
||||||
|
* (msg) => { console.log(msg); },
|
||||||
|
* (err) => { console.log(err); }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
pluginName: 'SpeechKit',
|
||||||
|
plugin: 'cordova-plugin-nuance-speechkit',
|
||||||
|
pluginRef: 'plugins.speechkit',
|
||||||
|
repo: 'https://github.com/Shmarkus/cordova-plugin-nuance-speechkit',
|
||||||
|
platforms: ['Android', 'iOS']
|
||||||
|
})
|
||||||
|
@Injectable()
|
||||||
|
export class SpeechKit extends IonicNativePlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speak text out loud in given language
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
tts(
|
||||||
|
text: string,
|
||||||
|
language: string
|
||||||
|
): Promise<string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to recognize what the user said
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
platforms: ['Android']
|
||||||
|
})
|
||||||
|
asr(
|
||||||
|
language: string
|
||||||
|
): Promise<string> { return; }
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user