csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
351 stars 218 forks source link

iOS, onResult is not called #516

Open ugochirico opened 3 weeks ago

ugochirico commented 3 weeks ago

On iOS 12 Pro, with iOS 16.5, onResult is never called. This is my code:

await _speech.listen(
        listenOptions: SpeechListenOptions(
          partialResults: false,
          listenMode: ListenMode.deviceDefault,
            autoPunctuation: true,
            enableHapticFeedback: true,
            cancelOnError: true,
        ),
        onResult: (value) => onResult(value.recognizedWords),
        localeId: language,
      );

this is the log:

flutter: listening
[plugin] HypothesizeTranscription
[plugin] HypothesizeTranscription
[plugin] HypothesizeTranscription
[plugin] HypothesizeTranscription
[plugin] HypothesizeTranscription
[plugin] HypothesizeTranscription

it continues until I call _speech.stop();

Omu0503 commented 2 weeks ago

Yea same, I'm unable to detect anything. Found any solutions to this?

ugochirico commented 2 weeks ago

Not yet. I'm blocked on this point

Omu0503 commented 2 weeks ago

have you tried using other plugins? or should we natively code it?

ugochirico commented 2 weeks ago

I have a native iOS code and it works. I'm now moving my app to flutter but this package has that problem

Omu0503 commented 2 weeks ago

could you share the nativer code

Ashok-Bhati commented 6 days ago

I tried it with pauseFor attribute and it worked for me, It stops after 3 seconds if I didn't utter anything. I tested it with Iphone 11 with iOS 17.4.1.

_speech.listen(pauseFor: Duration(seconds: 3), onResult: (result) {
   FFAppState().update(() {
   FFAppState().sttWords = result.recognizedWords;
   });
 });