How to pause android.speech.tts.TextToSpeech?

前端 未结 10 992
不知归路
不知归路 2020-12-01 03:47

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

I use: TextToSpeech.speak to speak and .stop to stop. Is

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 04:25

    In the absence of a pause option, you can add silence for the duration of when you want to delay the TTS Engine speaking. This of course would have to be a predetermined 'pause' and wouldn't help to include functionality of a pause button, for example.

    For API < 21 : public int playSilence (long durationInMs, int queueMode, HashMap params)

    For > 21 : public int playSilentUtterance (long durationInMs, int queueMode, String utteranceId)

    Remember to use TextToSpeech.QUEUE_ADD rather than TextToSpeech.QUEUE_FLUSH otherwise it will clear the previously started speech.

提交回复
热议问题