'Exoplayer Next button not clickable when Repeat Mode is REPEAT_MODE_ONE at the last video

I am using exoplayer 2.12 and when i reach the last video in the timeline and player.repeatMode = Player.REPEAT_MODE_ONE then Next button is not clickable . What i want is to make some action at that point of time to make next button clickable.



Solution 1:[1]

You can override the below method of the Player interface.

override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
       super.onMediaItemTransition(mediaItem, reason)
       val currentIndex = currentWindowIndex
       // check if currentIndex is the last item by comparing with 
       // exoPlayer.mediaItemCount
}

This method is called every time the player is switched to a new item or the playlist is changed. You can set the repeatMode = Player.REPEAT_MODE_ALL if the item is last one in the playlist.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kalpesh Chandora