webkitSpeechRecognition 抛出错误“网络" [英] webkitSpeechRecognition throws error "network"

查看:76
本文介绍了webkitSpeechRecognition 抛出错误“网络"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个语音识别(使用 webkitSpeechRecognition)应用程序,在独立的 chrome 浏览器上运行时效果很好.

我将我的应用程序转换为电子包,它停止收听麦克风并发送回一条错误消息网络".文档显示完成识别所需的网络通信失败.".但是它直接在 chrome 中运行良好,没有任何问题.

我还将SpeechSynthesisUtterance"用于文本到语音,并且在电子上没有任何问题.

几周前,在生成概念证明期间,我的解决方案运行良好,但它也停止了工作.

有人知道哪里出了问题吗?

解决方案

我得到了它使用我自己的 Google Speech API 密钥.

请按照

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?

解决方案

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.

这篇关于webkitSpeechRecognition 抛出错误“网络"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆