ExoPlayer , Loop Ended/ Started listener for LoopingMediaSource

Viewed 2157

I am using ExoPlayer for playing video in loop, but before source video is started each loop I need to reset some states of my Layout. I know ExoPlayer is calling onPlayerStateChanged with ExoPlayer.STATE_ENDED paramter when video is ended for usual MediaSources, but it is not called for LoopingMediaSource.

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    if (playbackState == ExoPlayer.STATE_ENDED) {
        showControls();
        resetLayoutStates(); //I need it here, even in LoopingMediaSource
    }
    updateButtonVisibilities();
}

Does the Exoplayer have any Callback when Source is restarted or ended in loop ? Or does it have any workaround for my situation ?

0 Answers
Related