Skip to content

Toggle play/pause with Center on the TV SeekBar - #148

Open
MattiasBuelens wants to merge 3 commits into
developfrom
feature/tv-seekbar-center-play
Open

MattiasBuelens wants to merge 3 commits into
developfrom
feature/tv-seekbar-center-play

Conversation

@MattiasBuelens

@MattiasBuelens MattiasBuelens commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

TV DefaultUI focuses the SeekBar when the controls appear, so Left/Right seek right away. Until now, Center did nothing on the seek bar, so to pause you first had to move focus down to the play button. Google's "Playback controls on TV" guide says Center should toggle play/pause, so the TV SeekBar now does that for Center, Enter and NumPad Enter.

  • New SeekBarState.togglePlayPause() in ui-common. It plays or pauses the player. While the user is scrubbing, it doesn't touch the player and instead flips whether playback resumes in onValueChangeFinished(), so it doesn't fight the pause that scrubbing does.
    fun togglePlayPause() {
        if (seekTime != null) wasPlayingBeforeSeek = !wasPlayingBeforeSeek
        else if (player.isPaused) player.play() else player.pause()
    }
  • TV SeekBar(state) calls state.togglePlayPause() on a KeyDown with repeatCount == 0. Repeats from a held key are consumed but don't toggle again.
  • The seek bar only consumes a KeyUp that follows its own KeyDown. While the controls are hidden, tvHiddenControlsKeys consumes the Center KeyDown: it shows the controls and toggles playback. The seek bar may get focus before the KeyUp arrives, and ignoring that KeyUp means playback isn't toggled a second time.

Tests:

  • SeekBarStateTest covers toggling normally and during a scrub.
  • SeekBarTest covers Center and Enter, holding Center, and a KeyUp without a KeyDown.
  • DefaultUITest covers Center on the focused seek bar, and a full Center press while the controls are hidden, which toggles exactly once.

The TV guides and the changelog are updated.

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

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 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