annyang icon indicating copy to clipboard operation
annyang copied to clipboard

JS Error in latest Firefox 63.0.3

Open smxsm opened this issue 7 years ago • 4 comments

Although Firefox should support the Webspeech API now, annyang gives errors.

image

The problem here seems to be that Firefox does not support "recognition.continuous" (found out by using the non-minified script). If I comment out the two occurences of it in the script, the error goes away. Anyang now seems to start, but it doesn't recognize anything... if I enable debug, I get another, weird, error: image

If I have debug disabled, there are no errors, but also nothing happens ... In case you are wondering, here is my script:

    if (annyang) {
        console.log("Annyang found ... listening");
        var commands = {
            'finde *tag': startSearch
        };
        annyang.debug(true);
        annyang.addCommands(commands);
        annyang.setLanguage('de-DE');
        annyang.start({ autoRestart: true, continuous: false });
        console.log("annyang started");
    }

Expected Behavior

Firefox should work, too :)

Current Behavior

Javascript errors, see above... If I "fix" them, still nothing happens ...

Steps to Reproduce (for bugs)

  1. Open Firefox
  2. in "about:config", search for "speech" and enable all relevant settings
  3. Go to https://www.talater.com/annyang/
  4. Try examples
  5. Check javascript console

Your Environment

Current Annyang version, latest Firefox 63.0.3., on MAC OS and Windows

smxsm avatar Nov 21 '18 10:11 smxsm

It looks like even the official MDN Webspeech Demo doesn't work in Firefox ... no errors in the console, but also no reaction to anything, although at least the microphone icon in the address bar is blinking ... https://mdn.github.io/web-speech-api/speech-color-changer/

smxsm avatar Nov 21 '18 12:11 smxsm

One last note - it looks FF needs a SpeechGrammarList to even start... if I hardcode that into your start() function, I get at least the microphone icon to blink red in Firefox - yet it still doesn't react to anything, just like the color switch demo... :(

            // beffy - FF needs a grammar to even start
            //var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList
            var grammar = '#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;'
            var speechRecognitionList = new SpeechGrammarList();
            speechRecognitionList.addFromString(grammar, 1);
            recognition.grammars = speechRecognitionList;

          recognition.start();

I have added all possible event handlers and a console.log inside all functions and events... so everything seems to start (and eventually end), but nothing is found, but e.g. "onnomatch" is not triggered either ... here is the output:

image

image

smxsm avatar Nov 21 '18 12:11 smxsm

@smxsm: It works in FireFox 67 (the latest version)

rocketbear27 avatar Jun 10 '19 23:06 rocketbear27

Related: https://github.com/TalAter/annyang/issues/406

LarryBattle avatar Oct 30 '19 22:10 LarryBattle