React Native:Google-文字转语音 (tts) 效果不佳

React Native: Google-text-to-speech (tts) doesn't work well

我有一个 react-native 移动应用程序,它用 google tts 发音单词。但是在第四十个发音之后就不行了。退出应用程序并重新进入后,它开始工作。我认为这与 google tts api 有关。我该如何解决?

您需要添加“speech.release()”代码:

    const speech = new Sound(voice, '', (error) => {
      if (error) {
        console.warn('failed to load the sound', error)
    
        return
      }
      speech.play((success) => {
        if (!success) {
          console.warn('playback failed due to audio decoding errors')
        }else{
          speech.release()  // Need to add this code
        }
      })
      return 
    })