WIP Close mic on stop
What
This PR applies the patch suggested here, which should close the mic when the polyfill is inactive.
TODO:
- Validate solution
- Update tests
- Update docs if necessary.
Why
Intended to resolve issue https://github.com/speechly/speech-recognition-polyfill/issues/30 where microphone indicator is still turned on even when polyfill is turned off, which can affect user trust in a web app.
@arzga I've tested this locally and adding the logic to attach/detach the microphone seems to do the job. Looking good so far.
You mentioned that on iOS 12 this approach suffers from considerable lag. I don't have an iPhone so can't easily test this, so could you give me an idea of how severe this is? a. Is the issue present on later versions of iOS? b. Is the lag only in the appearance of the microphone icon, or does it actually affect the user experience?
Sorry for a late posting to a closed PR, but here's what I know about iOS 12 lag:
a. Is the issue present on later versions of iOS?
iOS 12 is rather old (released Sep 2018), although as we know not all devices can be upgraded beyond this. iOS 14 (released June 2020) worked ok. I tested on iOS 14.3 / iPad Air 4 / Safari.
b. Is the lag only in the appearance of the microphone icon, or does it actually affect the user experience?
Closing/reopening mic on iOS 12 produces pretty bad UX, the restart delay is in seconds magnitude.