flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

[iOS] New language added to device is not available to flutter_tts getLanguages

Open echogit opened this issue 1 year ago • 2 comments

🐛 Bug Report

After the flutterTTs object is created with FlutterTts(), and then you add a new voice (of an existing language) via device configuration (accessibility->spoken content -> voices), the new voice shows up on the getVoices call.

But if I add a different language voice, it won't show on the getLanguages call unless the app is restarted.

if you restart the new language appears.

// 1) you have only 1 english voice installed on an iphone FlutterTts _flutterTts = FlutterTts(); var availableLanguages = await _flutterTts.getLanguages; print(availableLanguages); output: [en-US]

// 2) you then install a german voice to device and go back to the app (no new language shown) availableLanguages = await _flutterTts.getLanguages; print(availableLanguages); output: [en-US]

// 3) then you check the voices on the device var voices = await _flutterTts?.getVoices; print(voices); output: [{name: Anna, quality: default, gender: female, locale: de-DE, identifier: com.apple.voice.compact.de-DE.Anna}, {name: Susan (Enhanced), quality: enhanced, gender: female, locale: en-US, identifier: com.apple.voice.enhanced.en-US.Susan}]

// 4) you then close and reopen the app, it will find the german language due to the german voice added just before: availableLanguages = await _flutterTts.getLanguages; print(availableLanguages); output: [en-US, de-DE]

Platform:

  • [X] :iphone: iOS
  • [ ] :robot: Android

echogit avatar Apr 27 '24 16:04 echogit

I have another question, Why you can print "identifier", "quality", "gender" in getVoices result ? I only have locale and name.

dodatw avatar Jul 26 '24 05:07 dodatw

Why you can print "identifier", "quality", "gender" in getVoices result ? I only have locale and name.

That's because iOS have those added attributes, and Android TTS don't, which is a shame actually.

echogit avatar Aug 05 '24 06:08 echogit