JamesBrill / react-speech-recognition

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

How can I disable autoclose? #122

Closed fsuaterdogan closed 2 years ago

fsuaterdogan commented 2 years ago

Hi, thanks for the lib. My question is,

Its automaticly closing when I stop talking. How can I disable this? I want to just close on button clicks. Thanks

lnfernandobr commented 2 years ago

Did you see this?

https://github.com/JamesBrill/react-speech-recognition/blob/master/docs/API.md#functions

SpeechRecognition.startListening({ continuous: true })

I think this solves your problem

JamesBrill commented 2 years ago

Hi @fsuaterdogan

@lnfernandobr is correct - you just need to pass the continuous: true option to startListening and the microphone will remain on until you explicitly call stopListening or abortListening.