mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

OnUtteranceProgressListener in AndroidSpeechPlayer not supported by API 14

Open devotaaabel opened this issue 8 years ago • 4 comments

Looks like the previous listener only fired when utterance was completed. https://developer.android.com/reference/android/speech/tts/TextToSpeech.OnUtteranceCompletedListener

devotaaabel avatar Jun 08 '18 17:06 devotaaabel

For extra context:

As indicated in OP the UtteranceProgressListener used in AndroidSpeechPlayer#setInstructionListener is not supported by API 14.


What about using TextToSpeech.OnUtteranceCompletedListener (added in API level 4 Deprecated since API level 18) for API 14 and UtteranceProgressListener (added in API level 15) for API 15 and below. Isn't that possible? Am I missing something?

Guardiola31337 avatar Jun 11 '18 11:06 Guardiola31337

Adding the TextToSpeech source code for reference https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/speech/tts/TextToSpeech.java

Guardiola31337 avatar Jun 11 '18 11:06 Guardiola31337

Yea I think that should work but we will be losing onDone and onError so we'll have to find a work around for those

devotaaabel avatar Jun 11 '18 13:06 devotaaabel

Yeah, I've briefly seen TextToSpeech source code and some methods return ERROR and SUCCESS so I guess we could figure something out for those cases.

Guardiola31337 avatar Jun 11 '18 13:06 Guardiola31337