我正在尝试实现此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/(固定页脚),其中显示:
SpeechRecognition
需要使用诸如“ Google Chrome浏览器”之类的浏览器关于javascript - 我的annyang程序出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23871046/