Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Shorten Series and TransitionSeries timeline bars to their contents

Jonny Burgerfad6dbcafe86
diff --git a/packages/core/src/Sequence.tsx b/packages/core/src/Sequence.tsx
index 89d8053b3c..6bac6f4e0e 100644
--- a/packages/core/src/Sequence.tsx
+++ b/packages/core/src/Sequence.tsx
@@ -555,7 +555,9 @@ const RegularSequenceRefForwardingFunction: React.ForwardRefRenderFunction<
const controlsVideoConfigValues = controls?.videoConfigValues;
const isInsideNonPremountFreeze = useIsInsideNonPremountFreeze();
const autoDuration =
- controlsComponentIdentity === 'dev.remotion.remotion.Series' &&
+ (controlsComponentIdentity === 'dev.remotion.remotion.Series' ||
+ controlsComponentIdentity ===
+ 'dev.remotion.transitions.TransitionSeries') &&
durationInFrames === undefined &&
!loop &&
registeredFrozenFrame === null &&
diff --git a/packages/docs/docs/transitions/transitionseries.mdx b/packages/docs/docs/transitions/transitionseries.mdx
index 6664cc83b3..3dca0f5d44 100644
--- a/packages/docs/docs/transitions/transitionseries.mdx
+++ b/packages/docs/docs/transitions/transitionseries.mdx
@@ -89,6 +89,12 @@ The `<TransitionSeries>` component can only contain `<TransitionSeries.Sequence>
`layout="none"` is deprecated and throws from Remotion 5.0.0 on.
Transition scenes must stay absolutely positioned. Remove the `layout` prop or keep the default `absolute-fill`. See the [v5 migration guide](/docs/5-0-migration).
+#### `durationInFrames?`<AvailableFrom v="4.0.533" />
+
+Limits how long the entire `<TransitionSeries>` is rendered, using the same behavior as [`<Sequence durationInFrames>`](/docs/sequence#durationinframes). It does not change the durations of its scenes or transitions.
+
+By default, the wrapper lasts until the end of its parent sequence or composition. In the Studio, its timeline bar ends at the latest child end, accounting for transition overlaps, offsets, and playback rates. Resizing the wrapper writes an explicit `durationInFrames`; removing it restores the inferred bar length.
+
### `<TransitionSeries.Sequence>`
Inherits the [`durationInFrames`](/docs/sequence#durationinframes), [`playbackRate`](/docs/sequence#playbackrate), [`name`](/docs/sequence#name), [`className`](/docs/sequence#classname), [`style`](/docs/sequence#style), [`showInTimeline`](/docs/sequence#showintimeline), [`freeze`](/docs/sequence#freeze), [`premountFor`](/docs/sequence#premountfor) and [`postmountFor`](/docs/sequence#postmountfor) props from [`<Sequence>`](/docs/sequence).
diff --git a/packages/transitions/src/TransitionSeries.tsx b/packages/transitions/src/TransitionSeries.tsx
index cb70ca12ac..7607463aa7 100644
--- a/packages/transitions/src/TransitionSeries.tsx
+++ b/packages/transitions/src/TransitionSeries.tsx
@@ -5,6 +5,7 @@ import type {
AbsoluteFillLayout,
LayoutAndStyle,
SequenceControls,
+ SequenceProps,
SequencePropsWithoutDuration,
InteractivitySchema,
} from 'remotion';
@@ -192,6 +193,7 @@ const SeriesSequence = Interactive.withSchema({
}) as FC<SeriesSequenceProps>;
const transitionSeriesSchema = {
+ durationInFrames: Internals.sequenceSchema.durationInFrames,
name: Internals.sequenceSchema.name,
hidden: Internals.sequenceSchema.hidden,
showInTimeline: Internals.sequenceSchema.showInTimeline,
@@ -988,14 +990,14 @@ const TransitionSeriesChildren: FC<{readonly children: React.ReactNode}> = ({
* @description Manages a series of transitions and sequences for advanced animation controls in Remotion projects, handling cases with varying timings and presentations.
* @see [Documentation](https://www.remotion.dev/docs/transitions/transitionseries)
*/
-const TransitionSeriesInner: FC<SequencePropsWithoutDuration> = (props) => {
+const TransitionSeriesInner: FC<SequenceProps> = (props) => {
const {
children,
name,
layout: passedLayout,
controls,
...otherProps
- } = props as SequencePropsWithoutDuration & {
+ } = props as SequenceProps & {
readonly controls: SequenceControls | null;
};
const displayName = name ?? '<TransitionSeries>';
@@ -1032,7 +1034,7 @@ const TransitionSeries = Interactive.withSchema({
componentIdentity: 'dev.remotion.transitions.TransitionSeries',
schema: transitionSeriesSchema,
supportsEffects: false,
-}) as FC<SequencePropsWithoutDuration> & {
+}) as FC<SequenceProps> & {
Sequence: typeof SeriesSequence;
Transition: typeof TransitionSeriesTransition;
Overlay: typeof SeriesOverlay;