javascript - Annyang语音识别问题

标签 javascript google-chrome speech-recognition mamp

我目前正在尝试创建自己的 J.A.R.V.I.S 系统作为网络应用程序。所以当然,就像任何好的 J.A.R.V.I.S 系统一样,它需要良好的语音识别。我进行了研究,试图找到一个我可以根据需要自定义的 JavaScript 语音识别 API,并决定使用 Annyang。 (很简单,效果很好)

我花了一些时间试用它,就在我认为它可以正常工作时,我遇到了一个问题。当我尝试在本地查看该文件时它不起作用,所以我将它与 MAMP 一起托管在我的计算机上以查看它是否有效。它出现了一个对话框,上面写着“本地主机想要访问麦克风”,但是当我点击允许时,它又出现了。它不断出现并且不会消失,直到我单击拒绝。我正在使用以下代码:

<!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>

这是他们在 their website 上提供的演示代码.

如果有人能帮我弄清楚为什么在我单击“允许”时它反复要求使用我的麦克风,那么提前谢谢!

干杯, Fjpackard.

最佳答案

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

请通读整期。您可能需要为其设置 HTTPS。

关于javascript - Annyang语音识别问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20742768/

相关文章:

php - 结束在我的网站上显示 PHP 标签

css - 悬停效果适用于 Firefox,但不适用于其他浏览器

macos - Swift:无法在 NSSpeechRecognizer 中设置命令

ios - 架构 i386 的 undefined symbol : "SpeechKitApplicationKey"

javascript - 在溢出时捕获滚动事件 :hidden element

javascript - JSLint 错误 "Unexpected Var"

javascript - 更改 chrome 应用程序窗口位置,但不是来自 main.js

c# - Windows7 上语音识别 C# WPF 应用程序的两个问题

javascript - "onload=foo(event)"是什么意思?

javascript - jquery 通过 id 选择当前正在播放的音频