TTS-UtteranceProgressListener not being called

前端 未结 4 1360
再見小時候
再見小時候 2020-12-17 07:43

I don\'t want to put all my code here, so I\'m just putting the relevant pieces. If you need more, feel free to ask.

I\'m using Text To Speech (TTS) which leads t

4条回答
  •  温柔的废话
    2020-12-17 08:07

    To append to WizardKnight's good answer:

    The new API prefers a Bundle so replace the HashMap with a Bundle

    Bundle params = new Bundle();
    params.putString(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "");
    

    then when you make the speak call

    tts.speak(text, TextToSpeech.QUEUE_FLUSH, params, "UniqueID");
    

    The key is to use the ID in the speak call. You can put it in the Bundle, but it will do nothing more for you. It has to be in the speak call to trigger the listener.

提交回复
热议问题