From b36f294f88bd184d01049eb9765ec2e25a49a269 Mon Sep 17 00:00:00 2001 From: Markus Karileet Date: Tue, 30 Oct 2018 20:31:31 +0200 Subject: [PATCH] fix startTTS not working on IOS, closes #3 --- package.json | 2 +- plugin.xml | 2 +- src/ios/CDVSpeechKit.m | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1c3b538..de96002 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-nuance-speechkit", - "version": "2.0.0", + "version": "2.0.1", "description": "Cordova Nuance SpeechKit Plugin", "cordova": { "id": "cordova-plugin-nuance-speechkit", diff --git a/plugin.xml b/plugin.xml index 510de1e..67bd24b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -22,7 +22,7 @@ xmlns:rim="http://www.blackberry.com/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-nuance-speechkit" - version="2.0.0"> + version="2.0.1"> Nuance SpeechKit Cordova Nuance SpeechKit Plugin Apache 2.0 diff --git a/src/ios/CDVSpeechKit.m b/src/ios/CDVSpeechKit.m index 23a9268..3737bba 100644 --- a/src/ios/CDVSpeechKit.m +++ b/src/ios/CDVSpeechKit.m @@ -29,10 +29,16 @@ - (void) pluginInitialize { - (void) startTTS:(CDVInvokedUrlCommand*)command{ NSLog(@"CDVSpeechKit.startTTS: Entered method."); - SKTransaction* transaction = [session speakString:[command.arguments objectAtIndex:0] - withLanguage:[command.arguments objectAtIndex:1] - withVoice:[command.arguments objectAtIndex:2] + // If the voice is nil, use language default voice. If the voice is set, ignore language and use voices default lang. + if ([command.arguments objectAtIndex:2] == nil) { + SKTransaction* transaction = [session speakString:[command.arguments objectAtIndex:0] + withLanguage:[command.arguments objectAtIndex:1] delegate:self]; + } else { + SKTransaction* transaction = [session speakString:[command.arguments objectAtIndex:0] + withVoice:[command.arguments objectAtIndex:2] + delegate:self]; + } NSLog(@"CDVSpeechKit.startTTS: Leaving method."); } @end