Files
party-player/public/player/index.html
T
simonandClaude Opus 5 ce1a6d6a47 Cycle the frame through animations, add a corners effect
The frame had exactly one behaviour, started once and run forever. Make
animations a start(context) => stop() lifecycle held in a registry, and
draw a new one on every completed crossfade.

Selection uses a shuffle bag: each animation comes up exactly once per
pass, so they stay evenly used, and a swap at the pass boundary keeps the
same one from running twice in a row. Written for a registry larger than
today's two entries.

The new corners animation parks the frame in a random corner and drops a
screenshot of it into the next of the other three corners every 5s, going
clockwise. The frame's own corner is never a slot, so a still cannot
cover it by construction rather than by clamping. This holds while
FRAME_SCALE stays under 0.5, now noted where that knob lives.

Screenshots need getDisplayMedia: the decks are cross-origin YouTube
iframes, so canvas taints and there is no other way to read the playing
pixels. The prompt has to be requested before start() yields, or the
click's transient activation is gone. Declining, or serving over plain
HTTP where mediaDevices is undefined, leaves the frame parked without
stills instead of failing.

The capture sink is a 1x1 element in the document, like #probe: detached
video elements are never composited and get throttled hard enough to make
every screenshot seconds stale.

startBounce also gains the stop() it always needed — it was leaking its
rAF loop and resize listener, and a queued frame would fight whichever
animation came next.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tg15tLAuT6NrCE1ZxKVgDB
2026-08-09 22:04:33 +02:00

41 lines
1.3 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Party Player</title>
<link rel="stylesheet" href="/player/player.css" />
</head>
<body>
<div id="backgrounds"></div>
<!-- Frozen screenshots of the frame. A sibling, not a child, of #frameMover:
these are positioned against the screen, not the moving frame. -->
<div id="stills"></div>
<!-- #frameMover owns the motion transform and nothing else, so future
animations can nest their own transform layers without conflict. -->
<div id="frameMover">
<div id="frameSkin">
<div class="deck" data-deck="a"><div id="deck-a"></div></div>
<div class="deck" data-deck="b"><div id="deck-b"></div></div>
</div>
</div>
<!-- Offscreen, muted, 1x1: cues queued videos purely to read their length. -->
<div id="probe"><div id="probe-player"></div></div>
<div id="gate">
<div class="gate-inner">
<h1>Party Player</h1>
<p id="gate-hint">Loading queue…</p>
<button id="start" type="button" disabled>Start</button>
</div>
</div>
<div id="status" hidden>reconnecting…</div>
<script type="module" src="/player/player.js"></script>
</body>
</html>