Search code examples
androidexoplayer

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.


Solution

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