webkitSpeechRecognition throws error "network"
Asked Answered
C

2

4

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?

Constitutive answered 3/10, 2016 at 15:23 Comment(0)
C
5

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

Constitutive answered 6/10, 2016 at 12:17 Comment(3)
don't know why this got downvoted - worked perfectly!Downtoearth
Hi, seems like this is not required anymore, but I couldn't make it work anyway for Electron. Any news on this subject?Coletta
The link return 404Trotman
Y
2

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.

Yaw answered 4/10, 2016 at 5:22 Comment(2)
It was working all well last week! I see the webkitSpeechRecognition do not make any web request (as far as I see from network tab on chromium console). Why do I need API key? If needed where do I configure it for webkitSpeechRecognition? Quite confused! I never had to do that earlier.Constitutive
I was able to find the network from fiddler, I generate my own api KEY and client id/secret. Configured them on the environment variables..being used now but it still don't workConstitutive

© 2022 - 2024 — McMap. All rights reserved.