SpeechToText-WebSockets-Javascript
SpeechToText-WebSockets-Javascript copied to clipboard
Got NotSupportedError when using OpusRecorder in browser
Tested on PC with Chrome 67.0.3369.99 and Edge 17.17134. And also Chrome 67 on Android. All failed with same error.
Following the sample code at https://docs.microsoft.com/en-us/azure/cognitive-services/speech/api-reference-rest/websocketprotocol#opus.
When starting recognition, console says:
2018-06-30T23:26:57.129Z |
RecognitionEndedEvent |
metadata: {} |
requestId: A7B... |
audioSourceId: 14C... |
audioNodeId: EAA... |
connectionId: <NULL> |
authFetchEventId: <NULL> |
status: 1 |
error: 'Unhandled callback error: 'Unhandled callback error: NotSupportedError: Failed to construct 'MediaRecorder': Failed to initialize native MediaRecorder the type provided (audio/ogg) is not supported.'' |
serviceTag: <NULL>
What's worse, got multiple JS errors afterward and the microphone audio channel is kept opened (keep showing record red icon on tab).
It seems all browsers does not support Opus. Tried to run new MediaRecorder(stream, { mimeType: 'audio/ogg' }) in F12 console:
VM57:1 Uncaught DOMException: Failed to construct 'MediaRecorder': Failed to initialize native MediaRecorder the type provided (audio/ogg) is not supported.
at <anonymous>:1:1
Only FireFox support audio/ogg; codecs=opus for MediaRecorder. But even with firefox, this sample doesn't work for Opus. Server will not recognize Ogg/Opus