remotion 4.0.77 → 4.0.80

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.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/CatchError.d.ts +15 -0
  3. package/dist/cjs/CatchError.js +68 -0
  4. package/dist/cjs/CompositionManager.d.ts +1 -0
  5. package/dist/cjs/Img.d.ts +1 -1
  6. package/dist/cjs/Sequence.d.ts +6 -0
  7. package/dist/cjs/Sequence.js +20 -7
  8. package/dist/cjs/SequenceContext.d.ts +2 -0
  9. package/dist/cjs/SequenceManager.d.ts +5 -0
  10. package/dist/cjs/SequenceManager.js +16 -3
  11. package/dist/cjs/audio/Audio.d.ts +6 -1
  12. package/dist/cjs/audio/Audio.js +4 -2
  13. package/dist/cjs/audio/AudioForDevelopment.d.ts +1 -0
  14. package/dist/cjs/audio/AudioForDevelopment.js +11 -3
  15. package/dist/cjs/enable-sequence-stack-traces.d.ts +1 -0
  16. package/dist/cjs/enable-sequence-stack-traces.js +34 -0
  17. package/dist/cjs/index.js +5 -2
  18. package/dist/cjs/internals.d.ts +2 -0
  19. package/dist/cjs/internals.js +3 -0
  20. package/dist/cjs/loop/index.js +1 -1
  21. package/dist/cjs/series/index.js +4 -2
  22. package/dist/cjs/use-media-in-timeline.d.ts +3 -1
  23. package/dist/cjs/use-media-in-timeline.js +3 -2
  24. package/dist/cjs/use-unsafe-video-config.js +7 -5
  25. package/dist/cjs/version.d.ts +1 -1
  26. package/dist/cjs/version.js +1 -1
  27. package/dist/cjs/video/OffthreadVideo.d.ts +1 -1
  28. package/dist/cjs/video/OffthreadVideo.js +2 -2
  29. package/dist/cjs/video/Video.d.ts +6 -1
  30. package/dist/cjs/video/Video.js +4 -2
  31. package/dist/cjs/video/VideoForDevelopment.d.ts +1 -0
  32. package/dist/cjs/video/VideoForDevelopment.js +17 -5
  33. package/dist/cjs/video/props.d.ts +4 -0
  34. package/dist/esm/index.mjs +226 -167
  35. package/dist/esm/version.mjs +1 -1
  36. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import React, { createContext, useState, useMemo, useLayoutEffect, useContext, useEffect, forwardRef, Children, isValidElement, useRef, useCallback, createRef, useImperativeHandle, useReducer, Suspense } from 'react';
1
+ import React, { createContext, useState, useMemo, useLayoutEffect, useContext, useEffect, forwardRef, useRef, useCallback, createRef, useImperativeHandle, useReducer, Suspense, Children } from 'react';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { createPortal } from 'react-dom';
4
4
 
@@ -46,6 +46,79 @@ const Clipper = ({ height, width, x, y }) => {
46
46
  return null;
47
47
  };
48
48
 
49
+ /**
50
+ * @description Provides information about the Remotion Environment
51
+ * @see [Documentation](https://www.remotion.dev/docs/get-remotion-environment)
52
+ */
53
+ const getRemotionEnvironment = () => {
54
+ if (process.env.NODE_ENV === 'production') {
55
+ // Check if inside a Remotion bundle.
56
+ // Must be a variable in index-html.ts and be defined before setupEnvVariables()
57
+ if (typeof window !== 'undefined' &&
58
+ typeof window.remotion_editorName !== 'undefined' &&
59
+ typeof window.remotion_projectName !== 'undefined') {
60
+ return {
61
+ isStudio: false,
62
+ isRendering: true,
63
+ isPlayer: false,
64
+ };
65
+ }
66
+ return {
67
+ isStudio: false,
68
+ isRendering: false,
69
+ isPlayer: typeof window !== 'undefined' && window.remotion_isPlayer,
70
+ };
71
+ }
72
+ // The Vitest framework sets NODE_ENV as test.
73
+ // Right now we don't need to treat it in a special
74
+ // way which is good - defaulting to `rendering`.
75
+ if (process.env.NODE_ENV === 'test') {
76
+ return {
77
+ isStudio: false,
78
+ isRendering: true,
79
+ isPlayer: false,
80
+ };
81
+ }
82
+ if (typeof window !== 'undefined' && window.remotion_isPlayer) {
83
+ return {
84
+ isStudio: false,
85
+ isRendering: false,
86
+ isPlayer: true,
87
+ };
88
+ }
89
+ return {
90
+ isStudio: true,
91
+ isRendering: false,
92
+ isPlayer: false,
93
+ };
94
+ };
95
+
96
+ const originalCreateElement = React.createElement;
97
+ const componentsToAddStacksTo = [];
98
+ const enableSequenceStackTraces = () => {
99
+ const proxy = new Proxy(originalCreateElement, {
100
+ apply(target, thisArg, argArray) {
101
+ if (componentsToAddStacksTo.includes(argArray[0])) {
102
+ const [first, props, ...rest] = argArray;
103
+ const newProps = {
104
+ ...(props !== null && props !== void 0 ? props : {}),
105
+ stack: new Error().stack,
106
+ };
107
+ return Reflect.apply(target, thisArg, [first, newProps, ...rest]);
108
+ }
109
+ return Reflect.apply(target, thisArg, argArray);
110
+ },
111
+ });
112
+ React.createElement = proxy;
113
+ };
114
+ const addSequenceStackTraces = (component) => {
115
+ if (!getRemotionEnvironment().isStudio) {
116
+ return;
117
+ }
118
+ componentsToAddStacksTo.push(component);
119
+ enableSequenceStackTraces();
120
+ };
121
+
49
122
  const IsPlayerContext = createContext(false);
50
123
  const IsPlayerContextProvider = ({ children, }) => {
51
124
  return jsx(IsPlayerContext.Provider, { value: true, children: children });
@@ -59,7 +132,7 @@ function truthy(value) {
59
132
  }
60
133
 
61
134
  // Automatically generated on publish
62
- const VERSION = '4.0.77';
135
+ const VERSION = '4.0.80';
63
136
 
64
137
  const checkMultipleRemotionVersions = () => {
65
138
  if (typeof globalThis === 'undefined') {
@@ -132,139 +205,6 @@ const AbsoluteFillRefForwarding = (props, ref) => {
132
205
  */
133
206
  const AbsoluteFill = forwardRef(AbsoluteFillRefForwarding);
134
207
 
135
- const getAbsoluteSrc = (relativeSrc) => {
136
- if (typeof window === 'undefined') {
137
- return relativeSrc;
138
- }
139
- return new URL(relativeSrc, window.location.origin).href;
140
- };
141
-
142
- const calculateLoopDuration = ({ endAt, mediaDuration, playbackRate, startFrom, }) => {
143
- let duration = mediaDuration;
144
- // Account for endAt
145
- if (typeof endAt !== 'undefined') {
146
- duration = endAt;
147
- }
148
- // Account for startFrom
149
- if (typeof startFrom !== 'undefined') {
150
- duration -= startFrom;
151
- }
152
- const actualDuration = duration / playbackRate;
153
- return Math.floor(actualDuration);
154
- };
155
-
156
- const isErrorLike = (err) => {
157
- if (err === null) {
158
- return false;
159
- }
160
- if (typeof err !== 'object') {
161
- return false;
162
- }
163
- if (!('stack' in err)) {
164
- return false;
165
- }
166
- // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
167
- // @ts-ignore we just asserted
168
- if (typeof err.stack !== 'string') {
169
- return false;
170
- }
171
- if (!('message' in err)) {
172
- return false;
173
- }
174
- // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
175
- // @ts-ignore we just asserted
176
- if (typeof err.message !== 'string') {
177
- return false;
178
- }
179
- return true;
180
- };
181
- /**
182
- * @description When you invoke this function, Remotion will stop rendering all the frames without any retries
183
- * @see [Documentation](https://www.remotion.dev/docs/cancel-render)
184
- */
185
- function cancelRender(err) {
186
- let error;
187
- if (isErrorLike(err)) {
188
- error = err;
189
- }
190
- else if (typeof err === 'string') {
191
- error = Error(err);
192
- }
193
- else {
194
- error = Error('Rendering was cancelled');
195
- }
196
- window.remotion_cancelledError = error.stack;
197
- throw error;
198
- }
199
-
200
- /**
201
- * @description Provides information about the Remotion Environment
202
- * @see [Documentation](https://www.remotion.dev/docs/get-remotion-environment)
203
- */
204
- const getRemotionEnvironment = () => {
205
- if (process.env.NODE_ENV === 'production') {
206
- // Check if inside a Remotion bundle.
207
- // Must be a variable in index-html.ts and be defined before setupEnvVariables()
208
- if (typeof window !== 'undefined' &&
209
- typeof window.remotion_editorName !== 'undefined' &&
210
- typeof window.remotion_projectName !== 'undefined') {
211
- return {
212
- isStudio: false,
213
- isRendering: true,
214
- isPlayer: false,
215
- };
216
- }
217
- return {
218
- isStudio: false,
219
- isRendering: false,
220
- isPlayer: typeof window !== 'undefined' && window.remotion_isPlayer,
221
- };
222
- }
223
- // The Vitest framework sets NODE_ENV as test.
224
- // Right now we don't need to treat it in a special
225
- // way which is good - defaulting to `rendering`.
226
- if (process.env.NODE_ENV === 'test') {
227
- return {
228
- isStudio: false,
229
- isRendering: true,
230
- isPlayer: false,
231
- };
232
- }
233
- if (typeof window !== 'undefined' && window.remotion_isPlayer) {
234
- return {
235
- isStudio: false,
236
- isRendering: false,
237
- isPlayer: true,
238
- };
239
- }
240
- return {
241
- isStudio: true,
242
- isRendering: false,
243
- isPlayer: false,
244
- };
245
- };
246
-
247
- const HIDDEN_NAMES = ['__WEBPACK_DEFAULT_EXPORT__'];
248
- const getTimelineClipName = (children) => {
249
- var _a;
250
- const tree = (_a = Children.map(children, (ch) => {
251
- if (!isValidElement(ch)) {
252
- return null;
253
- }
254
- // Must be name, not ID
255
- const name = typeof ch.type !== 'string' && ch.type.name;
256
- if (name && !HIDDEN_NAMES.includes(name)) {
257
- return name;
258
- }
259
- if (ch.props.children) {
260
- const chName = getTimelineClipName(ch.props.children);
261
- return chName;
262
- }
263
- return null;
264
- })) === null || _a === void 0 ? void 0 : _a.filter(Boolean);
265
- return (tree === null || tree === void 0 ? void 0 : tree.length) ? tree[0] : '';
266
- };
267
-
268
208
  const NonceContext = createContext({
269
209
  getNonce: () => 0,
270
210
  fastRefreshes: 0,
@@ -295,8 +235,15 @@ const SequenceManager = React.createContext({
295
235
  },
296
236
  sequences: [],
297
237
  });
238
+ const SequenceVisibilityToggleContext = React.createContext({
239
+ hidden: {},
240
+ setHidden: () => {
241
+ throw new Error('SequenceVisibilityToggle not initialized');
242
+ },
243
+ });
298
244
  const SequenceManagerProvider = ({ children }) => {
299
245
  const [sequences, setSequences] = useState([]);
246
+ const [hidden, setHidden] = useState({});
300
247
  const registerSequence = useCallback((seq) => {
301
248
  setSequences((seqs) => {
302
249
  return [...seqs, seq];
@@ -305,14 +252,20 @@ const SequenceManagerProvider = ({ children }) => {
305
252
  const unregisterSequence = useCallback((seq) => {
306
253
  setSequences((seqs) => seqs.filter((s) => s.id !== seq));
307
254
  }, []);
308
- const context = useMemo(() => {
255
+ const sequenceContext = useMemo(() => {
309
256
  return {
310
257
  registerSequence,
311
258
  sequences,
312
259
  unregisterSequence,
313
260
  };
314
261
  }, [registerSequence, sequences, unregisterSequence]);
315
- return (jsx(SequenceManager.Provider, { value: context, children: children }));
262
+ const hiddenContext = useMemo(() => {
263
+ return {
264
+ hidden,
265
+ setHidden,
266
+ };
267
+ }, [hidden]);
268
+ return (jsx(SequenceManager.Provider, { value: sequenceContext, children: jsx(SequenceVisibilityToggleContext.Provider, { value: hiddenContext, children: children }) }));
316
269
  };
317
270
 
318
271
  const CompositionManager = createContext({
@@ -965,9 +918,11 @@ const CanUseRemotionHooksProvider = ({ children }) => {
965
918
  };
966
919
 
967
920
  const useUnsafeVideoConfig = () => {
968
- var _a;
921
+ var _a, _b, _c;
969
922
  const context = useContext(SequenceContext);
970
- const ctxDuration = (_a = context === null || context === void 0 ? void 0 : context.durationInFrames) !== null && _a !== void 0 ? _a : null;
923
+ const ctxWidth = (_a = context === null || context === void 0 ? void 0 : context.width) !== null && _a !== void 0 ? _a : null;
924
+ const ctxHeight = (_b = context === null || context === void 0 ? void 0 : context.height) !== null && _b !== void 0 ? _b : null;
925
+ const ctxDuration = (_c = context === null || context === void 0 ? void 0 : context.durationInFrames) !== null && _c !== void 0 ? _c : null;
971
926
  const video = useVideo();
972
927
  return useMemo(() => {
973
928
  if (!video) {
@@ -976,15 +931,15 @@ const useUnsafeVideoConfig = () => {
976
931
  const { id, durationInFrames, fps, height, width, defaultProps, props, defaultCodec, } = video;
977
932
  return {
978
933
  id,
979
- width,
980
- height,
934
+ width: ctxWidth !== null && ctxWidth !== void 0 ? ctxWidth : width,
935
+ height: ctxHeight !== null && ctxHeight !== void 0 ? ctxHeight : height,
981
936
  fps,
982
937
  durationInFrames: ctxDuration !== null && ctxDuration !== void 0 ? ctxDuration : durationInFrames,
983
938
  defaultProps,
984
939
  props,
985
940
  defaultCodec,
986
941
  };
987
- }, [ctxDuration, video]);
942
+ }, [ctxDuration, ctxHeight, ctxWidth, video]);
988
943
  };
989
944
 
990
945
  /**
@@ -1014,7 +969,8 @@ const useVideoConfig = () => {
1014
969
  return videoConfig;
1015
970
  };
1016
971
 
1017
- const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity, children, name, showInTimeline = true, loopDisplay, ...other }, ref) => {
972
+ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, loopDisplay, stack, ...other }, ref) => {
973
+ var _a;
1018
974
  const { layout = 'absolute-fill' } = other;
1019
975
  const [id] = useState(() => String(Math.random()));
1020
976
  const parentSequence = useContext(SequenceContext);
@@ -1049,25 +1005,30 @@ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity,
1049
1005
  : durationInFrames;
1050
1006
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
1051
1007
  const { registerSequence, unregisterSequence } = useContext(SequenceManager);
1008
+ const { hidden } = useContext(SequenceVisibilityToggleContext);
1052
1009
  const contextValue = useMemo(() => {
1053
- var _a;
1010
+ var _a, _b, _c;
1054
1011
  return {
1055
1012
  cumulatedFrom,
1056
1013
  relativeFrom: from,
1057
1014
  durationInFrames: actualDurationInFrames,
1058
1015
  parentFrom: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0,
1059
1016
  id,
1017
+ height: (_b = height !== null && height !== void 0 ? height : parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.height) !== null && _b !== void 0 ? _b : null,
1018
+ width: (_c = width !== null && width !== void 0 ? width : parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.width) !== null && _c !== void 0 ? _c : null,
1060
1019
  };
1061
1020
  }, [
1062
1021
  cumulatedFrom,
1063
1022
  from,
1064
1023
  actualDurationInFrames,
1065
- parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom,
1024
+ parentSequence,
1066
1025
  id,
1026
+ height,
1027
+ width,
1067
1028
  ]);
1068
1029
  const timelineClipName = useMemo(() => {
1069
- return name !== null && name !== void 0 ? name : getTimelineClipName(children);
1070
- }, [children, name]);
1030
+ return name !== null && name !== void 0 ? name : '';
1031
+ }, [name]);
1071
1032
  useEffect(() => {
1072
1033
  var _a;
1073
1034
  if (!getRemotionEnvironment().isStudio) {
@@ -1084,6 +1045,7 @@ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity,
1084
1045
  showInTimeline,
1085
1046
  nonce,
1086
1047
  loopDisplay,
1048
+ stack: stack !== null && stack !== void 0 ? stack : null,
1087
1049
  });
1088
1050
  return () => {
1089
1051
  unregisterSequence(id);
@@ -1102,6 +1064,7 @@ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity,
1102
1064
  showInTimeline,
1103
1065
  nonce,
1104
1066
  loopDisplay,
1067
+ stack,
1105
1068
  ]);
1106
1069
  // Ceil to support floats
1107
1070
  // https://github.com/remotion-dev/remotion/issues/2958
@@ -1115,12 +1078,18 @@ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity,
1115
1078
  const defaultStyle = useMemo(() => {
1116
1079
  return {
1117
1080
  flexDirection: undefined,
1081
+ ...(width ? { width } : {}),
1082
+ ...(height ? { height } : {}),
1118
1083
  ...(styleIfThere !== null && styleIfThere !== void 0 ? styleIfThere : {}),
1119
1084
  };
1120
- }, [styleIfThere]);
1085
+ }, [height, styleIfThere, width]);
1121
1086
  if (ref !== null && layout === 'none') {
1122
1087
  throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
1123
1088
  }
1089
+ const isSequenceHidden = (_a = hidden[id]) !== null && _a !== void 0 ? _a : false;
1090
+ if (isSequenceHidden) {
1091
+ return null;
1092
+ }
1124
1093
  return (jsx(SequenceContext.Provider, { value: contextValue, children: content === null ? null : other.layout === 'none' ? (content) : (jsx(AbsoluteFill, { ref: ref, style: defaultStyle, className: other.className, children: content })) }));
1125
1094
  };
1126
1095
  /**
@@ -1129,6 +1098,71 @@ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity,
1129
1098
  */
1130
1099
  const Sequence = forwardRef(SequenceRefForwardingFunction);
1131
1100
 
1101
+ const getAbsoluteSrc = (relativeSrc) => {
1102
+ if (typeof window === 'undefined') {
1103
+ return relativeSrc;
1104
+ }
1105
+ return new URL(relativeSrc, window.location.origin).href;
1106
+ };
1107
+
1108
+ const calculateLoopDuration = ({ endAt, mediaDuration, playbackRate, startFrom, }) => {
1109
+ let duration = mediaDuration;
1110
+ // Account for endAt
1111
+ if (typeof endAt !== 'undefined') {
1112
+ duration = endAt;
1113
+ }
1114
+ // Account for startFrom
1115
+ if (typeof startFrom !== 'undefined') {
1116
+ duration -= startFrom;
1117
+ }
1118
+ const actualDuration = duration / playbackRate;
1119
+ return Math.floor(actualDuration);
1120
+ };
1121
+
1122
+ const isErrorLike = (err) => {
1123
+ if (err === null) {
1124
+ return false;
1125
+ }
1126
+ if (typeof err !== 'object') {
1127
+ return false;
1128
+ }
1129
+ if (!('stack' in err)) {
1130
+ return false;
1131
+ }
1132
+ // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
1133
+ // @ts-ignore we just asserted
1134
+ if (typeof err.stack !== 'string') {
1135
+ return false;
1136
+ }
1137
+ if (!('message' in err)) {
1138
+ return false;
1139
+ }
1140
+ // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
1141
+ // @ts-ignore we just asserted
1142
+ if (typeof err.message !== 'string') {
1143
+ return false;
1144
+ }
1145
+ return true;
1146
+ };
1147
+ /**
1148
+ * @description When you invoke this function, Remotion will stop rendering all the frames without any retries
1149
+ * @see [Documentation](https://www.remotion.dev/docs/cancel-render)
1150
+ */
1151
+ function cancelRender(err) {
1152
+ let error;
1153
+ if (isErrorLike(err)) {
1154
+ error = err;
1155
+ }
1156
+ else if (typeof err === 'string') {
1157
+ error = Error(err);
1158
+ }
1159
+ else {
1160
+ error = Error('Rendering was cancelled');
1161
+ }
1162
+ window.remotion_cancelledError = error.stack;
1163
+ throw error;
1164
+ }
1165
+
1132
1166
  /**
1133
1167
  * @description Get the current frame of the video. Frames are 0-indexed, meaning the first frame is 0, the last frame is the duration of the composition in frames minus one.
1134
1168
  * @see [Documentation](https://remotion.dev/docs/use-current-frame)
@@ -1182,7 +1216,7 @@ const Loop = ({ durationInFrames, times = Infinity, children, name, ...props })
1182
1216
  durationInFrames,
1183
1217
  };
1184
1218
  }, [actualTimes, durationInFrames, from]);
1185
- return (jsx(Sequence, { durationInFrames: durationInFrames, from: from, name: name, loopDisplay: loopDisplay, layout: props.layout, style: style, children: children }));
1219
+ return (jsx(Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', loopDisplay: loopDisplay, layout: props.layout, style: style, children: children }));
1186
1220
  };
1187
1221
 
1188
1222
  const PreloadContext = createContext({});
@@ -1536,7 +1570,7 @@ const warnOnce = (message) => {
1536
1570
  console.warn(message);
1537
1571
  didWarn[message] = true;
1538
1572
  };
1539
- const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, }) => {
1573
+ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, }) => {
1540
1574
  const videoConfig = useVideoConfig();
1541
1575
  const { rootId, audioAndVideoTags } = useContext(TimelineContext);
1542
1576
  const parentSequence = useContext(SequenceContext);
@@ -1546,7 +1580,6 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
1546
1580
  const [playing] = usePlayingState();
1547
1581
  const startsAt = useMediaStartsAt();
1548
1582
  const { registerSequence, unregisterSequence } = useContext(SequenceManager);
1549
- const [id] = useState(() => String(Math.random()));
1550
1583
  const [initialVolume] = useState(() => volume);
1551
1584
  const nonce = useNonce();
1552
1585
  const duration = parentSequence
@@ -1601,6 +1634,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
1601
1634
  doesVolumeChange,
1602
1635
  loopDisplay: undefined,
1603
1636
  playbackRate,
1637
+ stack,
1604
1638
  });
1605
1639
  return () => {
1606
1640
  unregisterSequence(id);
@@ -1623,6 +1657,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
1623
1657
  startsAt,
1624
1658
  playbackRate,
1625
1659
  displayName,
1660
+ stack,
1626
1661
  ]);
1627
1662
  useEffect(() => {
1628
1663
  const tag = {
@@ -2266,6 +2301,7 @@ const useSharedAudio = (aud, audioId) => {
2266
2301
  };
2267
2302
 
2268
2303
  const AudioForDevelopmentForwardRefFunction = (props, ref) => {
2304
+ var _a;
2269
2305
  const [initialShouldPreMountAudioElements] = useState(props.shouldPreMountAudioTags);
2270
2306
  if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
2271
2307
  throw new Error('Cannot change the behavior for pre-mounting audio tags dynamically.');
@@ -2273,26 +2309,30 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
2273
2309
  const [mediaVolume] = useMediaVolumeState();
2274
2310
  const [mediaMuted] = useMediaMutedState();
2275
2311
  const volumePropFrame = useFrameForVolumeProp();
2276
- const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, allowAmplificationDuringRender, name, ...nativeProps } = props;
2312
+ const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, _remotionInternalStack, allowAmplificationDuringRender, name, ...nativeProps } = props;
2313
+ const { hidden } = useContext(SequenceVisibilityToggleContext);
2277
2314
  if (!src) {
2278
2315
  throw new TypeError("No 'src' was passed to <Audio>.");
2279
2316
  }
2280
2317
  const preloadedSrc = usePreload(src);
2318
+ const sequenceContext = useContext(SequenceContext);
2319
+ const [timelineId] = useState(() => String(Math.random()));
2320
+ const isSequenceHidden = (_a = hidden[timelineId]) !== null && _a !== void 0 ? _a : false;
2281
2321
  const propsToPass = useMemo(() => {
2282
2322
  return {
2283
- muted: muted || mediaMuted,
2323
+ muted: muted || mediaMuted || isSequenceHidden,
2284
2324
  src: preloadedSrc,
2285
2325
  loop: _remotionInternalNativeLoopPassed,
2286
2326
  ...nativeProps,
2287
2327
  };
2288
2328
  }, [
2289
2329
  _remotionInternalNativeLoopPassed,
2330
+ isSequenceHidden,
2290
2331
  mediaMuted,
2291
2332
  muted,
2292
2333
  nativeProps,
2293
2334
  preloadedSrc,
2294
2335
  ]);
2295
- const sequenceContext = useContext(SequenceContext);
2296
2336
  // Generate a string that's as unique as possible for this asset
2297
2337
  // but at the same time deterministic. We use it to combat strict mode issues.
2298
2338
  const id = useMemo(() => `audio-${random(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
@@ -2320,6 +2360,8 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
2320
2360
  mediaType: 'audio',
2321
2361
  playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
2322
2362
  displayName: name !== null && name !== void 0 ? name : null,
2363
+ id: timelineId,
2364
+ stack: props._remotionInternalStack,
2323
2365
  });
2324
2366
  useMediaPlayback({
2325
2367
  mediaRef: audioRef,
@@ -2587,7 +2629,7 @@ const AudioForRendering = forwardRef(AudioForRenderingRefForwardingFunction);
2587
2629
  const AudioRefForwardingFunction = (props, ref) => {
2588
2630
  var _a, _b;
2589
2631
  const audioContext = useContext(SharedAudioContext);
2590
- const { startFrom, endAt, name, ...otherProps } = props;
2632
+ const { startFrom, endAt, name, stack, ...otherProps } = props;
2591
2633
  const { loop, ...propsOtherThanLoop } = props;
2592
2634
  const { fps } = useVideoConfig();
2593
2635
  const environment = getRemotionEnvironment();
@@ -2632,13 +2674,14 @@ const AudioRefForwardingFunction = (props, ref) => {
2632
2674
  if (environment.isRendering) {
2633
2675
  return (jsx(AudioForRendering, { onDuration: onDuration, ...props, ref: ref, onError: onError, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2634
2676
  }
2635
- return (jsx(AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_b = props._remotionInternalNativeLoopPassed) !== null && _b !== void 0 ? _b : false, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2677
+ return (jsx(AudioForDevelopment, { _remotionInternalNativeLoopPassed: (_b = props._remotionInternalNativeLoopPassed) !== null && _b !== void 0 ? _b : false, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError, onDuration: onDuration, _remotionInternalNeedsDurationCalculation: Boolean(loop) }));
2636
2678
  };
2637
2679
  /**
2638
2680
  * @description With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
2639
2681
  * @see [Documentation](https://www.remotion.dev/docs/audio)
2640
2682
  */
2641
2683
  const Audio = forwardRef(AudioRefForwardingFunction);
2684
+ addSequenceStackTraces(Audio);
2642
2685
 
2643
2686
  const getRegex$1 = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
2644
2687
  const isFolderNameValid = (name) => name.match(getRegex$1());
@@ -3609,6 +3652,7 @@ const Internals = {
3609
3652
  Timeline: TimelinePosition,
3610
3653
  CompositionManager,
3611
3654
  SequenceManager,
3655
+ SequenceVisibilityToggleContext,
3612
3656
  RemotionRoot,
3613
3657
  useVideo,
3614
3658
  getRoot,
@@ -3656,6 +3700,7 @@ const Internals = {
3656
3700
  ClipComposition,
3657
3701
  isIosSafari,
3658
3702
  WATCH_REMOTION_STATIC_FILES,
3703
+ addSequenceStackTraces,
3659
3704
  };
3660
3705
 
3661
3706
  /**
@@ -4116,7 +4161,7 @@ const Series = ({ children }) => {
4116
4161
  throw new TypeError(`A <Series.Sequence /> component (${debugInfo}) was detected to not have any children. Delete it to fix this error.`);
4117
4162
  }
4118
4163
  const durationInFramesProp = castedChild.props.durationInFrames;
4119
- const { durationInFrames, children: _children, from, ...passedProps } = castedChild.props; // `from` is not accepted and must be filtered out if used in JS
4164
+ const { durationInFrames, children: _children, from, name, ...passedProps } = castedChild.props; // `from` is not accepted and must be filtered out if used in JS
4120
4165
  if (i !== flattenedChildren.length - 1 ||
4121
4166
  durationInFramesProp !== Infinity) {
4122
4167
  validateDurationInFrames(durationInFramesProp, {
@@ -4136,13 +4181,14 @@ const Series = ({ children }) => {
4136
4181
  }
4137
4182
  const currentStartFrame = startFrame + offset;
4138
4183
  startFrame += durationInFramesProp + offset;
4139
- return (jsx(Sequence, { from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, ref: castedChild.ref, children: child }));
4184
+ return (jsx(Sequence, { name: name || '<Series.Sequence>', from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, ref: castedChild.ref, children: child }));
4140
4185
  });
4141
4186
  }, [children]);
4142
4187
  /* eslint-disable react/jsx-no-useless-fragment */
4143
4188
  return jsx(Fragment, { children: childrenValue });
4144
4189
  };
4145
4190
  Series.Sequence = SeriesSequence;
4191
+ addSequenceStackTraces(SeriesSequence);
4146
4192
 
4147
4193
  const validateSpringDuration = (dur) => {
4148
4194
  if (typeof dur === 'undefined') {
@@ -4517,14 +4563,17 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
4517
4563
  };
4518
4564
 
4519
4565
  const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
4520
- var _a, _b;
4566
+ var _a, _b, _c;
4521
4567
  const videoRef = useRef(null);
4522
4568
  const volumePropFrame = useFrameForVolumeProp();
4523
4569
  const { fps, durationInFrames } = useVideoConfig();
4524
4570
  const parentSequence = useContext(SequenceContext);
4571
+ const { hidden } = useContext(SequenceVisibilityToggleContext);
4572
+ const [timelineId] = useState(() => String(Math.random()));
4573
+ const isSequenceHidden = (_a = hidden[timelineId]) !== null && _a !== void 0 ? _a : false;
4525
4574
  const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
4526
4575
  // @ts-expect-error
4527
- acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, ...nativeProps } = props;
4576
+ acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, _remotionInternalStack, style, ...nativeProps } = props;
4528
4577
  if (typeof acceptableTimeShift !== 'undefined') {
4529
4578
  throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
4530
4579
  }
@@ -4537,8 +4586,10 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
4537
4586
  mediaVolume,
4538
4587
  mediaType: 'video',
4539
4588
  src,
4540
- playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
4589
+ playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
4541
4590
  displayName: name !== null && name !== void 0 ? name : null,
4591
+ id: timelineId,
4592
+ stack: props._remotionInternalStack,
4542
4593
  });
4543
4594
  useSyncVolumeWithMediaTag({
4544
4595
  volumePropFrame,
@@ -4551,7 +4602,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
4551
4602
  mediaRef: videoRef,
4552
4603
  src,
4553
4604
  mediaType: 'video',
4554
- playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
4605
+ playbackRate: (_c = props.playbackRate) !== null && _c !== void 0 ? _c : 1,
4555
4606
  onlyWarnForMediaSeekingError,
4556
4607
  acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : DEFAULT_ACCEPTABLE_TIMESHIFT,
4557
4608
  });
@@ -4633,7 +4684,13 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
4633
4684
  current.preload = 'auto';
4634
4685
  }
4635
4686
  }, []);
4636
- return (jsx("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, ...nativeProps }));
4687
+ const actualStyle = useMemo(() => {
4688
+ return {
4689
+ ...style,
4690
+ opacity: isSequenceHidden ? 0 : 1,
4691
+ };
4692
+ }, [isSequenceHidden, style]);
4693
+ return (jsx("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, ...nativeProps }));
4637
4694
  };
4638
4695
  // Copy types from forwardRef but not necessary to remove ref
4639
4696
  const VideoForDevelopment = forwardRef(VideoForDevelopmentRefForwardingFunction);
@@ -4645,7 +4702,7 @@ const VideoForDevelopment = forwardRef(VideoForDevelopmentRefForwardingFunction)
4645
4702
  const OffthreadVideo = (props) => {
4646
4703
  // Should only destruct `startFrom` and `endAt` from props,
4647
4704
  // rest gets drilled down
4648
- const { startFrom, endAt, name, ...otherProps } = props;
4705
+ const { startFrom, endAt, name, stack, ...otherProps } = props;
4649
4706
  const environment = getRemotionEnvironment();
4650
4707
  const onDuration = useCallback(() => undefined, []);
4651
4708
  if (typeof props.src !== 'string') {
@@ -4665,7 +4722,7 @@ const OffthreadVideo = (props) => {
4665
4722
  return jsx(OffthreadVideoForRendering, { ...otherProps });
4666
4723
  }
4667
4724
  const { transparent, ...withoutTransparent } = otherProps;
4668
- return (jsx(VideoForDevelopment, { _remotionInternalNativeLoopPassed: false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
4725
+ return (jsx(VideoForDevelopment, { _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: false, onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
4669
4726
  };
4670
4727
 
4671
4728
  const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, acceptableTimeShiftInSeconds, ...props }, ref) => {
@@ -4863,7 +4920,7 @@ const VideoForRendering = forwardRef(VideoForRenderingForwardFunction);
4863
4920
 
4864
4921
  const VideoForwardingFunction = (props, ref) => {
4865
4922
  var _a;
4866
- const { startFrom, endAt, name, _remotionInternalNativeLoopPassed, ...otherProps } = props;
4923
+ const { startFrom, endAt, name, stack, _remotionInternalNativeLoopPassed, ...otherProps } = props;
4867
4924
  const { loop, ...propsOtherThanLoop } = props;
4868
4925
  const { fps } = useVideoConfig();
4869
4926
  const environment = getRemotionEnvironment();
@@ -4897,7 +4954,7 @@ const VideoForwardingFunction = (props, ref) => {
4897
4954
  if (environment.isRendering) {
4898
4955
  return (jsx(VideoForRendering, { onDuration: onDuration, ...otherProps, ref: ref }));
4899
4956
  }
4900
- return (jsx(VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false }));
4957
+ return (jsx(VideoForDevelopment, { onlyWarnForMediaSeekingError: false, ...otherProps, ref: ref, onDuration: onDuration, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : null, _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed !== null && _remotionInternalNativeLoopPassed !== void 0 ? _remotionInternalNativeLoopPassed : false }));
4901
4958
  };
4902
4959
  const forward = forwardRef;
4903
4960
  /**
@@ -4905,6 +4962,7 @@ const forward = forwardRef;
4905
4962
  * @see [Documentation](https://www.remotion.dev/docs/video)
4906
4963
  */
4907
4964
  const Video = forward(VideoForwardingFunction);
4965
+ addSequenceStackTraces(Video);
4908
4966
 
4909
4967
  checkMultipleRemotionVersions();
4910
4968
  const Experimental = {
@@ -4946,5 +5004,6 @@ const Config = new Proxy(proxyObj, {
4946
5004
  };
4947
5005
  },
4948
5006
  });
5007
+ addSequenceStackTraces(Sequence);
4949
5008
 
4950
5009
  export { AbsoluteFill, Audio, Composition, Config, Easing, Experimental, Folder, FolderContext, Freeze, IFrame, Img, Internals, Loop, OffthreadVideo, Sequence, Series, Still, VERSION, Video, cancelRender, continueRender, delayRender, getInputProps, getRemotionEnvironment, getStaticFiles, interpolate, interpolateColors, measureSpring, prefetch, random, registerRoot, spring, staticFile, useCurrentFrame, useVideoConfig, watchStaticFile };