Not getting text in recognitionResultHandler function
//Here I am not getting text (audio which i speaks converted into text) in result. But platform //handler shows below message in console
_platformCallHandler call speech.onRecognitionComplete hello
//My result handler function is here. _speech.setRecognitionResultHandler((String result) { setState(() { transcription = result; stop(); }); } );
I'm having same issue.
Note that, in dart raw file, the arguments of transcription are only sent to recognitionResultHandler() on onSpeech, not on onComplete:
Future _platformCallHandler(MethodCall call) async {
print("_platformCallHandler call ${call.method} ${call.arguments}");
switch (call.method) {
case "speech.onSpeechAvailability":
availabilityHandler(call.arguments);
break;
case "speech.onCurrentLocale":
currentLocaleHandler(call.arguments);
break;
case "speech.onSpeech":
recognitionResultHandler(call.arguments);
break;
case "speech.onRecognitionStarted":
recognitionStartedHandler();
break;
case "speech.onRecognitionComplete":
recognitionCompleteHandler();
break;
default:
print('Unknowm method ${call.method} ');
}
}
So we lose this trigger after "endOfSpeech" callback. I'm trying to bypass it, but i can't find out.
On this way i'm always losing last words of the recognition on the transcription state.
I have the same problems. I solved one of them by changing the type for "recognitionCompleteHandler" from "VoidCallback" to "StringResultHandler" and sending the parameter in recognitionCompleteHandler(call.arguments) in dart raw file.
I think this PR solves the other problem: https://github.com/rxlabz/speech_recognition/pull/89
That's good rodolZ80 Works fine here. :)
What i did, and also works, is add a call to recognitionResultHandler(call.arguments); inside recognitionCompleteHandler in dart raw file
So it triggers ResultHandler after recognition is complete, too.