Closed alissonbezerra closed 6 years ago
I guess I've found the answer by myself, seems like it is related to this: https://stackoverflow.com/questions/20296792/tts-utteranceprogresslistener-not-being-called
I had to change the speakText method in texttospeech.android.ts to this:
if (android.os.Build.VERSION.SDK_INT >= 21) {
// Hardcoded this value since the static field LOLLIPOP doesn't exist in Android 4.4
/// >= Android API 21 - https://developer.android.com/reference/android/speech/tts/TextToSpeech.html#speak(java.lang.CharSequence, int, android.os.Bundle, java.lang.String)
let params = new android.os.Bundle();
params.putString("volume", options.volume.toString());
this._tts.speak(options.text, queueMode, params, "UniqueID");
} else {
/// < Android API 21 - https://developer.android.com/reference/android/speech/tts/TextToSpeech.html#speak(java.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>)
let hashMap = new java.util.HashMap();
hashMap.put("volume", options.volume.toString());
hashMap.put(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "UniqueID");
this._tts.speak(options.text, queueMode, hashMap);
}
Note that this line
hashMap.put(android.speech.tts.TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "UniqueID");
was added to the code.
I tested on android 4.2.2.
Hi, what could cause finishedCallback not being called?
Here's my code. Note: OnClickButton is a function being called by a button click.
The app speaks my text but finishedCallback is not being called and the alert isn't being shown.