From 41e5a0f7fe3d873c24269ee1bae55e3ff331e491 Mon Sep 17 00:00:00 2001 From: Markus Karileet Date: Thu, 22 Feb 2018 22:02:44 +0200 Subject: [PATCH] feat(speechkit): plugin implementation --- src/@ionic-native/plugins/speechkit/index.ts | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/@ionic-native/plugins/speechkit/index.ts diff --git a/src/@ionic-native/plugins/speechkit/index.ts b/src/@ionic-native/plugins/speechkit/index.ts new file mode 100644 index 000000000..ed49044c9 --- /dev/null +++ b/src/@ionic-native/plugins/speechkit/index.ts @@ -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} + */ + @Cordova() + tts( + text: string, + language: string + ): Promise { return; } + + /** + * Try to recognize what the user said + * @returns {Promise} + */ + @Cordova({ + platforms: ['Android'] + }) + asr( + language: string + ): Promise { return; } + +}