Midhun Kumar
Midhun Kumar

Reputation: 577

How to differentiate between when TTS is stopped and TTS is done playing?

When TTS is done playing onDone(String utteranceId) is called from where I intend to call for the next sentence to play. But when I call tts.stop() again onDone(String utteranceId) gets called. So how will i be able to differentiate between the two so that i shouldn't call for the next sentence when the user stops TTS?

Upvotes: 0

Views: 298

Answers (1)

brandall
brandall

Reputation: 6144

tts.stop() as you say, is called by you - or rather, from your code. When you do this, set a Boolean value of iStoppedManually to true.

When the progress listener calls onDone() check the value of iStoppedManually. If it is true, you'll know you did it, otherwise, continue as normal.

Don't forget to reset iStoppedManually every time you find it is set to true in onDone()

Upvotes: 1

Related Questions