capacitor-community/text-to-speech

bug: speak() fails on iOS 16.2 - Unable to list voice folder

neonish opened this issue · 3 comments

Plugin version:
2.1.0

Platform(s):
iOS 16.2 (real device, not simulator)

Current behavior:
Nothing can be heard, device log shows errors (see below) after calling speak()

Expected behavior:
Text will be read. No errors in log.

Steps to reproduce:
See related code.

Related code:

const speak = async () => {
    await TextToSpeech.speak({
        text: "How are you doing today?",
        lang: "en-US",
        rate: 1.0,
        pitch: 1.0,
        volume: 1.0,
        category: "ambient",
    });
};

const supported = await TextToSpeech.getSupportedLanguages();
console.log("SUPPORTED:", supported);

console.warn("SPEAKING NOW!");
await speak();
console.warn("SPEAKING DONE!");

Other information:
Error Log:

⚡️  To Native ->  TextToSpeech getSupportedLanguages 17009103
2023-03-17 08:17:11.496292+0100 App[63424:5046446] [Accessibility] WKContentView[@] set up: @ pid: @ MACH_PORT 1585677312
⚡️  TO JS {"languages":["ar-001","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","el-GR","en-AU","en-AU","en-AU","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","
⚡️  [log] - SUPPORTED: {"languages":["ar-001","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","de-DE","el-GR","en-AU","en-AU","en-AU","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-GB","en-IE","en-IN","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-US","en-ZA","es-ES","es-ES","es-ES","es-ES","es-ES","es-ES","es-ES","es-ES","es-ES","es-MX","es-MX","es-MX","es-MX","es-MX","es-MX","es-MX","es-MX","es-MX","fi-FI","fi-FI","fi-FI","fi-FI","fi-FI","fi-FI","fi-FI","fi-FI","fi-FI","fr-CA","fr-CA","fr-CA","fr-CA","fr-CA","fr-CA","fr-CA","fr-CA","fr-CA","fr-FR","fr-FR","fr-FR","fr-FR","fr-FR","fr-FR","fr-FR","fr-FR","fr-FR","fr-FR","fr-FR","he-IL","hi-IN","hr-HR","hu-HU","id-ID","it-IT","it-IT","it-IT","it-IT","it-IT","it-IT","it-IT","it-IT","it-IT","ja-JP","ja-JP","ja-JP","ko-KR","ms-MY","nb-NO","nl-BE","nl-NL","pl-PL","pt-BR","pt-BR","pt-BR","pt-BR","pt-BR","pt-BR","pt-BR","pt-BR","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sv-SE","th-TH","tr-TR","uk-UA","vi-VN","zh-CN","zh-CN","zh-CN","zh-HK","zh-TW"]}
⚡️  To Native ->  TextToSpeech speak 17009104
⚡️  [warn] - SPEAKING NOW!
2023-03-17 08:17:11.597112+0100 App[63424:5047103] [catalog] Unable to list voice folder
2023-03-17 08:17:11.619811+0100 App[63424:5047103] [catalog] Unable to list voice folder
2023-03-17 08:17:11.624239+0100 App[63424:5047103] [catalog] Unable to list voice folder
2023-03-17 08:17:11.640725+0100 App[63424:5047103] [catalog] Unable to list voice folder
2023-03-17 08:17:11.687712+0100 App[63424:5047102] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
2023-03-17 08:17:11.707096+0100 App[63424:5047156] [AXTTSCommon] File file:///System/Library/PreinstalledAssetsV2/RequiredByOs/com_apple_MobileAsset_VoiceServices_VoiceResources/cfaf4a2cf3146016631559ddcc471f5654939e74.asset/AssetData/vocalizer-user-dict.dat contained data that was not null terminated
⚡️  TO JS undefined
⚡️  [warn] - SPEAKING DONE!

Might be related to #84, except getSupportedLanguages() returns a valid array (see log).

Capacitor doctor:

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 4.7.1
  @capacitor/core: 4.7.1
  @capacitor/android: 4.7.1
  @capacitor/ios: 4.7.1

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/cli: 4.7.0
  @capacitor/core: 4.7.0
  @capacitor/ios: 4.7.0

[success] iOS looking great! 👌

We’re seeing the same issue on 16.3.1

I just tested it with my iPhone 13 with iOS 16.3.1 and could not reproduce the issue.
So unfortunately I can't debug any further. PRs are welcome.

hi everyone, i have the same problem too. On my case, the plugin was fine 2 weeks ago, but now is muted en IOS...
On the xcode console, is printing this errors:

⚡️ To Native -> TextToSpeech speak 72170864
2023-04-19 10:51:08.190741-0300 App[7643:6907181] [catalog] Unable to list voice folder
2023-04-19 10:51:08.213198-0300 App[7643:6907181] [catalog] Unable to list voice folder
2023-04-19 10:51:08.218390-0300 App[7643:6907181] [catalog] Unable to list voice folder
2023-04-19 10:51:08.239032-0300 App[7643:6907181] [catalog] Unable to list voice folder

And this is my code:
TextToSpeech.speak({
text: this.content.title,
lang: 'es-AR',
voice: 2
})

I did try whit es-Es or en-US on lang... or voice: 1, 2, 10, etc...
The method "getSupportedVoices returns some voice, this is aparently working fine.

Thanks a lot! I hope your help!