media icon indicating copy to clipboard operation
media copied to clipboard

Easier reusability of TimeBar core logic

Open vanniktech opened this issue 3 years ago • 0 comments

[REQUIRED] Use case description

Writing my own Player UI with my own controls for my Podcast app. While Timebar has some good configuration options, the internal logic of calculating the time and scrubbing is implemented inside PlayerControlView.

It's quite a lot:

  • https://github.com/androidx/media/blob/fe0cf0528318abf1a9a7a8f75bcce402235f961a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java#L277-L281
  • https://github.com/androidx/media/blob/fe0cf0528318abf1a9a7a8f75bcce402235f961a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java#L316-L320
  • https://github.com/androidx/media/blob/fe0cf0528318abf1a9a7a8f75bcce402235f961a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java#L1156-L1272
  • https://github.com/androidx/media/blob/fe0cf0528318abf1a9a7a8f75bcce402235f961a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java#L1541-L1559

Plus a few other variables.

Proposed solution

TimeBarDelegate which contains all of this logic and can be used outside the PlayerControlView class.

Alternatives considered

Copy pasting everything, which is what I'm doing now.

vanniktech avatar Aug 16 '22 22:08 vanniktech