From 20390c9efb4508aaaf7a40fd8cdcc60e80a4ef0a Mon Sep 17 00:00:00 2001 From: madeofpendletonwool Date: Thu, 15 Oct 2026 09:16:07 -0500 Subject: [PATCH] web: treat MediaPlayPause as play/pause on the big screen --- web/src/lib/shortcuts.test.ts | 2 ++ web/src/lib/shortcuts.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/lib/shortcuts.test.ts b/web/src/lib/shortcuts.test.ts index 73815c6..7702cc0 100644 --- a/web/src/lib/shortcuts.test.ts +++ b/web/src/lib/shortcuts.test.ts @@ -67,6 +67,7 @@ describe('tvKeyOf', () => { it('maps the keys', () => { expect(tv(' ')).toBe('playPause') + expect(tv('MediaPlayPause')).toBe('playPause') expect(tv('ArrowRight')).toBe('skip') expect(tv('ArrowUp')).toBe('previousLook') expect(tv('ArrowDown')).toBe('nextLook') @@ -85,6 +86,7 @@ describe('tvKeyOf', () => { it('stays out of combos, held skips, and typing', () => { expect(tv('ArrowRight', { repeat: true })).toBeUndefined() expect(tv('ArrowDown', { repeat: true })).toBe('nextLook') + expect(tv('MediaPlayPause', { repeat: true })).toBeUndefined() expect(tv('ArrowRight', { altKey: true })).toBeUndefined() expect(tv('ArrowDown', { target: el('') })).toBeUndefined() expect(tv('k', { target: el('') })).toBeUndefined() diff --git a/web/src/lib/shortcuts.ts b/web/src/lib/shortcuts.ts index cecfc10..22f53e4 100644 --- a/web/src/lib/shortcuts.ts +++ b/web/src/lib/shortcuts.ts @@ -66,7 +66,8 @@ export type TvKey = 'playPause' | 'skip' | 'nextLook' | 'previousLook' | 'visual * The big screen's keys: space (or K, even on a button) plays and pauses, → skips (or votes to), * ↑ and ↓ change the visuals, V turns them off and on. A remote's D-pad sends arrows too, so → is * left to move between buttons while one has focus; nothing sits above or - * below them, so ↑ and ↓ are always free. + * below them, so ↑ and ↓ are always free. A Syncphony box's TV remote + * (HDMI-CEC) sends Enter, arrows, Escape and the media key for play/pause. */ export function tvKeyOf(e: Key): TvKey | undefined { if (e.defaultPrevented || isTyping(e.target) || e.metaKey || e.ctrlKey || e.altKey) return undefined @@ -76,6 +77,7 @@ export function tvKeyOf(e: Key): TvKey | undefined { return e.repeat || onControl ? undefined : 'playPause' case 'k': case 'K': + case 'MediaPlayPause': return e.repeat ? undefined : 'playPause' case 'ArrowRight': return e.repeat || onControl ? undefined : 'skip'