Skip to content

🎥 Make videos programmatically with React

clamp maxium duration

Jonny Burgere0579998585b
diff --git a/packages/cli/src/editor/helpers/get-timeline-sequence-layout.ts b/packages/cli/src/editor/helpers/get-timeline-sequence-layout.ts
index 91b4d05e61..a356b1a685 100644
--- a/packages/cli/src/editor/helpers/get-timeline-sequence-layout.ts
+++ b/packages/cli/src/editor/helpers/get-timeline-sequence-layout.ts
@@ -21,6 +21,7 @@ const getWidthOfTrack = ({
durationInFrames === Infinity || lastFrame === 0
? fullWidth
: (spatialDuration / lastFrame) * fullWidth;
+
return base - SEQUENCE_BORDER_WIDTH + nonNegativeMarginLeft;
};
@@ -41,12 +42,13 @@ export const getTimelineSequenceLayout = ({
}) => {
const maxMediaSequenceDuration =
(maxMediaDuration ?? Infinity) - startFromMedia;
+ const lastFrame = (video.durationInFrames ?? 1) - 1;
let spatialDuration = Math.min(
maxMediaSequenceDuration,
- durationInFrames - 1
+ durationInFrames - 1,
+ lastFrame - startFrom
);
- const lastFrame = (video.durationInFrames ?? 1) - 1;
const shouldAddHalfAFrameAtEnd = startFrom + durationInFrames < lastFrame;
const shouldAddHalfAFrameAtStart = startFrom > 0;
if (shouldAddHalfAFrameAtEnd) {