Skip to content

feat: Fire TV and Bluetooth media remote keys in the player (#68 part) - #133

Merged
ProdigyV21 merged 1 commit into
mainfrom
feat/fire-tv-media-keys
Apr 5, 2026
Merged

feat: Fire TV and Bluetooth media remote keys in the player (#68 part)#133
ProdigyV21 merged 1 commit into
mainfrom
feat/fire-tv-media-keys

Conversation

@ProdigyV21

Copy link
Copy Markdown
Owner

Closes the Fire TV remote part of #68. (Subtitle timing sync is in PR #108; in-player episode picker is scoped separately.)

Problem

On Fire TV Stick and Bluetooth media remotes, the dedicated FF/RW/Play/Pause/Next/Prev buttons did nothing during playback. Only Key.MediaPlayPause / MediaPlay / MediaPause were handled in PlayerScreen.kt, and only inside the if (showSubtitleMenu) branch \u2014 so media keys were silently dropped unless the user had already opened the audio/subtitle menu, which is the opposite of the normal use case.

Fix

Added a top-level media-key dispatch at the very start of the player .onKeyEvent handler, BEFORE the error / menu / overlay branches. Each key returns true immediately so it always wins regardless of which overlay is open.

Key Action
MediaPlayPause Toggle play/pause
MediaPlay Play
MediaPause Pause
MediaStop Pause + exit player
MediaRewind -10s (uses existing queueControlsSeek)
MediaFastForward +10s
MediaNext Next episode (TV only, reuses existing onPlayNext lambda \u2014 same binge-group / source-preservation logic as the in-UI Next Episode button)
MediaPrevious Previous episode (TV only, guarded by episodeNumber > 1)

Single file, 69 lines added, 0 removed. The existing MediaPlayPause branch inside the subtitle menu is left as a harmless safety net \u2014 it becomes unreachable in practice but protects against future regressions to the top handler.

Test plan

  • Fire TV Stick: open the player, test all 8 media buttons on the stock Alexa remote.
  • Android phone with a Bluetooth keyboard: test the multimedia row (F7/F8/F9/F10 on most keyboards map to these KeyEvents).
  • TV D-pad: verify existing D-pad/Enter/Back navigation still works (the new handler only returns true for media keys, other keys fall through to the existing handlers).

Reported: "On Fire Stick the remote button rewind/ffwd/play/pause
buttons don't work with the player."

Root cause: Only `Key.MediaPlayPause` / `MediaPlay` / `MediaPause` was
handled in PlayerScreen.kt, and only inside the `if (showSubtitleMenu)`
branch \u2014 so media keys did nothing unless the user had already opened
the audio/subtitle menu. `Key.MediaRewind`, `MediaFastForward`,
`MediaNext`, `MediaPrevious`, and `MediaStop` were not handled at all,
anywhere.

Fire TV Stick remotes ship with dedicated FF/RW/Play buttons and Amazon
explicitly recommends apps handle them via the standard KeyEvent
constants. Bluetooth A2DP headsets and keyboards also produce these
keys. ARVIO was dropping all of them on the floor.

Fix: add a top-level media-key dispatch at the very start of the player
`.onKeyEvent` handler, BEFORE the error / menu / overlay branches. Each
key returns `true` immediately so it always wins regardless of whether
a menu is open. Handles:

- `Key.MediaPlayPause` \u2192 toggle play/pause, show controls.
- `Key.MediaPlay` \u2192 play, show controls.
- `Key.MediaPause` \u2192 pause, show controls.
- `Key.MediaStop` \u2192 pause and exit the player (equivalent to Back).
- `Key.MediaRewind` \u2192 seek back 10 seconds via existing queueControlsSeek.
- `Key.MediaFastForward` \u2192 seek forward 10 seconds.
- `Key.MediaNext` \u2192 jump to the next episode (TV only). Uses the same
  onPlayNext lambda the existing Next Episode button uses, so the
  binge-group / source-preservation logic is identical.
- `Key.MediaPrevious` \u2192 jump to the previous episode (TV only, guarded
  by `episodeNumber > 1`).

The existing `Key.MediaPlayPause` branch inside the subtitle menu
remains in place as a harmless safety net \u2014 it becomes unreachable in
practice because the top-level dispatch already returns true, but
leaving it means a future change to the top handler can't accidentally
break media keys inside the subtitle menu.

Closes the Fire TV remote part of #68. The other parts of #68
(subtitle timing sync, in-player episode picker) are scoped
separately. Subtitle offset is already being shipped in PR #108.
@ProdigyV21
ProdigyV21 merged commit 6b4c435 into main Apr 5, 2026
2 checks passed
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