Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webkitSpeechRecognition throws error "network"

I have an speech recognition (using webkitSpeechRecognition) application which works great when ran on the standalone chrome browser.

I converted my application into a electron package and it stops listening to the microphone and sends back an error with message "network". The documentation says "Network communication required for completing the recognition failed.". However it works good in chrome directly without any issues.

I have also used "SpeechSynthesisUtterance" for text to speech and that works without any issue on electron.

I had the solution working good couple of weeks ago during generating Proof Of Concept and it stopped working as well.

Anybody has any idea what could be the wrong?

like image 431
Paresh Varde Avatar asked Oct 21 '25 21:10

Paresh Varde


2 Answers

I got it working with my own Google Speech API key.

Please obtain as per the instruction given on https://docs.smart-mirror.io/docs/howto/how_to_obtain_chromium_speech_keys.html

Once you have API Key, ClientID and ClientSecret set them into your computer's environment variables with key GOOGLE_API_KEY, GOOGLE_DEFAULT_CLIENT_ID, GOOGLE_DEFAULT_CLIENT_SECRET respectively.

Make sure to restart your system after configuring the environment variables. Sometimes they don't get into affect immediately.

enter image description here

like image 158
Paresh Varde Avatar answered Oct 24 '25 14:10

Paresh Varde


From https://www.chromium.org/developers/how-tos/api-keys

It is NOT possible to get additional quota for Chrome's Speech API. Look at the Cloud Speech API instead.

Do NOT post to any Chromium groups/mailing lists for questions about the Speech API.

And

Many of the Google APIs used by Chromium code are specific to Google Chrome and not intended for use in derived products. In the API Console (http://developers.google.com/console) you may be able to purchase additional quota for some of the APIs listed above. For APIs that do not have a "Pricing" link, additional quota is not available for purchase.

So I think you're simply out of luck, you'll have to use something else. If you need something that works offline you might want to take a look at Sphinx.

like image 41
Vadim Macagon Avatar answered Oct 24 '25 15:10

Vadim Macagon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!