Skip to content
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

SpeechToText.listen throws ListenFailedException for fa_IR on iOS #568

Open
vieramason opened this issue Nov 17, 2024 · 0 comments
Open

Comments

@vieramason
Copy link

I'm experiencing an issue with the SpeechToText package when trying to listen for speech input with the locale fa_IR on iOS. The following exception is thrown:

flutter: [ERROR
/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Instance of 'ListenFailedException' #0 SpeechToText.listen (package
/speech_to_text.dart:465:7) #1 ActController.startListening (package
/features/act/presentation/controllers/act_controller.dart:365:5) [ERROR
/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: TimeoutException after 0:00:30.000000: Future not completed

The issue only occurs on iOS with the locale fa_IR. It works perfectly fine on Android and Web with the locale fa_IR
and work on ios with local en_EN

Code Example

Here is the function where the error occurs:

void startListening() async {
  final lang = appDatabase.read('lang');
  final localeId = (lang == "fa") ? "fa_IR" : "en_EN";
  isLoading.value = true; 
  isListening.value = false;
  await speechToText.listen(
    onResult: onSpeechResult,
    listenFor: const Duration(seconds: 10),
    localeId: localeId,
    cancelOnError: false,
    partialResults: false,
    listenMode: ListenMode.confirmation,
  );
  isLoading.value = false; 
  isListening.value = true;
}


Steps to Reproduce
Use the speech_to_text package in a Flutter project.
Set the localeId parameter to fa_IR and call the SpeechToText.listen method on an iOS device.
Observe the error.


Environment
Flutter version: 3.24.3 
speech_to_text version: ^6.5.1
iOS version: 18
Device: simulator - iphone 16
Other Notes: This issue does not occur on Android or Web.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant