How to restart video on Exoplayer after ExoPlayer.STATE_ENDED

Hugo Gresse picture Hugo Gresse · Aug 14, 2015 · Viewed 13.4k times · Source

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

Hugo Gresse picture Hugo Gresse · Aug 14, 2015

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);