Hugo Gresse Hugo Gresse - 5 months ago 117
Android Question

How to restart video on Exoplayer after ExoPlayer.STATE_ENDED

I'm using Exoplayer with a base of the DemoPlayer.
I want to restart/replay the video from beginning on some user action after that ExoPlayer.STATE_ENDED is dispatched.

I've tried to use

seekTo(0)
and
mPlayer.setPlayWhenReady(true);
after but it didn't do anything, at all.

Answer

I've updated the library to ExoPlayer r1.4.2 and it does the job...

    mPlayer.seekTo(0);
    mPlayer.setPlayWhenReady(true); // replay from start

// Pause video after restart

    mPlayer.seekTo(0);
    mPlayer.setPlayWhenReady(false);
Comments