webkitSpeechRecognition抛出错误"network"(网络). [英] webkitSpeechRecognition throws error "network"

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

问题描述

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

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

我将我的应用程序转换为电子程序包,它停止监听麦克风,并通过消息网络"发送回错误.该文档说完成识别所需的网络通信失败.".但是,它可以直接在chrome中正常运行,而不会出现任何问题.

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.

我还使用了"SpeechSynthesisUtterance"来实现文本到语音的转换,并且在电子上也没有任何问题.

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?

推荐答案

我将其与自己的Google Speech API密钥配合使用.

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

请按照 https://docs.smart- mirror.io/docs/howto/how_to_obtain_chromium_speech_keys.html

具有API密钥,ClientID和ClientSecret后,分别使用密钥GOOGLE_API_KEY,GOOGLE_DEFAULT_CLIENT_ID,GOOGLE_DEFAULT_CLIENT_SECRET将其设置为计算机的环境变量.

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抛出错误"network"(网络).的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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