Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Not getting text in recognitionResultHandler function #87

Open
devs4522 opened this issue Feb 19, 2020 · 3 comments
Open

Not getting text in recognitionResultHandler function #87

devs4522 opened this issue Feb 19, 2020 · 3 comments

Comments

@devs4522
Copy link

//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();
});
}
);

@viniciuspaludo
Copy link

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.

@rodolZ80
Copy link

rodolZ80 commented Apr 14, 2020

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: #89

@viniciuspaludo
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants