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.
https://github.com/TalAter/annyang/issues/53
Please read through the whole issue. You might need to setup HTTPS for it.
Even I faced the same situation, I got it resolved. There are 2 solutions to fix the issue.
Recheck, in your annyang.js file
abort: function () {
autoRestart = false;
if (isInitialized) {
recognition.abort();
}
}
Which, need to remove stop the activities of microphone from all the inactive tabs, and need to activate only for current tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With