fix(core): prevent double-offset on pip video visibility and media sync#1083
Closed
miguel-heygen wants to merge 1 commit into
Closed
fix(core): prevent double-offset on pip video visibility and media sync#1083miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
When a pip-wired media element has data-start authored in global time inside a sub-composition host, resolveStartForElement adds the host offset a second time. Use the raw data-start for media elements without data-hf-auto-start (explicitly authored, global coordinates) across all three consumers: visibility loop, refreshRuntimeMediaCache, and resolveMediaWindowEndSeconds. Auto-injected timing (data-hf-auto-start) remains composition-local via the resolver. Based on JamesXiaoFF's analysis in #1078.
Fallow audit reportFound 62 findings. Duplication (41)
Health (21)
Generated by fallow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes pip-wired media elements being permanently hidden in preview when their host sub-composition starts at a non-zero time. Applies the fix consistently across all three start-time consumers in the runtime.
Root cause
resolveStartForElementadds the host composition's global start offset on top of the media element's owndata-start. When a pip video hasdata-start="45.40"inside a host atdata-start="45.40", the resolved start becomes 90.80 — well past the host's window, keeping the video permanently hidden.Media elements authored with explicit
data-startuse global coordinates (matching the render pipeline'sdiscoverMediaFromBrowserwhich reads the raw attribute). The resolver's local-to-global accumulation double-counts the offset for these elements.Fix
For media elements (video/audio) without the
data-hf-auto-startmarker, readdata-startdirectly as a global timestamp. Elements withdata-hf-auto-start(compiler-injecteddata-start="0") continue using the resolver since their timing is composition-local.Applied to all three consumers:
init.tsrefreshRuntimeMediaCachestart/duration resolution ininit.tsresolveMediaWindowEndSecondsintimeline.tsTests
Two new tests in
init.test.ts:data-start="45.40"inside host at45.40— visible at t=46, hidden at t=53 and t=44data-start="0"+data-hf-auto-startinside host at10— visible at t=12, hidden at t=5 and t=16All 998 core tests pass.
Attribution
Based on analysis by @JamesXiaoFF in #1078. Supersedes that PR with fixes across all three call sites and the auto-start regression guard.