Skip to content

Commit f69b78c

Browse files
committed
fix(producer): derive duration from sub-composition timing when root has no data-duration
When the root element lacks an explicit data-duration attribute and there is no GSAP timeline, getDeclaredDuration now computes max(data-start + data-duration) across all sub-compositions instead of returning zero.
1 parent f622e5a commit f69b78c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/producer/src/services/fileServer.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,15 @@ const HF_BRIDGE_SCRIPT = `(function() {
474474
var root = document.querySelector('[data-composition-id]');
475475
if (!root) return 0;
476476
var d = Number(root.getAttribute('data-duration'));
477-
return Number.isFinite(d) && d > 0 ? d : 0;
477+
if (Number.isFinite(d) && d > 0) return d;
478+
var comps = document.querySelectorAll('[data-composition-src]');
479+
var maxEnd = 0;
480+
for (var i = 0; i < comps.length; i++) {
481+
var start = Number(comps[i].getAttribute('data-start')) || 0;
482+
var dur = Number(comps[i].getAttribute('data-duration')) || 0;
483+
if (dur > 0) maxEnd = Math.max(maxEnd, start + dur);
484+
}
485+
return maxEnd;
478486
}
479487
function seekSameOriginChildFrames(frameWindow, nextTimeMs) {
480488
var frames;

0 commit comments

Comments
 (0)