JamesBrill / react-speech-recognition

💬Speech recognition for your React app
https://webspeechrecognition.com/
MIT License
682 stars 121 forks source link

Microphone availability detection #118

Closed JamesBrill closed 3 years ago

JamesBrill commented 3 years ago

When react-speech-recognition first starts to listen, the browser will usually ask the user whether they give permission for the microphone to be used. If they deny access, react-speech-recognition did not previously handle this well:

This PR introduces a new state: isMicrophoneAvailable. If the user denies access to the microphone, the value of this will change to false. This applies in both of the following cases:

After this PR, consumers can use this library with greater confidence that their apps will continue to function even when the user denies microphone access, and have the ability to render fallback content in such a case.