capacitor-community/text-to-speech

bug: Speech not being played on open speakers on ios real device

syedareebshah opened this issue ยท 7 comments

Plugin version:

"@capacitor/core": "5.0.0",
"@capacitor/ios": "5.0.0",
"@capacitor-community/text-to-speech": "^3.0.0",

Platform(s):
ios

Current behavior:
I am using ionic react.I am using this plugin on both Android and ios, on android speech is played on Open Speakers, but on ios, speech is just audible through earphones. It should play speech on open speakers on Ios as well. (on real device)

Expected behavior:
It should play speech on open speakers on Ios as well.(on real device)

Steps to reproduce:
just create a simple app, install this plugin and run it on a real device.

Related code:

  try {
      handleStop();
      await TextToSpeech.speak({
        text: `${response}`,
        lang: "en-US",
        rate: 1.0,
        pitch: 1.0,
        volume: 1.0,
        category: "ambient",
      });
      startRecording();
    } catch (error) {
      alert("something went wrong");
    }
  };

Capacitor doctor:

๐Ÿ’Š   Capacitor Doctor  ๐Ÿ’Š 

Latest Dependencies:

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

Installed Dependencies:

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

[success] iOS looking great! ๐Ÿ‘Œ
[error] Missing <manifest package=""> attribute in app/src/main

Unfortunately, I can't reproduce your problem on my iPhone 13 with iOS 16.5.1 in the demo app.
Is the sound of your app perhaps blocked by the "mute" switch?

@robingenz I have tested on iPhone 7 and iPhone X with IOS 16.5 speech is not being played on Loudspeakers, how can we overcome this problem? The app has taken permission, how can we debug whether it is being muted, what is the reason behind it?

=> Ionic React with Capacitor

here is the repo you can clone.
steps:
https://github.com/areeb-gsoftconsulting/ionic-learn/tree/text-to-speech
checkout to text-to-speech branch.
navigate to the Pages folder.
Tab1.tsx file contains our code for text-to-speech. Please try to run it on a real ios device. Speech should play on Loud Speakers. Generally, it does not play on Loudspeakers, what are the changes that we have to do to play it on Loud Speakers?

Please provide a Minimal, Reproducible Example (without unnecessary dependencies) using this template in a public GitHub repository.

@robingenz
Here is the new code I have created this repo that just contains code for text to speech, try to run this code. It should play speech on loudspeakers when using a real IOS device.

https://github.com/areeb-gsoftconsulting/speech-to-text

I tested your example, but I could not reproduce your issue. The text was read out loud.

RPReplay_Final1688570768.MP4

@robingenz
Have you tested it on a Real IOS device? because it works fine, Loud on ios simulators. The problem is with Real devices.

Yes, i tested it on my iPhone 13 with iOS 16.5.1.