From d30769430708a8e65aed14de117955456217273f Mon Sep 17 00:00:00 2001
From: Ragulsundaram <41433645+Ragulsundaram@users.noreply.github.com>
Date: Fri, 13 Nov 2026 08:26:23 -0800
Subject: [PATCH 1/2] Spec: inside a Sequence,
useVideoConfig().durationInFrames is the Sequence's length (its own, cut
short where its parent's ends; a Loop's children get one pass), as Remotion's
public docs for useVideoConfig say, and its conformance test (#126, from
#128)
---
sdk/raea/conformance/timeline.test.tsx | 11 +++++++++++
sdk/raea/spec/motion.feature | 4 +++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/sdk/raea/conformance/timeline.test.tsx b/sdk/raea/conformance/timeline.test.tsx
index 6de06f81..c068d15d 100644
--- a/sdk/raea/conformance/timeline.test.tsx
+++ b/sdk/raea/conformance/timeline.test.tsx
@@ -99,6 +99,17 @@ describe("useVideoConfig and AbsoluteFill", () => {
at(0, );
expect(cfg).toMatchObject({ width: 540, height: 960 });
});
+ test("inside a Sequence, durationInFrames is the Sequence's", () => {
+ const d: Record = {};
+ function Read({ id }: { id: string }) { d[id] = useVideoConfig().durationInFrames; return null; }
+ at(15, );
+ at(15, );
+ at(275, );
+ at(45, );
+ at(5, );
+ at(5, );
+ expect(d).toEqual({ own: 20, open: 290, cut: 50, nested: 35, loop: 12, freeze: 300 });
+ });
test("AbsoluteFill renders its children", () => {
at(3, );
expect(seen.a).toBe(3);
diff --git a/sdk/raea/spec/motion.feature b/sdk/raea/spec/motion.feature
index 53a4f24b..39572af3 100644
--- a/sdk/raea/spec/motion.feature
+++ b/sdk/raea/spec/motion.feature
@@ -21,7 +21,9 @@ Feature: raea, the behaviour of its API
And defaultProps are JSON-like values handed to the component as its props
Scenario: What a component can ask
Then `useVideoConfig()` returns {id, width, height, fps, durationInFrames, defaultProps} of the composition it is
- rendered in (a Sequence given width and height reports those to its children instead)
+ rendered in (a Sequence given width and height reports those to its children instead, and inside a
+ Sequence durationInFrames is the Sequence's: its own, cut short where its parent's ends; a Loop's children
+ get one pass)
And `useCurrentFrame()` returns the frame being rendered, measured from the start of the nearest enclosing
Sequence (the composition's frame outside any Sequence)
Scenario: AbsoluteFill
From 5911de126c95ff56d95ecaa296b93b0126dbbe3a Mon Sep 17 00:00:00 2001
From: shinyobjectz
Date: Fri, 13 Nov 2026 08:28:11 -0800
Subject: [PATCH 2/2] Inside a Sequence, useVideoConfig().durationInFrames is
the Sequence's length (#126): a subtree's LocalTime carries its length, the
composition's at the root, a Sequence's own cut where its parent's ends
(unbounded, what's left of its parent's), a Loop's one pass, and a Freeze
keeps its parent's; useVideoConfig reports it as it reports a Sequence's
width and height, and a Sequence's time is still the same object frame to
frame. Written from the spec line and its conformance test (#128):
conformance 615 pass, the same five failing as on main
---
sdk/app/src/clock.tsx | 17 +++++++++++------
sdk/video/src/timeline.tsx | 21 +++++++++++++++------
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/sdk/app/src/clock.tsx b/sdk/app/src/clock.tsx
index c4c19caf..4f0e4368 100644
--- a/sdk/app/src/clock.tsx
+++ b/sdk/app/src/clock.tsx
@@ -87,6 +87,9 @@ export interface LocalTime {
width: number;
/** in px, what the Sequence gives its children */
height: number;
+ /** frames the subtree runs for from its frame 0, which useVideoConfig reports as durationInFrames: a Sequence's own
+ * length cut where its parent's ends, a Loop's one pass, the composition's at the root */
+ duration: number;
}
export const ClockContext = createContext(null);
@@ -198,8 +201,9 @@ export function useLocalTime(caller: string): LocalTime {
useClockTick(local ? null : clock);
if (local) return local;
let t = rootTimes.get(clock);
- if (!t || t.frame !== clock.frame || t.width !== clock.config.width || t.height !== clock.config.height) {
- t = { frame: clock.frame, origin: 0, width: clock.config.width, height: clock.config.height };
+ const c = clock.config;
+ if (!t || t.frame !== clock.frame || t.width !== c.width || t.height !== c.height || t.duration !== c.durationInFrames) {
+ t = { frame: clock.frame, origin: 0, width: c.width, height: c.height, duration: c.durationInFrames };
rootTimes.set(clock, t);
}
return t;
@@ -210,12 +214,13 @@ export function useCurrentFrame(): number {
return useLocalTime("useCurrentFrame").frame;
}
-/** The settings of the composition being rendered (a Sequence's width and height win inside it). */
+/** The settings of the composition being rendered (inside a Sequence, its width, height and length win). */
export function useVideoConfig(): VideoConfig {
const clock = useClockState("useVideoConfig");
const local = useContext(LocalTimeContext);
- if (!local || (local.width === clock.config.width && local.height === clock.config.height)) return clock.config;
- return { ...clock.config, width: local.width, height: local.height };
+ const c = clock.config;
+ if (!local || (local.width === c.width && local.height === c.height && local.duration === c.durationInFrames)) return c;
+ return { ...c, width: local.width, height: local.height, durationInFrames: local.duration };
}
export interface ClockProps {
@@ -303,7 +308,7 @@ export function Clock(props: ClockProps) {
if (!LITE) return {props.children};
return (
- {props.children}
+ {props.children}
);
}
diff --git a/sdk/video/src/timeline.tsx b/sdk/video/src/timeline.tsx
index d61b3330..da40ecfb 100644
--- a/sdk/video/src/timeline.tsx
+++ b/sdk/video/src/timeline.tsx
@@ -115,11 +115,11 @@ function StopsAt(props: { end: number; children?: ReactNode }) {
}
/** The same LocalTime object as last render when nothing in it changed (a Freeze's subtree, a held frame). */
-function useStableTime(frame: number, origin: number, width: number, height: number): LocalTime {
+function useStableTime(frame: number, origin: number, width: number, height: number, duration: number): LocalTime {
const r = useRef(null);
const p = r.current;
- if (p && p.frame === frame && p.origin === origin && p.width === width && p.height === height) return p;
- return (r.current = { frame, origin, width, height });
+ if (p && p.frame === frame && p.origin === origin && p.width === width && p.height === height && p.duration === duration) return p;
+ return (r.current = { frame, origin, width, height, duration });
}
/** Shifts time by `from` and shows its children only for `durationInFrames` frames. */
@@ -149,7 +149,12 @@ export function Sequence(props: SequenceProps) {
const p = r.current;
const w = width ?? parent.width;
const h = height ?? parent.height;
- const time: LocalTime = p && p.frame === f - from && p.origin === parent.origin + from && p.width === w && p.height === h ? p : (r.current = { frame: f - from, origin: parent.origin + from, width: w, height: h });
+ // its length: its own, cut where its parent's ends (unbounded, what's left of the parent's)
+ const d = Math.min(durationInFrames, parent.duration - from);
+ const time: LocalTime =
+ p && p.frame === f - from && p.origin === parent.origin + from && p.width === w && p.height === h && p.duration === d
+ ? p
+ : (r.current = { frame: f - from, origin: parent.origin + from, width: w, height: h, duration: d });
const base = timeBase(pbase.origin + from, pbase.freeze === null ? null : pbase.freeze - from);
// no box: the new time around the children here, as Shifted would put it (a game's sound cues, a component less each)
if (layout === "none" && style === undefined && className === undefined) {
@@ -259,7 +264,11 @@ export function Loop(props: LoopProps) {
const lf = f - pass * durationInFrames;
const lo = parent.origin + pass * durationInFrames;
const p = r.current;
- const time: LocalTime = p && p.frame === lf && p.origin === lo && p.width === parent.width && p.height === parent.height ? p : (r.current = { frame: lf, origin: lo, width: parent.width, height: parent.height });
+ // its children's length is one pass
+ const time: LocalTime =
+ p && p.frame === lf && p.origin === lo && p.width === parent.width && p.height === parent.height && p.duration === durationInFrames
+ ? p
+ : (r.current = { frame: lf, origin: lo, width: parent.width, height: parent.height, duration: durationInFrames });
const base = timeBase(pbase.origin + pass * durationInFrames, pbase.freeze === null ? null : pbase.freeze - pass * durationInFrames);
return (
@@ -280,7 +289,7 @@ export function Freeze(props: FreezeProps) {
checkFinite("Freeze", "frame", props.frame);
const parent = useLocalTime("Freeze");
const pbase = useContext(TimeBaseContext);
- const time = useStableTime(props.frame, parent.origin, parent.width, parent.height);
+ const time = useStableTime(props.frame, parent.origin, parent.width, parent.height, parent.duration);
return (
{props.children}