phetsims / utterance-queue

Alerting library powered by aria-live
MIT License
0 stars 2 forks source link

SpeechSynthesis breaks in Chromebooks when switching tabs #64

Closed jessegreenberg closed 2 years ago

jessegreenberg commented 2 years ago

Here is the initial issue where this was discovered: https://github.com/phetsims/number-play/issues/138

jessegreenberg commented 2 years ago

In #66 we added the ability to detect this failure case in ChromeOS.

If the amount of time between setting the pendingUtterance and the start event is greater than PENDING_UTTERANCE_DELAY we can assume there has been a failure of the engine and we cancel speech and remove listeners before the next attempt to speak.

Hopefully we can find a way to fix it when this happens. Potentially by trying to add it to the back of the queue again until we have a success?

jessegreenberg commented 2 years ago

Actually, the behavior seems quite a bit better now that we have a cancelSynth() when we detect the failure case. After this cancel, speech consistently resumes after a couple of seconds. So ~8 seconds after you return to the tab Voicing will start working again.

This seems acceptable to me and I don't think it is worth debugging further. We could try to add the failed Utterance back to the front of the queue but I am worried about an infinite loop of failed announcements and adding more complexity just for this ChromeOS case.

Lets see if the issue is largely resolved over in https://github.com/phetsims/number-play/issues/138 and then possibly just close.

jessegreenberg commented 2 years ago

phetsims/number-play#138 was verified as improved. That is all we will do on this issue for now. I updated the "Accessibility bugs" markdown file in QA to describe what we expect from ChromOS. Closing.