I am trying to play videos in the form of a playlist one after the other. I am using android Exoplayer to play my files, but there are no listeners in mediaplayer to listen to an end of the media file. Is there a way to listen to the end of media file using exoplayer.
You can do this: playerExo. addListener(new ExoPlayer. Listener() { @Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { switch(playbackState) { case ExoPlayer.
You can use exoplayer. getPlayWhenReady() to check whether the player is currently in a pause state or playing state.
ExoPlayer is an app-level media player built on top of low-level media APIs in Android. It is an open source project used by Google apps, including YouTube and Google TV.
I know this is old, but just to expand on the accepted answer:
exoPlayer.addListener(this); ..... @Override public void onPlayerStateChanged(boolean playWhenReady, int state) { if (state == ExoPlayer.STATE_ENDED){ //player back ended } }
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With