react-speech-recognition
react-speech-recognition copied to clipboard
Azure not working getting WebSocket connection to 'wss://us.stt.speech.microsoft.com failed: and this.recognition.stop is not a function
so im trying to polly fill azure like this
const SUBSCRIPTION_KEY ="";
const REGION = "US";
const { SpeechRecognition: AzureSpeechRecognition } =
createSpeechServicesPonyfill({
credentials: {
region: REGION,
subscriptionKey: SUBSCRIPTION_KEY,
},
});
SpeechRecognition.applyPolyfill(AzureSpeechRecognition);
and
const SUBSCRIPTION_KEY = "";
const REGION = "eastus2";
const { SpeechRecognition: AzureSpeechRecognition } =
createSpeechServicesPonyfill({
credentials: {
region: REGION,
subscriptionKey: SUBSCRIPTION_KEY,
},
});
SpeechRecognition.applyPolyfill(AzureSpeechRecognition);
but niether are working and yes i redacted my key
errors are
WebSocket connection to 'wss://us.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=en&format=detailed&Ocp-Apim-Subscription-Key=XXXXX&X-ConnectionId=484734276B5C4B108A0623DDDC8C1044' failed:
and
RecognitionManager.js:437 Uncaught (in promise) TypeError: this.recognition.stop is not a function
at RecognitionManager.stop (RecognitionManager.js:437:1)
using this to start and stop
useEffect(() => {
if (record) {
if (volume > 10) {
setIsPaused(false);
setTime(0);
if (!listening) {
SpeechRecognition.startListening({ language: "en-US" });
}
} else if (time > 1000) {
setTime(0);
setIsPaused(true);
SpeechRecognition.stopListening();
}
}
}, [record, time]);
using this to start and stop
useEffect(() => { if (record) { if (volume > 10) { setIsPaused(false); setTime(0); if (!listening) { SpeechRecognition.startListening({ language: "en-US" }); } } else if (time > 1000) { setTime(0); setIsPaused(true); SpeechRecognition.stopListening(); } } }, [record, time]);
Did you manage to fix your problem? I'm having the exact same issue and can't seem to find the cause.