本文介绍了如何暂停android.speech.tts.TextToSpeech?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在玩文字与Android TTS - android.speech.tts.TextToSpeech

I'm playing text with android TTS - android.speech.tts.TextToSpeech

我用: TextToSpeech.speak 来说话, .stop 停止。有没有一种方法也暂停文字?

I use: TextToSpeech.speak to speak and .stop to stop. Is there a way to pause the text also?

推荐答案

该TTS SDK没有任何停顿的功能,我知道。但是你可以使用 synthesizeToFile() 以创建包含TTS输出的音频文件。然后,你会使用 MediaPlayer的反对播放,暂停和停止播放该文件。根据时间的文本字符串,它可能需要一点时间用于音频制作,因为 synthesizeToFile()函数将要完成整个文件之前,你可以玩,但是,这个延迟应该是可以接受对于大多数应用

The TTS SDK doesn't have any pause functionality that I know of. But you could use synthesizeToFile() to create an audio file that contains the TTS output. Then, you would use a MediaPlayer object to play, pause, and stop playing the file. Depending on how long the text string is, it might take a little longer for audio to be produced because the synthesizeToFile() function would have to complete the entire file before you could play it, but this delay should be acceptable for most applications.

这篇关于如何暂停android.speech.tts.TextToSpeech?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 01:07