Skip to content

Debounce seeks while scrubbing the SeekBar - #149

Open
MattiasBuelens wants to merge 3 commits into
feature/tv-seekbar-center-playfrom
feature/debounce-seek
Open

MattiasBuelens wants to merge 3 commits into
feature/tv-seekbar-center-playfrom
feature/debounce-seek

Conversation

@MattiasBuelens

Copy link
Copy Markdown
Collaborator

Summary

While scrubbing the SeekBar, SeekBarState.onValueChange used to set player.currentTime on every position change: once per drag frame on mobile, and once per key repeat on TV. That loaded media for positions that were only scrubbed past.

Now the player only seeks in two cases:

  • the scrub position stays the same for 250 ms;
  • the scrub finishes (onValueChangeFinished). This seek is skipped if the debounced seek already went to the same position.

seekTo (a single TV Left/Right press, or a tap) still seeks immediately.

Without the intermediate seeks, PlaybackTimeState wouldn't know where the user is scrubbing to. To solve that, SeekBarState now extends PlaybackTimeState:

open class PlaybackTimeState internal constructor(player: Player?) {
    open val currentTime: Double get() = playerTime
}
class SeekBarState internal constructor(player: Player?) : PlaybackTimeState(player) {
    val scrubTime: Double?                             // absolute scrub position, or null
    override val currentTime get() = scrubTime ?: playerTime
}
  • Explicit wiring: CurrentTimeDisplay(state = seekBarState) follows the thumb.
  • Default overloads: UIControllerCore remembers one SeekBarState and provides it as LocalUIControllerSeekBarState (@InternalUiApi).
    • The default SeekBar() overloads use it through rememberUIControllerSeekBarState(player).
    • rememberPlaybackTimeState(player) returns it when it belongs to the same player.
    • So SeekBar() and CurrentTimeDisplay() inside a UIController share one state.

Stacked on #148.

Link to Devin session: https://dolby.devinenterprise.com/sessions/63210218adb6456ab0406d4eb65d28e9
Open in Devin Desktop: https://dolby.devinenterprise.com/desktop/session/63210218adb6456ab0406d4eb65d28e9?variant=devin
Requested by: @MattiasBuelens

SeekBarState now extends PlaybackTimeState, so time displays can show
the position being scrubbed to. UIController provides its SeekBarState
to the default SeekBar and time display overloads.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@MattiasBuelens
MattiasBuelens added this pull request to stack #150 October 23, 2026 13:47
@MattiasBuelens MattiasBuelens added the bug Something isn't working label Oct 23, 2026
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants