Why is SpeechRecognizer from Azure SDK for Javascript not working on Android devices?
I have implemented speech to text recognition using Azure Speech Service.
The speech recognition (from microphone) code is implemented in javascript for browsers. The code is integrated in our web-page and works fine if the web page is executed on a desktop computer.
However if the web-page is executed on an Android mobile device it does not work.
Although the SpeechRecognizer is correctly instantiated and the mobile device indicates the microphone is active there is no sound from the microphone - just silence.
There is no error detected on the Android device.
Here is the code snippet from my implementation:
function startSpeechRecognition(language) {
const speechConfig = SpeechSDK.SpeechConfig.fromSubscription(key_xxx, sReg_yyy);
speechConfig.speechRecognitionLanguage = language;
const audioConfig = SpeechSDK.AudioConfig.fromDefaultMicrophoneInput();
var myRecognizer = new SpeechSDK.SpeechRecognizer(speechConfig, audioConfig);
myRecognizer.recognized = (recognizer, event) => {
switch (event.result.reason) {
case SpeechSDK.ResultReason.NoMatch:
break;
case SpeechSDK.ResultReason.RecognizedSpeech:
onRecognizedText(speechConfig.speechRecognitionLanguage, event.result.text);
break;
case SpeechSDK.ResultReason.Canceled:
const cancellation = SpeechSDK.CancellationDetails.fromResult(event.result);
console.log(`CANCELED: Reason=${cancellation.reason}`);
if (cancellation.reason == SpeechSDK.CancellationReason.Error) {
console.log(`CANCELED: ErrorCode=${cancellation.ErrorCode}`);
console.log(`CANCELED: ErrorDetails=${cancellation.errorDetails}`);
}
recognizer.stopContinuousRecognitionAsync();
break;
}
};
myRecognizer.startContinuousRecognitionAsync(() => { }, e => console.error(e));
}
Do you have any idea what could be wrong and how to resolve it?