I have written a react spa pwa for web, android, and iPhone, only it's not working on the iPhone. When I configure the msft speech sdk ("microsoft-cognitiveservices-speech-sdk": "^1.15.0") I get the following error:
Unhandled Rejection (TypeError): null is not an object (evaluating 'this.privInitializeDeferral.reject')
(anonymous function)
src/common.browser/MicAudioSource.ts:141
138 | this.privInitializeDeferral.resolve();
139 | }, (error: MediaStreamError) => {
140 | const errorMsg = `Error occurred during microphone initialization: ${error}`;
> 141 | this.privInitializeDeferral.reject(errorMsg);
| ^
142 | this.onEvent(new AudioSourceErrorEvent(this.privId, errorMsg));
143 | });
144 | }
The code I use to configure the service:
import { SpeechConfig, AudioConfig, SpeechRecognizer } from "microsoft-cognitiveservices-speech-sdk";
const register = async () => {
const speechConfig = SpeechConfig.fromSubscription(state.azure.transcription.key, state.azure.region);
speechConfig.speechRecognitionLanguage = fromSpeech;
const audioConfig = AudioConfig.fromDefaultMicrophoneInput();
recognizer = new SpeechRecognizer(speechConfig, audioConfig);
};
And my code to start transcribing:
const rec = async () => {
recognizer.recognized = recognized;
recognizer.canceled = internalError;
recognizer.recognizing = recognizing;
recognizer.canceled = handleError;
await recognizer.startContinuousRecognitionAsync();
};
I don't think that there is anything remarkable about the code. I think that the instructions were pretty clear and that I have followed them. The evidence for this is that this works fine on the web and on android. Only the iPhone has a problem with it and it's the same code.
If anyone has a clue how to solve this that would be great. If it's a bug in the sdk then a workaround would be really helpful. TIA.
from microsoft-cognitiveservices-speech-sdk/javascript on iOS Safari: MicAudioSource issue
No comments:
Post a Comment