gpt4 book ai didi

javascript - 我的 annyang 程序出错

转载 作者:行者123 更新时间:2023-11-30 12:42:39 26 4
gpt4 key购买 nike

我正在尝试实现这个 annyang 程序:

<script src="//cdnjs.cloudflare.com/ajax/libs/annyang/1.1.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() {
$('#tpsreport').animate({bottom: '-100px'});
}
};

// Add our commands to annyang
annyang.addCommands(commands);

// Start listening. You can call this here, or attach this call to an event, button, etc.
annyang.start();
}

else{
alert("Error alert");
}
</script>

问题是我收到“错误警报”消息,但我没有找出原因?

最佳答案

SpeechRecognition 在 Firefox(桌面版本 29)中不起作用,请参阅:

(function () {
var b = this;
console.log(b.SpeechRecognition); // undefined
console.log(b.webkitSpeechRecognition); // undefined
console.log(b.mozSpeechRecognition); // undefined
console.log(b.msSpeechRecognition); // undefined
console.log(b.oSpeechRecognition); // undefined
}).call(this);

参见https://www.talater.com/annyang/ (固定页脚),显示:

fixed footer

SpeechRecognition 需要像“Google Chrome”这样的浏览器

关于javascript - 我的 annyang 程序出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23871046/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com