Search code examples
javascripthtmlgoogle-chromespeech-recognitionannyang

annyang.trigger() unable to simulate speech


I am running Annyang 2.6.0. The trigger function is not working. Here is my code sample running on Chrome:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<script src = "//cdnjs.cloudflare.com/ajax/libs/annyang/2.6.0/annyang.min.js"></script>
<script>
if(annyang)
{
    var commands = {
        '*tag':function(tag){
            document.write(tag);
        }
    };

    annyang.addCommands(commands);
    annyang.start({continuous:false});
    annyang.trigger('Time for some thrilling heroics');
annyang.trigger(
    ['Time for some thrilling heroics', 'Time for some thrilling aerobics']
  );
}
</script>
</body>
</html>

Solution

  • You need to initiate debugging mode first as below:

    annyang.debug(true);