Error with my annyang program

∥☆過路亽.° 提交于 2019-12-08 08:26:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!