简体   繁体   中英

How to read voice input in a chrome extension popup?

So I need to use the webkitSpeechRecognition() api to read voice input from the user and then fill a text area with whatever value is returned for webSpeechRecognition . Now the problem is when I do that from a popup page in chrome extension, it does not asks for microphone access. How can I solve it ? I have read this answer https://stackoverflow.com/a/29183128/5143144 but I am unable to make anything of it. Another issue is, even if I am able to get microphone access, is it possible to use it to do webkitSpeechRecognition in the popup of the chrome extension. Please help. Thanks.

I solved this after searching a lot and getting a reference from one of the stack overflow answers and chrome forums. Just leaving this here in case you find it useful.

So all you have to do is ask for the permissions on a different page which has the extension url . Once a user allows permission to microphone there, your browser extension will be able to access microphone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM