add allowForSilence during recording#104
add allowForSilence during recording#104tobika wants to merge 4 commits intocapacitor-community:masterfrom
Conversation
This comment was marked as abuse.
This comment was marked as abuse.
|
I forgot to add that this approach doesn't work with |
|
@tobika can you share working example with EXTRA_SEGMENTED_SESSION ? |
I have not observed the same problem on iOS after testing my app on both devices. |
|
Thank you, this PR is quite useful. Without the allowForSilence option, this plugin is basically useless on android for long speeches, where a lot of pauses are the norm |
|
Hi again, |
Responding to this issue: #102
We don't want the recording to stop immediately after the user stops to talk for a few milliseconds.
Since API 33 we need to use
EXTRA_SEGMENTED_SESSIONtogether withEXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLISto achieve this goal.https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SEGMENTED_SESSION
Segmented session uses different callbacks on the
RecognitionListener:onSegmentResultswhich wors a bit likeonPartialResultsandonEndOfSegmentedSession.If you want to use
allowForSilencein the config you have to listen to this events in order to get the results.This is a first proposal and I'm still questioning if there's not a simpler interface for the plugin users. Reusing the
onPartialResultseven though it works a bit different. Collecting all results on the java side and pushing them back in the classic promise resolve of the start function?I'm not at all a java developer but it works. On the iOS side I haven't tested yet if there is a similar problem.