remotion 4.0.467 → 4.0.468

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,6 @@ exports.Sequence = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  /* eslint-disable @typescript-eslint/no-use-before-define */
6
6
  const react_1 = require("react");
7
- const react_2 = require("react");
8
7
  const AbsoluteFill_js_1 = require("./AbsoluteFill.js");
9
8
  const freeze_js_1 = require("./freeze.js");
10
9
  const nonce_js_1 = require("./nonce.js");
@@ -66,11 +65,34 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
66
65
  return ((parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.postmounting) ||
67
66
  Boolean(other._remotionInternalIsPostmounting));
68
67
  }, [other._remotionInternalIsPostmounting, parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.postmounting]);
68
+ // `cumulatedNegativeFrom` answers: "How many frames of this media have
69
+ // already elapsed before the first visible frame of this sequence?"
70
+ //
71
+ // This is intentionally based on the effective sequence start, not on adding
72
+ // all negative `from` values. See the asset-calculation tests for:
73
+ // - "Should calculate startFrom correctly with negative offset (Html5Audio)"
74
+ // - "same as above, but with <Sequence from={0}> inbetween"
75
+ // - "same as above, but a positive child offset cancels part of the negative parent offset"
76
+ //
77
+ // In particular, <Sequence from={-20}><Sequence from={10}> should have a
78
+ // 10-frame pre-roll, because the positive child offset cancels part of the
79
+ // negative parent offset. But <Sequence from={10}><Sequence from={-5}>
80
+ // should still trim 5 frames from the media once the parent starts.
81
+ const currentSequenceStart = cumulatedFrom + from;
82
+ const parentSequenceStart = parentSequence
83
+ ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
84
+ : 0;
85
+ const parentFirstFrame = parentSequence
86
+ ? parentSequenceStart - parentSequence.cumulatedNegativeFrom
87
+ : 0;
88
+ const firstFrame = Math.max(0, parentFirstFrame, currentSequenceStart);
89
+ const cumulatedNegativeFrom = currentSequenceStart - firstFrame;
69
90
  const contextValue = (0, react_1.useMemo)(() => {
70
91
  var _a, _b, _c;
71
92
  return {
72
93
  cumulatedFrom,
73
94
  relativeFrom: from,
95
+ cumulatedNegativeFrom,
74
96
  durationInFrames: actualDurationInFrames,
75
97
  parentFrom: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0,
76
98
  id,
@@ -93,6 +115,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
93
115
  postmounting,
94
116
  premountDisplay,
95
117
  postmountDisplay,
118
+ cumulatedNegativeFrom,
96
119
  ]);
97
120
  const timelineClipName = (0, react_1.useMemo)(() => {
98
121
  return name !== null && name !== void 0 ? name : '';
@@ -102,7 +125,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
102
125
  const inheritedStack = (_a = other === null || other === void 0 ? void 0 : other.stack) !== null && _a !== void 0 ? _a : null;
103
126
  // Our assumption: Stack doesnt' change. After we symbolicate we assign it a nodePath
104
127
  // and if it changes, it would lead to-remounting of the sequence.
105
- const stackRef = (0, react_2.useRef)(null);
128
+ const stackRef = (0, react_1.useRef)(null);
106
129
  stackRef.current = stack !== null && stack !== void 0 ? stack : inheritedStack;
107
130
  (0, react_1.useEffect)(() => {
108
131
  var _a, _b, _c;
@@ -1,6 +1,7 @@
1
1
  export declare const SequenceContext: import("react").Context<SequenceContextType | null>;
2
2
  export type SequenceContextType = {
3
3
  cumulatedFrom: number;
4
+ cumulatedNegativeFrom: number;
4
5
  relativeFrom: number;
5
6
  parentFrom: number;
6
7
  durationInFrames: number;
@@ -65,7 +65,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
65
65
  mediaFrame: frame,
66
66
  playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
67
67
  toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : 1,
68
- audioStartFrame: Math.max(0, -((_b = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _b !== void 0 ? _b : 0)),
68
+ audioStartFrame: Math.max(0, -((_b = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedNegativeFrom) !== null && _b !== void 0 ? _b : 0)),
69
69
  audioStreamIndex: audioStreamIndex !== null && audioStreamIndex !== void 0 ? audioStreamIndex : 0,
70
70
  });
71
71
  return () => unregisterRenderAsset(id);
@@ -82,7 +82,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
82
82
  playbackRate,
83
83
  props.playbackRate,
84
84
  toneFrequency,
85
- sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
85
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedNegativeFrom,
86
86
  audioStreamIndex,
87
87
  ]);
88
88
  const { src } = props;
@@ -8,8 +8,7 @@ const use_current_frame_js_1 = require("../use-current-frame.js");
8
8
  const useMediaStartsAt = () => {
9
9
  var _a;
10
10
  const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
11
- const startsAt = Math.min(0, (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0);
12
- return startsAt;
11
+ return (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.cumulatedNegativeFrom) !== null && _a !== void 0 ? _a : 0;
13
12
  };
14
13
  exports.useMediaStartsAt = useMediaStartsAt;
15
14
  /**
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.467";
6
+ export declare const VERSION = "4.0.468";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.467';
10
+ exports.VERSION = '4.0.468';
@@ -74,7 +74,7 @@ crossOrigin, audioStreamIndex, preservePitch: _preservePitch, ...props }) => {
74
74
  mediaFrame: frame,
75
75
  playbackRate,
76
76
  toneFrequency,
77
- audioStartFrame: Math.max(0, -((_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0)),
77
+ audioStartFrame: Math.max(0, -((_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedNegativeFrom) !== null && _a !== void 0 ? _a : 0)),
78
78
  audioStreamIndex,
79
79
  });
80
80
  return () => unregisterRenderAsset(id);
@@ -89,7 +89,7 @@ crossOrigin, audioStreamIndex, preservePitch: _preservePitch, ...props }) => {
89
89
  absoluteFrame,
90
90
  playbackRate,
91
91
  toneFrequency,
92
- sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
92
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedNegativeFrom,
93
93
  audioStreamIndex,
94
94
  ]);
95
95
  const currentTime = (0, react_1.useMemo)(() => {
@@ -76,7 +76,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
76
76
  mediaFrame: frame,
77
77
  playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
78
78
  toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : 1,
79
- audioStartFrame: Math.max(0, -((_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0)),
79
+ audioStartFrame: Math.max(0, -((_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedNegativeFrom) !== null && _a !== void 0 ? _a : 0)),
80
80
  audioStreamIndex: audioStreamIndex !== null && audioStreamIndex !== void 0 ? audioStreamIndex : 0,
81
81
  });
82
82
  return () => unregisterRenderAsset(id);
@@ -91,7 +91,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
91
91
  absoluteFrame,
92
92
  playbackRate,
93
93
  toneFrequency,
94
- sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
94
+ sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedNegativeFrom,
95
95
  audioStreamIndex,
96
96
  ]);
97
97
  (0, react_1.useImperativeHandle)(ref, () => {
@@ -1,15 +1,11 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __returnValue = (v) => v;
3
- function __exportSetter(name, newValue) {
4
- this[name] = __returnValue.bind(null, newValue);
5
- }
6
2
  var __export = (target, all) => {
7
3
  for (var name in all)
8
4
  __defProp(target, name, {
9
5
  get: all[name],
10
6
  enumerable: true,
11
7
  configurable: true,
12
- set: __exportSetter.bind(all, name)
8
+ set: (newValue) => all[name] = () => newValue
13
9
  });
14
10
  };
15
11
 
@@ -1292,7 +1288,7 @@ var addSequenceStackTraces = (component) => {
1292
1288
  };
1293
1289
 
1294
1290
  // src/version.ts
1295
- var VERSION = "4.0.467";
1291
+ var VERSION = "4.0.468";
1296
1292
 
1297
1293
  // src/multiple-versions-warning.ts
1298
1294
  var checkMultipleRemotionVersions = () => {
@@ -1334,9 +1330,9 @@ import {
1334
1330
  useContext as useContext17,
1335
1331
  useEffect as useEffect3,
1336
1332
  useMemo as useMemo14,
1333
+ useRef as useRef6,
1337
1334
  useState as useState5
1338
1335
  } from "react";
1339
- import { useRef as useRef6 } from "react";
1340
1336
 
1341
1337
  // src/freeze.tsx
1342
1338
  import { useContext as useContext14, useMemo as useMemo11 } from "react";
@@ -2474,10 +2470,16 @@ var RegularSequenceRefForwardingFunction = ({
2474
2470
  const postmounting = useMemo14(() => {
2475
2471
  return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
2476
2472
  }, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
2473
+ const currentSequenceStart = cumulatedFrom + from;
2474
+ const parentSequenceStart = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
2475
+ const parentFirstFrame = parentSequence ? parentSequenceStart - parentSequence.cumulatedNegativeFrom : 0;
2476
+ const firstFrame = Math.max(0, parentFirstFrame, currentSequenceStart);
2477
+ const cumulatedNegativeFrom = currentSequenceStart - firstFrame;
2477
2478
  const contextValue = useMemo14(() => {
2478
2479
  return {
2479
2480
  cumulatedFrom,
2480
2481
  relativeFrom: from,
2482
+ cumulatedNegativeFrom,
2481
2483
  durationInFrames: actualDurationInFrames,
2482
2484
  parentFrom: parentSequence?.relativeFrom ?? 0,
2483
2485
  id,
@@ -2499,7 +2501,8 @@ var RegularSequenceRefForwardingFunction = ({
2499
2501
  premounting,
2500
2502
  postmounting,
2501
2503
  premountDisplay,
2502
- postmountDisplay
2504
+ postmountDisplay,
2505
+ cumulatedNegativeFrom
2503
2506
  ]);
2504
2507
  const timelineClipName = useMemo14(() => {
2505
2508
  return name ?? "";
@@ -5376,8 +5379,7 @@ import { useContext as useContext24, useEffect as useEffect8, useMemo as useMemo
5376
5379
  import { useContext as useContext23 } from "react";
5377
5380
  var useMediaStartsAt = () => {
5378
5381
  const parentSequence = useContext23(SequenceContext);
5379
- const startsAt = Math.min(0, parentSequence?.relativeFrom ?? 0);
5380
- return startsAt;
5382
+ return parentSequence?.cumulatedNegativeFrom ?? 0;
5381
5383
  };
5382
5384
  var useFrameForVolumeProp = (behavior) => {
5383
5385
  const loop = Loop.useLoop();
@@ -6910,7 +6912,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
6910
6912
  mediaFrame: frame,
6911
6913
  playbackRate: props.playbackRate ?? 1,
6912
6914
  toneFrequency: toneFrequency ?? 1,
6913
- audioStartFrame: Math.max(0, -(sequenceContext?.relativeFrom ?? 0)),
6915
+ audioStartFrame: Math.max(0, -(sequenceContext?.cumulatedNegativeFrom ?? 0)),
6914
6916
  audioStreamIndex: audioStreamIndex ?? 0
6915
6917
  });
6916
6918
  return () => unregisterRenderAsset(id);
@@ -6927,7 +6929,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
6927
6929
  playbackRate,
6928
6930
  props.playbackRate,
6929
6931
  toneFrequency,
6930
- sequenceContext?.relativeFrom,
6932
+ sequenceContext?.cumulatedNegativeFrom,
6931
6933
  audioStreamIndex
6932
6934
  ]);
6933
6935
  const { src } = props;
@@ -8539,7 +8541,7 @@ var OffthreadVideoForRendering = ({
8539
8541
  mediaFrame: frame,
8540
8542
  playbackRate,
8541
8543
  toneFrequency,
8542
- audioStartFrame: Math.max(0, -(sequenceContext?.relativeFrom ?? 0)),
8544
+ audioStartFrame: Math.max(0, -(sequenceContext?.cumulatedNegativeFrom ?? 0)),
8543
8545
  audioStreamIndex
8544
8546
  });
8545
8547
  return () => unregisterRenderAsset(id);
@@ -8554,7 +8556,7 @@ var OffthreadVideoForRendering = ({
8554
8556
  absoluteFrame,
8555
8557
  playbackRate,
8556
8558
  toneFrequency,
8557
- sequenceContext?.relativeFrom,
8559
+ sequenceContext?.cumulatedNegativeFrom,
8558
8560
  audioStreamIndex
8559
8561
  ]);
8560
8562
  const currentTime = useMemo35(() => {
@@ -10557,7 +10559,7 @@ var VideoForRenderingForwardFunction = ({
10557
10559
  mediaFrame: frame,
10558
10560
  playbackRate: playbackRate ?? 1,
10559
10561
  toneFrequency: toneFrequency ?? 1,
10560
- audioStartFrame: Math.max(0, -(sequenceContext?.relativeFrom ?? 0)),
10562
+ audioStartFrame: Math.max(0, -(sequenceContext?.cumulatedNegativeFrom ?? 0)),
10561
10563
  audioStreamIndex: audioStreamIndex ?? 0
10562
10564
  });
10563
10565
  return () => unregisterRenderAsset(id);
@@ -10572,7 +10574,7 @@ var VideoForRenderingForwardFunction = ({
10572
10574
  absoluteFrame,
10573
10575
  playbackRate,
10574
10576
  toneFrequency,
10575
- sequenceContext?.relativeFrom,
10577
+ sequenceContext?.cumulatedNegativeFrom,
10576
10578
  audioStreamIndex
10577
10579
  ]);
10578
10580
  useImperativeHandle9(ref, () => {
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.467";
2
+ var VERSION = "4.0.468";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.467",
6
+ "version": "4.0.468",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
37
  "zod": "4.3.6",
38
- "@remotion/eslint-config-internal": "4.0.467",
38
+ "@remotion/eslint-config-internal": "4.0.468",
39
39
  "eslint": "9.19.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
41
41
  },