ndarilek / tts-rs

115 stars 25 forks source link

On an Android emulator with no TTS, Tts::new() hangs forever #15

Closed AlyoshaVasilieva closed 2 years ago

AlyoshaVasilieva commented 2 years ago

The code tries to initialize the backend, enters this loop: https://github.com/ndarilek/tts-rs/blob/d24d1a6a152eb3945e1ec491de4d4c52756d17bc/src/backends/android.rs#L200-L209

and never exits it. I suspect this can happen on a real Android device* but maybe not, I don't do Android development.

*: The emulator with no TTS is one with no Play Store, while the emulator that works has the Play Store (and where I made sure Speech Services is updated).

ndarilek commented 2 years ago

Interesting, you should at least have PicoTTS in your emulator. Are there no voices listed?

I'll probably need you to submit a fix for this one since I'm blind, and can't use emulators without a working screen reader. But I'll try to make some headway next week, and at least try figuring out if I can abort that loop and return an error.

Thanks!

AlyoshaVasilieva commented 2 years ago

Text-to-speech isn't listed at all in the normal location (Settings, System, Languages & Input). I can find its options via the search Settings has, most of it is greyed out and "Preferred engine" has nothing available to choose. The only engine listed on the working emulator and my actual phone (a Xiaomi global model) is "Speech Services by Google". I looked around the Android repo and I think PicoTTS was removed from Android.

I don't know enough about Android to write a fix, but I can PR a workaround that just errors out if the loop has been running for too long. It takes about 35 milliseconds to initialize on my emulator, so I think allowing 500 before erroring will be safe without too long of a hang.

ndarilek commented 2 years ago

I believe this is now fixed, correct?

AlyoshaVasilieva commented 2 years ago

I apparently forgot to tag my PR as fixing this issue; as far as I know it's fixed, so I'll close this.