A. Cedano
A. Cedano

Reputation: 965

How can I correctly update the value of Speed in Android Media3?

I am creating a text to speech player using Android TTS engine and Media3 and I want to change the reading speed from the settings button.

To achieve this I have overwritten this method that receives the new value as a parameter:

override fun handleSetPlaybackParameters(playbackParameters: PlaybackParameters): ListenableFuture<*> {
    changeSpeechRate(playbackParameters)
     return Futures.immediateVoidFuture()
 }

And in the class where I manage the TTS configuration I have the method changeSpeechRate:

fun changeSpeechRate(playbackParameters: PlaybackParameters) {
    mTts.setSpeechRate(playbackParameters.speed);
}

The voice speed is changed, but my problem is that the value is not updated in the settings.

For example, I changed the speed to 0.75, the voice reading changes the speed, but in the configuration options it does not show that the current speed is 0.75, it always shows Normal, as you can see in the image below:

enter image description here

How can I update the value, putting the check mark on the selected speed?

Upvotes: 0

Views: 23

Answers (0)

Related Questions