问题
I am trying to implements this annyang program:
<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>
The problem is that I got "Error alert" message, and I didn't figure out the reason?
回答1:
SpeechRecognition not work in Firefox (Desktop version 29), see:
(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);
See in https://www.talater.com/annyang/ (Fixed footer), shows:
SpeechRecognition requires browsers like "Google Chrome"
来源:https://stackoverflow.com/questions/23871046/error-with-my-annyang-program