Is it possible to pause and resume reading “TextToSpeech” as if it were a player?
What you can do with TTS using App Inventor 2 is described in TextToSpeech
There isn’t a pause event or method, so you can not pause and resume.
Unfortunately, the way the Android TTS interface is designed makes it next to impossible to implement a pause/resume feature, at least not without a lot of extra bookkeeping. The two main APIs it provides are a speak() call and a stop() call. The first enqueues a string to be spoken and the latter stops speaking and removes any remaining, unspoken utterances. Now, there is a mechanism by which one can get updates of what parts of the string are being spoken, such as to make a text highlighting utility, and so one might be able to use that to track progress. The Pause operation then would have to save the current point of speech in the original text and the Resume operation would need to construct a new string to be spoke that is just the remaining text. If the interval between pause/resume is quite short then I imagine there will also be an appearance of “jittering” because if you stop in the middle of a word you’d need to probably resume with the word or the following word, so it’s not as fluid as pausing an audio recording.
A post was split to a new topic: Is it possible to generate a file larger than 10Mb?