From 6c440fc437ea1a4c170937b40cbe9845d6a59a34 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 23 Aug 2026 19:35:46 +0200 Subject: [PATCH] fix(playback): re-sync embedded MPV bounds on position-only layout shifts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An ancestor re-layout can translate the player host without resizing it (sidebar content settling, EPG panel loading below the player). ResizeObserver reports size changes only and no DOM event observes "position changed", so the native child window silently kept its stale coordinates and rendered offset from the DOM stage. The session controller now polls the host bounds every 500 ms while a session is active, compares them against the last synced bounds with a half-pixel tolerance, and re-syncs only on drift — idle cost is one getBoundingClientRect per tick with no IPC. Fixes #1428 Co-Authored-By: Claude Fable 5 --- .../playback-embedded-mpv-position-drift.md | 10 + CLAUDE.md | 2 +- docs/architecture/embedded-mpv-native.md | 10 + ...ed-mpv-session-controller.position.spec.ts | 180 ++++++++++++++++++ .../embedded-mpv-session-controller.ts | 49 ++++- 5 files changed, 246 insertions(+), 5 deletions(-) create mode 100644 .changes/playback-embedded-mpv-position-drift.md create mode 100644 libs/ui/playback/src/lib/embedded-mpv-player/embedded-mpv-session-controller.position.spec.ts diff --git a/.changes/playback-embedded-mpv-position-drift.md b/.changes/playback-embedded-mpv-position-drift.md new file mode 100644 index 000000000..6da47542f --- /dev/null +++ b/.changes/playback-embedded-mpv-position-drift.md @@ -0,0 +1,10 @@ +--- +type: fix +area: playback +issues: [1428] +--- + +The embedded MPV video no longer drifts out of its frame when the layout +shifts around it — for example when the channel sidebar or the EPG panel +finishes loading after playback has started. The player now notices such +moves and snaps the video back into place within half a second. diff --git a/CLAUDE.md b/CLAUDE.md index 2f8892bb7..e0ae2581a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -968,7 +968,7 @@ app as a real argument, so it is not an option. API. Radio's `