From d1c01a6bc3e6effd7e375a47eec13e74a3159549 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Tue, 28 Jul 2026 01:33:04 +0200 Subject: [PATCH] feat(player): defer single tap so a double tap doesn't also toggle pause MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A tap cannot be classified when it lands — it may still turn out to be the first half of a double tap. Play/pause is therefore deferred until the 300ms double-tap window closes, and cancelled outright if a second tap arrives, so a double tap seeks without also toggling pause. Forward skip moves from 10s to 30s (back stays 10s), for both double tap and the keyboard arrows. The timing rules live in tapGestures.ts so they are unit-testable without mounting the player. Rapid double taps now chain off a still-in-flight seek target instead of all resolving against the same not-yet-updated position. TRACES: UR-005, UR-061 | DR-092 | UT-085, UT-086, UT-087, UT-088 --- docs/ux-flows.md | 6 +- src/lib/components/player/VideoPlayer.svelte | 134 ++++++++++----- src/lib/components/player/tapGestures.test.ts | 158 ++++++++++++++++++ src/lib/components/player/tapGestures.ts | 128 ++++++++++++++ 4 files changed, 384 insertions(+), 42 deletions(-) create mode 100644 src/lib/components/player/tapGestures.test.ts create mode 100644 src/lib/components/player/tapGestures.ts diff --git a/docs/ux-flows.md b/docs/ux-flows.md index 1ce04e62..9b93f038 100644 --- a/docs/ux-flows.md +++ b/docs/ux-flows.md @@ -346,10 +346,12 @@ flowchart TB **User Interaction:** - **Tap screen:** Controls reappear for 3 seconds - **Double tap left side:** Rewind 10 seconds (shows animated feedback with "-10" indicator) -- **Double tap right side:** Forward 10 seconds (shows animated feedback with "+10" indicator) +- **Double tap right side:** Forward 30 seconds (shows animated feedback with "+30" indicator) +- **Single tap play/pause is deferred** by the 300 ms double-tap window, so a double tap + skips without also toggling pause (UR-061) - **Swipe up/down on left side:** Adjust brightness (0.3-1.7x, shows brightness indicator with progress bar) - **Swipe up/down on right side:** Adjust volume (0-100%, shows volume indicator with progress bar) -- **Keyboard arrows:** ← rewind 10s, → forward 10s (desktop/external keyboard) +- **Keyboard arrows:** ← rewind 10s, → forward 30s (desktop/external keyboard) - **Keyboard space/K:** Toggle play/pause - **Keyboard F:** Toggle fullscreen - **Pinch:** Zoom (planned) diff --git a/src/lib/components/player/VideoPlayer.svelte b/src/lib/components/player/VideoPlayer.svelte index 0a320b70..2977de7f 100644 --- a/src/lib/components/player/VideoPlayer.svelte +++ b/src/lib/components/player/VideoPlayer.svelte @@ -1,4 +1,4 @@ - +