安阳语言识别问题

dea*_*ixl 5 javascript speech-recognition mamp google-chrome

我目前正在尝试将自己的JARVIS系统创建为Web应用程序.当然,像任何好的JARVIS系统一样,它需要良好的语音识别.我已经做过研究,试图找到一个我可以自定义的JavaScript语音识别API,并决定使用Annyang.(这很简单,效果很好)

我花了一些时间玩它,就在我以为我有它工作的时候,我遇到了一个问题.当我尝试在本地查看文件时,它无法正常工作,因此我将其托管在我的计算机上与MAMP一起查看它是否有效.它提出了"localhost想要访问麦克风"的对话框,但是当我点击允许时,它又重新出现了.它一直在重新出现,直到我点击拒绝才会消失.我使用以下代码:

<!DOCTYPE html>

<script src="http://cdnjs.cloudflare.com/ajax/libs/annyang/1.0.0/annyang.min.js"></script>
<script>
if (annyang) {
// Let's define our first command. First the text we expect, and then the function it     should call
var commands = {
'show tps report': function() {
  alert("hello");
}
};

// Initialize annyang with our commands
annyang.init(commands);

// Start listening. You can call this here, or attach this call to an event, button, etc.
annyang.start();
}
</script>
Run Code Online (Sandbox Code Playgroud)

这是他们在网站上提供的演示代码.

如果有人能帮助我弄清楚为什么当我点击允许时它反复要求使用我的麦克风,那么先谢谢你!

干杯,Fjpackard.

leo*_*rex 6

https://github.com/TalAter/annyang/issues/53

请仔细阅读整个问题.您可能需要为其设置HTTPS.