electronwebkitspeechrecognition

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?


Solution

  • 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