`AbortListening` is not a function when using the Azure Polyfill
davidli3100 opened this issue · 1 comments
davidli3100 commented
When using the azure polyfill as described below, calling SpeechRecognition.abortListening
raises an error since abort
is not a function. Not sure if there's something funny going on with how I'm using the polyfill, or if we should be using stop
instead
useEffect(() => {
if (typeof document !== "undefined") {
const { SpeechRecognition: AzureSpeechRecognition } =
createSpeechServicesPonyfill({
credentials: async () => {
const { data } = await axios.get("api/getSpeechKey");
const { authToken } = data || {};
return {
region: "eastus",
authorizationToken: authToken,
};
},
});
SpeechRecognition.applyPolyfill(AzureSpeechRecognition);
}
}, []);
dkaser commented
This is probably a timing issue... I noticed the same problem recently if I try to:
- useSpeechRecognition
- StartListening
- AbortListening
Very quickly (within a few seconds, particularly if my internet connection is slow). If I wait for a bit longer, the function appears.