From fb51163d8ccea0da6c383824caf20c1f8e4f3709 Mon Sep 17 00:00:00 2001 From: rahim Date: Tue, 20 Jan 2026 12:11:40 +1100 Subject: [PATCH] docs(plan): player api design (#300) --- .claude/plans/player-api/architecture.md | 301 +++++++++++++++ .claude/plans/player-api/decisions.md | 272 +++++++++++++ .claude/plans/player-api/examples.md | 465 +++++++++++++++++++++++ .claude/plans/player-api/index.md | 290 ++++++++++++++ 4 files changed, 1328 insertions(+) create mode 100644 .claude/plans/player-api/architecture.md create mode 100644 .claude/plans/player-api/decisions.md create mode 100644 .claude/plans/player-api/examples.md create mode 100644 .claude/plans/player-api/index.md diff --git a/.claude/plans/player-api/architecture.md b/.claude/plans/player-api/architecture.md new file mode 100644 index 00000000..aa676bd0 --- /dev/null +++ b/.claude/plans/player-api/architecture.md @@ -0,0 +1,301 @@ +# Architecture + +Internal structure of the Player API. + +## Overview + +``` + createPlayer() + config: presets.website | { features: [...] } + │ + filters by feature.type + │ + ┌───────────────┴───────────────┐ + ▼ ▼ + ┌────────────────────────┐ ┌────────────────────────┐ + │ createStore() │ │ createStore() │ + │ type: 'media' │ │ type: 'player' │ + └────────────────────────┘ └────────────────────────┘ + │ │ + ▼ ▼ + ┌────────────────────────┐ ┌────────────────────────┐ + │ Media Store │◄─────│ Player Store │ + │ target: MediaTarget │ │ target: PlayerTarget │ + │ │ │ │ + │ state: paused, volume │ │ state: isFullscreen │ + │ request: play, pause │ │ request: toggleFS │ + └────────────────────────┘ └────────────────────────┘ + │ + target.media.getFeature() + │ + ┌───────────┴───────────┐ + ▼ ▼ + Read media state Call media requests + (iOS fallback) (keyboard shortcuts) +``` + +**Key insight:** Player Store's target includes a reference to the Media Store. This enables coordination without tight coupling. + +## Two Stores + +### Why Two Stores + +| Reason | Explanation | +| --------------------- | --------------------------------------------------------------------------------------------------- | +| **Different targets** | Media features target `MediaTarget`. Player features target `PlayerTarget`. | +| **Attachment timing** | `