Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute 'start' on 'SpeechRecognition': recognition has already started. at listen #23

Open
kushal-g opened this issue Apr 28, 2020 · 2 comments

Comments

@kushal-g
Copy link

kushal-g commented Apr 28, 2020

The above error is coming when stopping and again listening to the microphone in useSpeechRecognition hook and there is the callback for result is not getting executed. I'm getting it even when using the examples provided in the docs. I'm on Microsoft Edge Version 81.0.416.64

@MikeyParton
Copy link
Owner

I can reproduce the error and will take a closer look later today. It looks like support for SpeechRecognition on edge is pretty new and others have reported buggy behaviour even on Edge Canary 84.0.488.0. https://techcommunity.microsoft.com/t5/discussions/web-speech-api-support/m-p/1104645

@MikeyParton
Copy link
Owner

Unfortunately this appears to be a bug with Edge's implementation of the SpeechRecognition api. The following minimal example without react-speech-kit throws the same error.

const recognition = new window.webkitSpeechRecognition();
recognition.onstart = () => { console.log('started'); }
recognition.onend = () => { console.log('ended'); }
recognition.onresult = (e) => { console.log('result', e); }

recognition.start();
// 'started' is logged but onresult is not triggered as you speak

recognition.stop();
// 'ended' is not logged indicating that recognition hasn't been stopped properly

recognition.start();
// Uncaught DOMException: Failed to execute 'start' on 'SpeechRecognition': recognition has already started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants