ak1394 / react-native-tts

React Native Text-To-Speech library for Android and iOS
626 stars 159 forks source link

TTS.speak not working for iOS platform (specifically Hindi language having inconsistent behaviours) #257

Open shubhambathe1 opened 10 months ago

shubhambathe1 commented 10 months ago

The Tts.speak(speech) method is getting called but voice over is not working on iOS platform. I am using an iPhone 11 (iOS version 17.2.1) for debugging purpose. This issue is specific to the iOS platform. Having inconsistent behaviour. I have tried many things like setting the default speech rate, pitch etc. Sometimes it works randomly. But I want it to work all the time as expected. So let me know if I am missing something here. Thanks in advance.

Here is my TTS class method for speak functionality:-

public speak = async (speech: string): Promise<void> => {
        // Stopping any existing listener
        Tts.stop();

        // Waiting to initialize TTS engine
        Tts.getInitStatus().then(() => {
            // Calling the TTS.speak method here...
            Tts.speak(speech);
        }, (err) => {
            if (err.code === 'no_engine') {
                Tts.requestInstallEngine();
            }
        });
    } // speak method end

Here are my setup details:-

shubham.bathe_jos@HYDNAMMVO2117 react-native % npx react-native info       
info Fetching system and libraries information...
System:
    OS: macOS 14.1.2
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Memory: 18.14 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.19.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 10.2.5 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.14.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK:
      API Levels: 28, 31, 33, 33, 33, 34
      Build Tools: 30.0.3, 31.0.0, 33.0.2, 34.0.0
      System Images: android-34 | Google APIs Intel x86_64 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 2023.1 AI-231.9392.1.2311.11076708
    Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild
  Languages:
    Java: 21.0.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.12 => 0.71.12 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found