Skip to content

Show controls on key press and handle media keys - #122

Open
MattiasBuelens wants to merge 5 commits into
feature/tv-ui-commonfrom
feature/tv-keyboard
Open

MattiasBuelens wants to merge 5 commits into
feature/tv-ui-commonfrom
feature/tv-keyboard

Conversation

@MattiasBuelens

Copy link
Copy Markdown
Collaborator

Summary

Adds keyboard and remote key handling to UIController. Tablets with a hardware keyboard get it, and so will the upcoming TV UI. The logic lives in android-ui-common, so the TV UIController can reuse it:

@InternalUiApi
fun Modifier.handlePlayerKeys(
    player: Player?,              // THEOplayer's native Player
    controlsVisible: () -> Boolean,
    showControls: () -> Unit,
    seekOffset: Int = 10
): Modifier                       // onPreviewKeyEvent, KeyDown only
  • Media keys (MEDIA_PLAY_PAUSE, MEDIA_PLAY, MEDIA_PAUSE, MEDIA_FAST_FORWARD, MEDIA_REWIND) show the controls and act right away, even while the controls are hidden. Fast-forward and rewind seek ±10 s, clamped like SeekButtonState.onClick(). They do nothing during ads or when the duration is unknown.
  • Other system keys (Back, volume, …) are left alone, so they fall through to the app.
  • Any other key shows the controls and resets the auto-hide timer.
    • If the controls were hidden, the key is consumed, so it doesn't activate a control the user can't see.
    • If they were visible, the key passes through to the focused control.

The mobile UIControllerImpl applies handlePlayerKeys on its PlayerContainer, next to toggleControlsOnTap.

Keys only arrive while something inside the player has focus.

PlayerKeysTest (Robolectric) covers each rule. It also sends a key through the activity to check that a key from a focused control inside the controls' ComposeView reaches the modifier on the outer PlayerContainer.

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

@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

@MattiasBuelens
MattiasBuelens added this pull request to stack #123 October 14, 2026 14:16
MattiasBuelens and others added 5 commits October 15, 2026 11:05
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant