-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setPauseFor method for late setup #403
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an interesting idea, thanks for outlining the use case, that's helpful. Also, many thanks for including tests, nice to see.
I'm wondering if we could make its functionality clearer through naming. Maybe something like 'changePauseFor'? I think that would be the simplest change.
There are more complicated options like adding an optional callback to onResult or a return from onResult to make its intended use clearer. But I think that's probably overkill.
Sure. I changed the method name to "changePauseFor" And yes, I think adding new callbacks doesn't make sense. It's easy to implement on APP side. |
Oh. Wait. I found some problems. |
…imer. Fix counting delta time for last speach event.
So... There was a problem with calulating delta time from last speech event _lastSpeechEventAt I had to overwrite _lastSpeechEventAt when changing pauseFor. Looks like a workaround, because _lastSpeechEventAt semantically not for this purpose. May be you have better solution? Cover this case in tests. Also i fixed checking for listening status. Previous _listenTimer?.isActive it was a mistake |
Yes, I see the problem. I agree that changing the The second idea would be to add a new optional parameter to the |
…for _setupListenAndPause
The second idea seems to be more intuitive for developers who will use this feature. I added an optional parameter {bool ignoreElapsedPause = false} to _setupListenAndPause and if it is true then _elapsedSinceSpeechEvent is not used when calculating the timer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks.
This enable to setup puseFor timeout after start listening.
Reason: in my app I try to implement continuous conversation. So when start listentening after previous reposne, user may think longer. It more UX friendly if start listening with longer pauseFor (e.g. 10 sec) and after first onResult, chage pauseFor to short timeout (e.g. 3 sec.)