Issues with Annyang speech recognition

Viewed 6883

I am currently trying to create my own J.A.R.V.I.S system as a web app. So of course, like any good J.A.R.V.I.S system, it needs good speech recognition. I have done research trying to find a JavaScript speech recognition API that I can customize as much as I like, and have decided to use Annyang. (It's simple, and works well)

I spent some time playing around with it, and just when I thought I had got it working, I ran into a problem. It wasn't working when I tried to view the file locally, so I hosted it on my computer with MAMP to see if it worked. It came up with the dialog saying "localhost would like to access the microphone", but when I clicked allow, it reappeared. It kept reappearing and wouldn't go away until I clicked deny. I was using the following code:

<!DOCTYPE html>

<script src="http://cdnjs.cloudflare.com/ajax/libs/annyang/1.0.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() {
  alert("hello");
}
};

// Initialize annyang with our commands
annyang.init(commands);

// Start listening. You can call this here, or attach this call to an event, button, etc.
annyang.start();
}
</script>

Which is the demo code they supplied on their website.

If anyone can help me figure out why it is repeatedly asking to use my microphone when I click allow, then thank you in advance!

Cheers, Fjpackard.

3 Answers
Related