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

Add support for setting the max seek to previous position on ExoPlayer.Builder and CastPlayer #1437

Conversation

MGaetan89
Copy link
Contributor

@MGaetan89 MGaetan89 commented Jun 9, 2024

This PR introduces the following changes:

  • Add a new constructor to CastPlayer to provide a maxSeekToPreviousPositionMs argument.
  • Add `ExoPlayer.Builder.setMaxSeekToPreviousPosition(long).
  • Update MediaControllerImplLegacy.getMaxSeekToPreviousPosition() to return the value from controllerInfo.playerInfo.maxSeekToPreviousPositionMs instead of 0.
  • Add TestExoPlayerBuilder.setMaxSeekToPreviousPosition(long).
  • Add TestExoPlayerBuilder.getMaxSeekToPreviousPosition().

Note

This new functionality only allows setting the value at initialisation (for ExoPlayer and CastPlayer). Let me know if I should also add a dedicated setter on these classes (or on Player directly).

Fixes #1425

This method allows customizing the maximum position when using `Player.seekToPrevious()`.

This commit also adds two new methods to `TestExoPlayerBuilder`:
- `setMaxSeekToPreviousPosition(long)`
- `getMaxSeekToPreviousPosition()`
@tonihei tonihei force-pushed the add_exoplayer_setMaxSeekToPreviousPosition branch 2 times, most recently from de26ac5 to 48f36c5 Compare June 14, 2024 16:08
@tonihei
Copy link
Collaborator

tonihei commented Jun 14, 2024

Thanks, I'll merge it internally and you may see some additional commit appearing here in the meantime (mostly formatting changes).

@tonihei tonihei force-pushed the add_exoplayer_setMaxSeekToPreviousPosition branch from 48f36c5 to cd2250b Compare June 14, 2024 16:48
@copybara-service copybara-service bot merged commit 67a7b41 into androidx:main Jun 17, 2024
1 check passed
@MGaetan89 MGaetan89 deleted the add_exoplayer_setMaxSeekToPreviousPosition branch June 17, 2024 13:58
microkatz pushed a commit that referenced this pull request Jun 18, 2024
…viousPosition

PiperOrigin-RevId: 643987403
(cherry picked from commit 67a7b41)
@androidx androidx locked and limited conversation to collaborators Aug 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants