Using Media Player, one can determine when the mediaplayer.isplaying and thus determine when the media has completed playing. I am trying to use the Text to speech, but would like to know when the TTS completes saying the text. Is there an event or method to determine when a TTS is playing or has completed playing (or saying) the text?
Thanks in advance.
Sub Process_Globals
Dim TTSFinish as Boolean
TTSFinish = False
End Sub
Sub PE_TextToSpeechFinish (Intent As Intent)
Log("TextToSpeechFinish")
If IsPaused(Main) = False Then ' call a function in the Main activity
CallSub(Main, "SpeechIsFinish")
End If
End Sub
in the main (name Main )
B4X:
Sub SpeechIsFinish
' Do something when PE_TextToSpeechFinish is called
End Sub
+++++++++++++++++++++++++++++++++++
Another solution
in the module
B4X:
Sub PE_TextToSpeechFinish (Intent As Intent)
Log("TextToSpeechFinish")
TTSFinish = True
End Sub
Thanks.
I also experimented with moving the TextToSpeechFinish into a sub in the main. There, when the speech is finished, the event raises there. Seems to work well. I appreciate your help. Merci mille fois!