Search code examples
androidexoplayer

How to implement oncompletionlistener to detect end of media file in Exoplayer


I am trying to play videos in the form of a playlist one after another. I am using android ExoPlayer to play my files, but there are no listeners in ExoPlayer to listen to an end of a media file.

Is there a way to listen to the end of media files using ExoPlayer?


Solution

  • Exoplayer offer advance implementation which media player do not.

    in Advance example of Exoplayer by Android, in FullPlayerActivity.java they have implemented onStateChanged, which offers STATE_ENDED

    You can download example from the right hand section of this page under term RELATED SAMPLES