flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

iPhone XS Max with iOS 14.7.1: Doesn't work with Flutter 2.5

Open ksilz opened this issue 2 years ago • 9 comments

🐛 Bug Report

In my app, playing text-to-speech worked with Flutter 2.2 on an iPhone XS Max with iOS 14.7.1. It doesn't with Flutter 2.5 anymore, showing the error below. The version of "flutter_tts" hasn't changed since then. It still works on Android, on iPhone 7 with iOS 15 beta, and iPhone 5s with iOS 12.5.4.

Expected behavior

The text-to-speech works on iOS.

Reproduction steps

Here's my code for speaking:

SUtil.instance.logger.i("STextToSpeechEngine.speak: speaking this text: $text");

if (Platform.isIOS) {
  this._tts.setSharedInstance(true);
  this._tts.setIosAudioCategory(IosTextToSpeechAudioCategory.playback, [
    IosTextToSpeechAudioCategoryOptions.allowBluetooth,
    IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
    IosTextToSpeechAudioCategoryOptions.allowAirPlay,
  ]);
}

await _tts.awaitSpeakCompletion(true);
await _tts.speak(text);

if (Platform.isIOS) {
  this._tts.setSharedInstance(false);
}

if (stopHandler != null) {
  stopHandler.call();
}

Here's the output:

flutter: [I] TIME: 2021-09-09T08:45:11.413877 STextToSpeechEngine.configure: START: configuration=SSpeechConfiguration(voice: SSpeechVoice(name: Daniel (Enhanced), locale: en-GB), rate: 0.5, volume: 1.0, pitch: 0.5)
flutter: [I] TIME: 2021-09-09T08:45:11.416804 STextToSpeechEngine.speak: speaking this text: Hi! I am the Your Home app. I look forward to talking to you!
flutter: [I] TIME: 2021-09-09T08:45:11.435844 _SettingsSpeechPageState._buildContent: voice=[Daniel (Enhanced) (United Kingdom)]
Error Domain=NSOSStatusErrorDomain Code=2003329396 "(null)"
flutter: [I] TIME: 2021-09-09T08:45:12.245070 STextToSpeechEngine._configureVariableEngineParameters: voice=SSpeechVoice(name: Daniel (Enhanced), locale: en-GB), rate=0.5, volume=1.0,
[AXTTSCommon] Error initializing speech: -2147483635. Perhaps the asset was bad? voice: Daniel premium: 0, speech server: TTSNashvilleSpeechServerInstance
Speech initialization error: 18446744073709547610

Configuration

Version: 3.2.2 Flutter: Channel stable, 2.5.0

Platform:

  • [X] :iphone: iOS 14.7.1

ksilz avatar Sep 09 '21 07:09 ksilz

The same app works on iPhone 7 with iOS 15 beta and iPhone 5s with iOS 12.5.4.

ksilz avatar Sep 09 '21 08:09 ksilz

@ksilz is the issue specific to iOS 14.7.1 and flutter 2.5?

dlutton avatar Sep 09 '21 18:09 dlutton

If I'd guess, I'd say it's iOS 14 + Flutter 2.5. It worked on iOS 14 with Flutter 2.2.

ksilz avatar Sep 10 '21 12:09 ksilz

Hello ksilz, I am working on an app using the package quite a lot. Tried with Flutter 2.5 today and it works fine on iPad and iPhone XSMAx. Did you manage to solve your problem ? I have iOS 14.7.1

I would need your opinion on the quality of pronunciation on iOS device. I am quite disappointed in it compared to simple Android devices such as Samsung phones. Do you encounter the same problem? The words are pronounced in a "robotic" and "up in the nose" way. My app is a "English vocabulary" learning app for school children. It works fine on Android devices but am not sure the quality will be enough on iOS devices. Do you know of a way to improve this ? are there alternatives to this package that could be better ? Thanks for your help :)

sylvainjack avatar Sep 11 '21 15:09 sylvainjack

I am having the same problem. It is happening with Flutter 2.5.3 and iOS 14.8.1. It is now causing my app to crash, and it seems to be only on the iPhone 12 Pro Max. Has anyone found a fix for this problem?

AJWurts avatar Dec 27 '21 23:12 AJWurts

@AJWurts do you have any logs you can provide related to your app crash?

dlutton avatar Dec 28 '21 00:12 dlutton

I am having the same problem. It is happening with Flutter 2.8.1 and iPhone 7 Plus with iOS 14.0.1. The console has only one line of exception code:Error Domain=NSOSStatusErrorDomain Code=2003329396 "(null)"

Flutter 2.8.1 and iPhone 7 with iOS 13.6. The console has only one line of exception code:Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"

but the same app works on Android devices and iPhone 13 Pro Max with iOS 15.2 and iPhone 8 with IOS 15.2 and iPhone 11 with IOS 15.3.1

I don't think it has anything to do with the exception of console output. Because iPhone 11 works normally, but it still outputs this line of code: Error Domain=NSOSStatusErrorDomain Code=2003329396 "(null)"

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0 21A344 darwin-arm, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 13.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] Connected device (4 available)

• No issues found!

flutter_tts version: 3.3.3

pengboboer avatar Apr 16 '22 03:04 pengboboer

@dlutton

pengboboer avatar Apr 16 '22 08:04 pengboboer

@pengboboer thanks for your research and information. This will require additional research on my end.

dlutton avatar Apr 21 '22 18:04 dlutton