Cognitive-services-speech-sdk: The Azure JavaScript-STT-SDK works well on PC, but it does not work on mobile phones.

Created on 18 May 2020  路  4Comments  路  Source: Azure-Samples/cognitive-services-speech-sdk

Why is JavaScript STT-SDK from a default microphone just for PC, but not for mobile phones?
We use this const audioConfig = AudioConfig.fromDefaultMicrophoneInput().

//code
speech() {
let that = this;
const speechConfig = SpeechConfig.fromSubscription(
"*",
"*"
);
speechConfig.speechRecognitionLanguage = "zh-CN";
const audioConfig = AudioConfig.fromDefaultMicrophoneInput();
const recognizer = new SpeechRecognizer(speechConfig, audioConfig);
recognizer.start;
recognizer.recognizeOnceAsync(result => {
switch (result.reason) {
case ResultReason.RecognizedSpeech:
console.log(RECOGNIZED: Text=${result.text});
that.inputMsg = result.text;
console.log(" Intent not recognized.");
break;
case ResultReason.NoMatch:
console.log("NOMATCH: Speech could not be recognized.");
that.tts("娌℃湁鍚埌鎮ㄨ璇濆枖~");
break;
case ResultReason.Canceled:
const cancellation = CancellationDetails.fromResult(result);
console.log(CANCELED: Reason=${cancellation.reason});
if (cancellation.reason == CancellationReason.Error) {
console.log(CANCELED: ErrorCode=${cancellation.ErrorCode});
console.log(
CANCELED: ErrorDetails=${cancellation.errorDetails}
);
console.log("CANCELED: Did you update the subscription info?");
}
break;
}
});
},

question

All 4 comments

The JavaScript SDK relies on getUserMedia to gain microphone access.

Some browsers don't support this on phone (Chrome and FireFox on iPhone are examples) and the SDK then has no Microphone access. (Safari does work on iPhone).

https://bugs.webkit.org/show_bug.cgi?id=208667 is the root cause for iOS.

What browser / phone combination are you using?

This problem has beem resloved by this method,
(JavaScript Language API) void plus.speech.startRecognize( options, successCB, errorCB );

On the other hand, I face an another problem, when I test an app with the latest released version of the Microsoft Cognitive Services Speech SDK (1.12.0) on iOS devices.
(JavaScript Language API) const audioConfig = AudioConfig.fromDefaultSpeakerOutput( );
And this function does not work on iOS devices.

I think this PR: https://github.com/microsoft/cognitive-services-speech-sdk-js/pull/183 fixes the speaker output on iOS.

Closing the issue as the questions were answered.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ray12345678910 picture Ray12345678910  路  3Comments

PeterKhouri68 picture PeterKhouri68  路  5Comments

marcominerva picture marcominerva  路  4Comments

SOliasS picture SOliasS  路  4Comments

maczikasz picture maczikasz  路  6Comments