Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
How to pause Text-to-Speech?
-
I am using speech module to say some text. I'd like to stop playing it, then continue from the same place in the text. Whenever I press the play button on my headphones, tts stops, but some other ios app (either music, podcast app etc.) starts playing its own music.
Any ideas how to deal with it?
Thanks! -
There is not an easy way to capture headphone button events that I can think of, though maybe with Objc. However ole had to remove the entitlement to sct like a music player, not sure if that affects headphone buttons too.. You could just use a ui.Button, thst calls speech.stop(). If you need to be able to pause and keep playing, you might need to say one sentance at a time, since there is not a way to tell where you stopped... though you will also have to have a tight loop looking for is_speaking, since there is no way to register a completion handler for each say.