Android TextToSpeech.synthesizeToFile() file is not created

后端 未结 1 1362
走了就别回头了
走了就别回头了 2020-12-20 23:19

I am trying to implement a pause and play function to some text using tts and MediaPlayer. However, I can\'t seem to be able to create a .wav file using the synthesizeToFile

相关标签:
1条回答
  • 2020-12-21 00:05

    The method synthesizeToFile is asynchronous thus you should do the checking

    File fileTTS = new File(destFileName);
    
    if (fileTTS.exists()) {
        Log.d(TAG, "successfully created fileTTS");
    }
    else {
        Log.d(TAG, "failed while creating fileTTS");
    }
    

    in onUtteranceCompletedListener or UtteranceProgressListener

    0 讨论(0)
提交回复
热议问题