TalAter / annyang

:speech_balloon: Speech recognition for your site
https://www.talater.com/annyang/
MIT License
6.57k stars 1.05k forks source link

Annyang keeps starting and stopping #439

Open Baudin999 opened 2 years ago

Baudin999 commented 2 years ago

Annyang does not seem to work on in my browser (see details below). The Annyang main page (demo app) does not work and I think it's the same reason as the reason why my own project does not work. The problem is made visible through SpeechKITT because I see the recording starting and stopping.

What I'm trying in my own application:

I am trying to get annyang (with SpeechKITT) added to my app. I use the following code:

if (annyang) {
            console.log("starting annayang");
            var commands = {
                "add something *name": function (name) {
                    alert(name);
                },
            };
            annyang.addCommands(commands);
            SpeechKITT.annyang();
            SpeechKITT.setStylesheet(
                "//cdnjs.cloudflare.com/ajax/libs/SpeechKITT/1.0.0/themes/flat.css"
            );
            SpeechKITT.vroom();
        } else {
            console.log("annayang is missing");
        }
}

Expected Behavior

I expect, when I press the "mic icon" and start voice that I can talk and the voice commands get recorded and handled.

Current Behavior

What happens is that I click start and it immediately stops. If I add a onStop handler it immediately get's fired after the onStart handler.
Annyang get's configured only once, I can read out the console.log("starting annayang");.

Possible Solution

I've tried: #257, but to no avail. I am working in a svelte app. At first I thought it was because the app rerenders, but this wasn't it. I've tried the main index page and also a separate page without anything on it, the behavior is the same.

Context

I'm working on an app where voice commands would help people who have trouble typing, this component is an important part of the app.

Your Environment