Voice commands are not taken by the browser


#1

Hi! every one, I was working on this project for so long, my problem is for the very first time when I changed a bit of my script, my browser asked to confirm using microphone or not, but it didn't add the commands that I sent though. After that when I refresh my browser it's not even asking me to use microphone to send commands, how will I able to send these commands without knowing whether the microphone is on or not? Please help me out, If any of you find any errors in my code logic. (I have attached my script below)

Thanks in advance!

var template = function(text) {
  return '<p><input type="checkbox"><i class="glyphicon glyphicon-star"></i><span>' + text + '</span><i class="glyphicon glyphicon-remove"></i></p>';
};


var main = function() {
  $('form').submit(function() {
      var text = $('#todo').val();
    var html = template(text);
    $('.list').append(html);
    $('#todo').val('');
    return false;  
  });
$('.list').on('click','.glyphicon-star', function(){
  $(this).toggleClass('active');
});  
$('.list').on('click','.glyphicon-remove', function(){
  $(this).parent().remove();
});
        var commands = {
	  'add *listItem': addListItem() 
	};
  
  var addListItem = function(){
    var html = template(listItem);
    $('.list').append(html);
  };
  
	annyang.addCommands(addListItem);
  
 if(confirm("Enable Microphone for voice commands?")){
      annyang.start();
 }
 
  
  
   
};

$(document).ready(main);`Preformatted text`


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.