danielgomezrico danielgomezrico - 24 days ago 44
Android Question

How to pause ExoPlayer 2 playback and resume (PlayerControl was removed)

In

ExoPlayer < 2.x
there was a class
PlayerControl
with
pause()
and
resume()
functions but it was removed. I can't find a way to do this on
ExoPlayer 2
.

How can I pause and resume a playback?

Answer

you can use void setPlayWhenReady(boolean playWhenReady);. If Exo is ready, passing false you will pause the player. Passing true you will resume it. You can check the player's state using getPlaybackState()

Comments