feat(player): drop to native sizing after 1080p latches (full-size YouTube controls)

Two-phase HD: phase 1 keeps the fixed 1920x1080 iframe scaled down to latch
1080p; once the quality poll sees hd1080, switch to native responsive sizing so
YouTube renders its own controls (the gear especially) at full size instead of
scaled-down. A latched pick survives the shrink on a normal VOD.

CONDITIONAL / under observation: on one was_live stream in dev, quality dropped
hd1080 -> 480p ~2s after going native (YouTube re-caps to the small viewport);
held 1080p elsewhere. Gated behind HD_DROP_TO_NATIVE so phase 2 can be turned
off in one line to fall back to the guaranteed-1080p permanent-scale phase 1.
This commit is contained in:
2026-07-31 05:47:20 +02:00
parent 8349f9338c
commit 8f1d576341
2 changed files with 96 additions and 24 deletions
+5
View File
@@ -15,6 +15,11 @@ export interface YTPlayer {
getDuration(): number;
getVideoData(): YTVideoData;
getIframe(): HTMLIFrameElement;
// Current latched playback quality (e.g. "hd1080") — used to detect when to drop the HD-latch
// iframe from its scaled-up size to native sizing. `setPlaybackQuality` is deliberately NOT typed:
// YouTube retired it (a hard no-op) — see [[reference-yt-iframe-api-remote-control-map]].
getPlaybackQuality(): string;
setSize(width: number, height: number): void;
getVolume(): number;
isMuted(): boolean;
setVolume(volume: number): void;