Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wahdatjan opened this issue Feb 11, 2022 · 3 comments
Assignees
Labels

Comments

@wahdatjan
Copy link

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.

@ojw28
Copy link
Contributor

ojw28 commented Feb 12, 2022

It's working as intended that the next button is not clickable when using REPEAT_MODE_ONE and positioned on the last video in the timeline. You will likely need to implement your own UI components instead if you want different behavior (you're obviously able to fork the ones provided by the ExoPlayer UI module as a starting point).

@ojw28 ojw28 closed this as completed Feb 12, 2022
@ojw28
Copy link
Contributor

ojw28 commented Feb 12, 2022

Actually, if you were to use ExoPlayer 2.16 or newer, you'd be able to achieve this using ForwardingPlayer:

// Wrap your player in a ForwardingPlayer
Player customPlayer = new ForwardingPlayer(player) {

    // Overrides to always enable COMMAND_SEEK_TO_NEXT

    @Override
    public Commands getAvailableCommands() {
      return getWrappedPlayer()
          .getAvailableCommands()
          .buildUpon()
          .add(COMMAND_SEEK_TO_NEXT)
          .build();
    }

    @Override
    public boolean isCommandAvailable(@Command int command) {
      return player.isCommandAvailable(command) || command == COMMAND_SEEK_TO_NEXT;
    }

    // Override to implement your custom action when seeking.

    @Override
    public void seekToNext() {
      if (getWrappedPlayer().hasNextMediaItem()) {
        // Dispatch to the wrapped player if not at the final media item
        getWrappedPlayer().seekToNextMediaItem();
      } else {
        // TODO: Implement your custom action here.
      }
    }
};

// Provide the ForwardingPlayer to the UI components
playerView.setPlayer(customPlayer);

@wahdatjan
Copy link
Author

wahdatjan commented Feb 12, 2022

@ojw28 I cant move to latest version instantly . I use an interface to listen to the click on last video and make REPEAT_MODE_ALL

@google google locked and limited conversation to collaborators Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants