简体   繁体   English

使用语音识别API

[英]Working with speech recognition API's

I was trying to use Annyang for speech recognition but this doesn't work on Chrome (Google Chrome 65.0.3325.162 (Official Build) (64-bit)). 我试图使用Annyang进行语音识别,但这在Chrome(Google Chrome 65.0.3325.162(正式版本)(64位))上不起作用。 The microphone doesn't give permission for this web page. 麦克风未授予对此网页的许可。 I tried to modify settings to allow all websites to use microphone but there was no such option. 我试图修改设置以允许所有网站都使用麦克风,但是没有这样的选项。 I have never made websites in the past. 我过去从未做过网站。 I would be glad if someone could suggest me an alternative way of using speech recognition. 如果有人可以建议我使用语音识别的另一种方法,我将感到非常高兴。 I just need the text uttered, no additional features are required as such. 我只需要说出文字,就不需要其他功能。 I wish to keep things as simple as possible. 我希望使事情尽可能简单。 Thank you! 谢谢!

 <!DOCTYPE html> <html> <body> This text doesn't matter </body> <script src="https://cdnjs.cloudflare.com/ajax/libs/annyang/2.6.0/annyang.min.js"></script> <script> window.onload=function(){ if (annyang) { // Let's define a command. console.log("It detected annyang"); var commands = { 'hello': function() { alert('Hello world!'); } }; // Add our commands to annyang annyang.addCommands(commands); // Start listening. annyang.start(); } } </script> </html> 

In order to run google speech to text API, you need to publish your website. 为了运行谷歌语音文本API,您需要发布您的网站。 Because you can't give permission to microphone by just opening the HTML web page. 因为您不能仅通过打开HTML网页来授予麦克风权限。

Since you mentioned this is your first website, I'm guessing you are just opening the html file through the browser. 由于您提到这是您的第一个网站,所以我猜您只是通过浏览器打开html文件。 That is why you can't allow the microphone to access to the web page. 这就是为什么您不允许麦克风访问网页的原因。

First publish the web page in IIS or any other way. 首先以IIS或任何其他方式发布网页。 Then you will be able to give permission to the microphone. 然后,您将可以授予麦克风权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM