Restart the listener.
Closed this issue · 6 comments
I want the listener to be active for 10 - 15 minutes.But when the listener is idle for few seconds it will stop listening . How should i restart the listener in that case?
Once there is an error like
1)notifyError {"errorMsg":"error_no_match","permanent":true}
2)notifyError {"errorMsg":"error_busy","permanent":true}
How do i restart the listener again.
Depending on the type of error you should be able to call listen
again immediately and that will start a new listen session. There are some limits imposed by the provider on how long / frequently you can invoke speech recognition for. If recognition sessions were getting throttled by the provider, or if network connection problems were interfering, then calling listen
would not work. Android, at least on Samsung devices, seems particularly aggressive about shutting down recognition.
Let me know if invoking listen
again works for you.
Tried calling the listen in the status callback. When ever the status changes to not listening was calling a new session on speech. This was working fine but after some time it throws the following error
{"errorMsg":"error_busy","permanent":true}
How should i restart the listener in case of this ?
And there is a parameter durationFor in the listen method, though i was giving it a value of 10 minutes just after being idle for few seconds it throws the error no match found and the listener stops listening. So what's the actual use case of that durationFor parameter ?
I'm guessing that the error_busy means that there is already a recognition session active. In your error handler try calling await speechToText.stop()
before you call listen. It should resolve that error.
The duration parameter allows you to set a maximum listen duration that is separate from any OS defined timeout. The timeout that you are seeing is from the underlying OS. On iOS the speech recognition doesn't time out quickly, as it does on Android, so being able to stop a session automatically is useful.
Will try to add that in error handler and check it .
I'll assume the last suggestion resolved the issue and close this.
Will try to add that in error handler and check it .
can you share your code please that restart the listener