From 7a3d5eae5668f65c57ecf361726a829ab6e66919 Mon Sep 17 00:00:00 2001 From: 4gray <4gray@users.noreply.github.com> Date: Thu, 27 Aug 2026 08:35:34 +0200 Subject: [PATCH] fix(playback): re-sync embedded MPV bounds on position-only layout shifts (#1476) 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. The interval is registered via NgZone.runOutsideAngular and never re-enters the zone, so zone change detection does not run every tick for the whole stream. Frame-copy sessions skip the measurement entirely: the canvas is laid out by the DOM and moves with the layout, so only the native-view child window can go stale on a position-only shift. Fixes #1428 Co-Authored-By: Claude Fable 5 --- .../playback-embedded-mpv-position-drift.md | 10 + CLAUDE.md | 2 +- docs/architecture/embedded-mpv-native.md | 16 ++ ...ed-mpv-session-controller.position.spec.ts | 257 ++++++++++++++++++ .../embedded-mpv-session-controller.ts | 66 ++++- 5 files changed, 346 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 ab4c7e62d..cc40fc23f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -970,7 +970,7 @@ app as a real argument, so it is not an option. API. Radio's `