我正在尝试实现这个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>
问题在于我得到了错误警告&#34;消息,我没有弄清楚原因?
答案 0 :(得分:3)
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”等浏览器