-
Notifications
You must be signed in to change notification settings - Fork 134
Description
I am using .recognizeMicrophone function
stream = WatsonSpeech.SpeechToText.recognizeMicrophone({ token: token, continuous: false, outputElement: '<css selector>', content_type: 'audio/wav' });
I have added a "Push to Talk" button [When user click on it this button it will start recording till the button get released] but when I release this button before establishing WebSocket connection it gives bellow error
recognize-stream.js:345 Uncaught InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
I have also added the stream.on('error') function for handling this error but it is not emitting that event.
stream.on('error', function(err) { console.log("error is produced when calling STT"); console.log(err); });
Same for bellow 2 errors:
recognize-stream.js:260 Uncaught Error: Stream was 0 bytes but needs to be at least 100 bytes.
recognize-stream.js:260 Uncaught Error: Session timed out due to inactivity after 30 seconds.
Please advice me how to handle this error.
And correct me if my approach is wrong.
Regards,
Mahesh Revanwar