1

I have a problem with react-native-voice and react-native-tts, after interaction with user interface sound output has changed to the internal speaker and sound is very quiet. Maybe someone has the same problem and knows how to control sound output in iOS.

Thank you.

async _startRecognition(e) {
    if (Voice.isRecognizing()) return;

    this.resetSpeechState();
    try {
      await Voice.start('en-GB');
    } catch (e) {
      console.error(e);
    }
  }

  handleSpeak = (text) => {
    if (this.state.speaking) return false;

    Tts.getInitStatus().then(() => {
      Tts.speak(text);
    });
  }
Daniel Rosenberg
  • 600
  • 6
  • 11

1 Answers1

-1

it's temporary solution until is it available in new npm/yarn release.

if you are using react-native-voice and react-native-tts both, then react-native-voice will create conflict. they have fixed this issue in their master branch, u have to take Voice.m from there and paste in your node_module package. First go to react-native-voice github, click the link below to see the Voice.m master branch code https://github.com/wenkesj/react-native-voice/blob/ae01a0876e2a9635ae4047dd230f5e7ef2d00672/ios/Voice/Voice.m and copy whole code, then go to your node_nodules (node_modules/react-native-voice/ios/Voice/Voice.m) and replace the whole local code, save it. run your project, it should work now.

Raj Rj
  • 3,497
  • 4
  • 24
  • 34
  • and after the next yarn install, you'll lose all your changes. – Daniel Rosenberg May 22 '19 at 09:16
  • yes, that's the problem.. But copying `Voice.m` will solve the issue again. I know it's a temporary solution till it is available in new `npm/yarn` release. Something is better than nothing – Raj Rj May 27 '19 at 10:00