remotion 4.0.490 → 4.0.492

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.
@@ -55,6 +55,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
55
55
  }
56
56
  const { folderName, parentName } = (0, react_1.useContext)(Folder_js_1.FolderContext);
57
57
  const stack = (_b = compProps.stack) !== null && _b !== void 0 ? _b : null;
58
+ const componentFromProps = 'component' in compProps ? compProps.component : null;
58
59
  (0, react_1.useEffect)(() => {
59
60
  var _a;
60
61
  // Ensure it's a URL safe id
@@ -74,6 +75,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
74
75
  defaultProps: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)((defaultProps !== null && defaultProps !== void 0 ? defaultProps : {})),
75
76
  nonce: nonce.get(),
76
77
  parentFolderName: parentName,
78
+ componentFromProps,
77
79
  schema: schema !== null && schema !== void 0 ? schema : null,
78
80
  calculateMetadata: (_a = compProps.calculateMetadata) !== null && _a !== void 0 ? _a : null,
79
81
  stack,
@@ -92,6 +94,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
92
94
  width,
93
95
  nonce,
94
96
  parentName,
97
+ componentFromProps,
95
98
  schema,
96
99
  compProps.calculateMetadata,
97
100
  stack,
@@ -16,6 +16,7 @@ export type TComposition<Schema extends AnyZodObject, Props extends Record<strin
16
16
  folderName: string | null;
17
17
  parentFolderName: string | null;
18
18
  component: LazyExoticComponent<ComponentType<Props>> | ComponentType<Props>;
19
+ componentFromProps?: unknown;
19
20
  nonce: NonceHistory;
20
21
  schema: Schema | null;
21
22
  calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
@@ -33,6 +34,7 @@ type EnhancedTSequenceData = {
33
34
  volume: string | number;
34
35
  doesVolumeChange: boolean;
35
36
  startMediaFrom: number;
37
+ mediaFrameAtSequenceZero: number | null;
36
38
  playbackRate: number;
37
39
  frozenMediaFrame: number | null;
38
40
  } | {
@@ -41,6 +43,7 @@ type EnhancedTSequenceData = {
41
43
  volume: string | number;
42
44
  doesVolumeChange: boolean;
43
45
  startMediaFrom: number;
46
+ mediaFrameAtSequenceZero: number | null;
44
47
  playbackRate: number;
45
48
  frozenMediaFrame: number | null;
46
49
  } | {
@@ -81,6 +84,7 @@ export type TSequence = {
81
84
  effects: readonly EffectDefinition<unknown>[];
82
85
  isInsideSeries: boolean;
83
86
  frozenFrame: number | null;
87
+ singleChildComponent?: unknown;
84
88
  } & EnhancedTSequenceData;
85
89
  export type AudioOrVideoAsset = {
86
90
  type: 'audio' | 'video';
@@ -63,12 +63,12 @@ const isMissingPaintRecordError = (error) => {
63
63
  return error instanceof DOMException && error.name === 'InvalidStateError';
64
64
  };
65
65
  const missingPaintRecordMessage = 'HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.';
66
- const resizeOffscreenCanvas = ({ offscreen, width, height, }) => {
67
- if (offscreen.width !== width) {
68
- offscreen.width = width;
66
+ const resizePaintTarget = ({ target, width, height, }) => {
67
+ if (target.width !== width) {
68
+ target.width = width;
69
69
  }
70
- if (offscreen.height !== height) {
71
- offscreen.height = height;
70
+ if (target.height !== height) {
71
+ target.height = height;
72
72
  }
73
73
  };
74
74
  const defaultOnPaint = ({ canvas, element, elementImage, }) => {
@@ -80,24 +80,25 @@ const defaultOnPaint = ({ canvas, element, elementImage, }) => {
80
80
  const transform = ctx.drawElementImage(elementImage, 0, 0);
81
81
  element.style.transform = transform.toString();
82
82
  };
83
- /* eslint-enable react/require-default-props */
84
- const HtmlInCanvasAncestorContext = (0, react_1.createContext)(false);
83
+ const HtmlInCanvasAncestorContext = (0, react_1.createContext)(null);
85
84
  const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, children, onPaint, onInit, pixelDensity, controls, style, }, ref) => {
86
85
  var _a;
87
- const isInsideAncestorHtmlInCanvas = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
86
+ const ancestor = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
88
87
  assertHtmlInCanvasDimensions(width, height);
89
88
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
90
89
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
91
90
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
92
91
  const { continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
93
- const { isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
92
+ const { isClientSideRendering, isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
93
+ const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
94
+ const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
94
95
  if (!(0, exports.isHtmlInCanvasSupported)()) {
95
96
  cancelRender(new Error(exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
96
97
  }
97
98
  const canvas2dRef = (0, react_1.useRef)(null);
98
- const offscreenRef = (0, react_1.useRef)(null);
99
+ const paintTargetRef = (0, react_1.useRef)(null);
99
100
  const divRef = (0, react_1.useRef)(null);
100
- const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}`;
101
+ const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}-${usesDirectLayoutCanvas ? 'direct' : 'offscreen'}`;
101
102
  const setLayoutCanvasRef = (0, react_1.useCallback)((node) => {
102
103
  canvas2dRef.current = node;
103
104
  if (typeof ref === 'function') {
@@ -122,18 +123,20 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
122
123
  const initializedRef = (0, react_1.useRef)(false);
123
124
  const onInitCleanupRef = (0, react_1.useRef)(null);
124
125
  const unmountedRef = (0, react_1.useRef)(false);
126
+ const ancestorRef = (0, react_1.useRef)(ancestor);
127
+ ancestorRef.current = ancestor;
125
128
  const onPaintCb = (0, react_1.useCallback)(async () => {
126
129
  var _a;
127
130
  const element = divRef.current;
128
131
  if (!element) {
129
132
  throw new Error('Canvas or scene element not found');
130
133
  }
131
- const offscreen = offscreenRef.current;
132
- if (!offscreen) {
133
- throw new Error('HtmlInCanvas: offscreen canvas not ready (transferControlToOffscreen failed or canvas is remounting)');
134
+ const paintTarget = paintTargetRef.current;
135
+ if (!paintTarget) {
136
+ throw new Error('HtmlInCanvas: paint target is not ready because the canvas is remounting');
134
137
  }
135
- resizeOffscreenCanvas({
136
- offscreen,
138
+ resizePaintTarget({
139
+ target: paintTarget,
137
140
  width: canvasWidth,
138
141
  height: canvasHeight,
139
142
  });
@@ -144,34 +147,38 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
144
147
  }
145
148
  const handle = (0, delay_render_js_1.delayRender)('onPaint');
146
149
  if (!initializedRef.current) {
147
- // `onInit` may be async (e.g. WebGPU `requestAdapter`/`requestDevice`).
148
- // Capture an `ElementImage` here only for `onInit` consumers — do NOT
149
- // reuse it for the paint handler below, because awaiting `onInit`
150
- // can invalidate the capture's paint context, leaving subsequent
151
- // uploads (e.g. `copyElementImageToTexture`) failing with
152
- // "No context found for ElementImage" on the very first paint.
153
- let initImage = null;
154
- try {
155
- initImage = placeholderCanvas.captureElementImage(element);
150
+ const currentOnInit = onInitRef.current;
151
+ if (!currentOnInit) {
152
+ initializedRef.current = true;
156
153
  }
157
- catch (error) {
158
- if (isMissingPaintRecordError(error) && !isRendering) {
159
- // Element may be outside viewport (no cached paint record).
160
- // Skip init will retry on the next paint cycle.
161
- }
162
- else if (isMissingPaintRecordError(error)) {
163
- throw new Error(missingPaintRecordMessage);
154
+ else {
155
+ // `onInit` may be async (e.g. WebGPU
156
+ // `requestAdapter`/`requestDevice`). Do not reuse this capture for
157
+ // `onPaint`: awaiting initialization can invalidate its paint context.
158
+ let initImage;
159
+ try {
160
+ initImage = placeholderCanvas.captureElementImage(element);
164
161
  }
165
- else {
162
+ catch (error) {
163
+ if (isMissingPaintRecordError(error) &&
164
+ canRetryMissingPaintRecord) {
165
+ // The web renderer explicitly drives additional paint cycles, so a
166
+ // transient missing record can be retried without failing the render.
167
+ continueRender(handle);
168
+ return;
169
+ }
170
+ if (isMissingPaintRecordError(error)) {
171
+ throw new Error(missingPaintRecordMessage);
172
+ }
166
173
  throw error;
167
174
  }
168
- }
169
- if (initImage) {
170
175
  initializedRef.current = true;
171
- const currentOnInit = onInitRef.current;
172
- if (currentOnInit) {
176
+ try {
177
+ if (paintTarget instanceof HTMLCanvasElement) {
178
+ throw new Error('HtmlInCanvas: onInit requires an OffscreenCanvas paint target');
179
+ }
173
180
  const cleanup = await currentOnInit({
174
- canvas: offscreen,
181
+ canvas: paintTarget,
175
182
  element,
176
183
  elementImage: initImage,
177
184
  pixelDensity: resolvedPixelDensity,
@@ -186,9 +193,11 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
186
193
  onInitCleanupRef.current = cleanup;
187
194
  }
188
195
  }
196
+ finally {
197
+ initImage.close();
198
+ }
189
199
  }
190
200
  }
191
- const handler = (_a = onPaintRef.current) !== null && _a !== void 0 ? _a : defaultOnPaint;
192
201
  let elImage;
193
202
  try {
194
203
  elImage = placeholderCanvas.captureElementImage(element);
@@ -197,7 +206,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
197
206
  // `captureElementImage` throws `InvalidStateError` when the
198
207
  // element is outside the viewport (no cached paint record).
199
208
  // Skip this paint cycle — the canvas retains its last state.
200
- if (isMissingPaintRecordError(error) && !isRendering) {
209
+ if (isMissingPaintRecordError(error) && canRetryMissingPaintRecord) {
201
210
  continueRender(handle);
202
211
  return;
203
212
  }
@@ -206,20 +215,46 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
206
215
  }
207
216
  throw error;
208
217
  }
209
- await handler({
210
- canvas: offscreen,
211
- element,
212
- elementImage: elImage,
213
- pixelDensity: resolvedPixelDensity,
214
- });
215
- await (0, run_effect_chain_js_1.runEffectChain)({
216
- state: chainState.get(canvasWidth, canvasHeight),
217
- source: offscreen,
218
- effects: effectsRef.current,
219
- output: offscreen,
220
- width: canvasWidth,
221
- height: canvasHeight,
222
- });
218
+ try {
219
+ const currentOnPaint = onPaintRef.current;
220
+ if (currentOnPaint) {
221
+ if (paintTarget instanceof HTMLCanvasElement) {
222
+ throw new Error('HtmlInCanvas: onPaint requires an OffscreenCanvas paint target');
223
+ }
224
+ const paintResult = currentOnPaint({
225
+ canvas: paintTarget,
226
+ element,
227
+ elementImage: elImage,
228
+ pixelDensity: resolvedPixelDensity,
229
+ });
230
+ if (paintResult) {
231
+ await paintResult;
232
+ }
233
+ }
234
+ else {
235
+ defaultOnPaint({
236
+ canvas: paintTarget,
237
+ element,
238
+ elementImage: elImage,
239
+ pixelDensity: resolvedPixelDensity,
240
+ });
241
+ }
242
+ await (0, run_effect_chain_js_1.runEffectChain)({
243
+ state: chainState.get(canvasWidth, canvasHeight),
244
+ source: paintTarget,
245
+ effects: effectsRef.current,
246
+ output: paintTarget,
247
+ width: canvasWidth,
248
+ height: canvasHeight,
249
+ });
250
+ }
251
+ finally {
252
+ elImage.close();
253
+ }
254
+ // Effects may complete after Chromium has dispatched the parent's
255
+ // paint event. Repaint the direct parent so deeply nested canvases
256
+ // propagate their final pixels through every ancestor.
257
+ (_a = ancestorRef.current) === null || _a === void 0 ? void 0 : _a.requestParentPaint();
223
258
  continueRender(handle);
224
259
  }
225
260
  catch (error) {
@@ -232,20 +267,23 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
232
267
  continueRender,
233
268
  cancelRender,
234
269
  resolvedPixelDensity,
235
- isRendering,
270
+ canRetryMissingPaintRecord,
236
271
  ]);
237
- // Transfer control once per layout canvas instance, then listen for paint on
238
- // the placeholder (capture) while drawing on the linked offscreen surface.
272
+ // Default paint handlers draw synchronously on the layout canvas itself so
273
+ // Chromium can include their final pixels during its deepest-first nested
274
+ // paint traversal. Custom handlers retain the transferred OffscreenCanvas API.
239
275
  (0, react_1.useLayoutEffect)(() => {
240
276
  const placeholder = canvas2dRef.current;
241
277
  if (!placeholder) {
242
278
  throw new Error('Canvas not found');
243
279
  }
244
280
  placeholder.layoutSubtree = true;
245
- const offscreen = placeholder.transferControlToOffscreen();
246
- offscreenRef.current = offscreen;
247
- resizeOffscreenCanvas({
248
- offscreen,
281
+ const paintTarget = usesDirectLayoutCanvas
282
+ ? placeholder
283
+ : placeholder.transferControlToOffscreen();
284
+ paintTargetRef.current = paintTarget;
285
+ resizePaintTarget({
286
+ target: paintTarget,
249
287
  width: canvasWidth,
250
288
  height: canvasHeight,
251
289
  });
@@ -255,13 +293,19 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
255
293
  return () => {
256
294
  var _a;
257
295
  placeholder.removeEventListener('paint', onPaintCb);
258
- offscreenRef.current = null;
296
+ paintTargetRef.current = null;
259
297
  initializedRef.current = false;
260
298
  unmountedRef.current = true;
261
299
  (_a = onInitCleanupRef.current) === null || _a === void 0 ? void 0 : _a.call(onInitCleanupRef);
262
300
  onInitCleanupRef.current = null;
263
301
  };
264
- }, [onPaintCb, cancelRender, canvasWidth, canvasHeight]);
302
+ }, [
303
+ onPaintCb,
304
+ cancelRender,
305
+ canvasWidth,
306
+ canvasHeight,
307
+ usesDirectLayoutCanvas,
308
+ ]);
265
309
  const onPaintChangedRef = (0, react_1.useRef)(false);
266
310
  (0, react_1.useLayoutEffect)(() => {
267
311
  var _a;
@@ -301,10 +345,15 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
301
345
  ...(style !== null && style !== void 0 ? style : {}),
302
346
  };
303
347
  }, [height, style, width]);
304
- if (isInsideAncestorHtmlInCanvas) {
305
- throw new Error('<HtmlInCanvas> effects cannot be nested together. Chrome will only display the outer effect. Consider merging the effects into one if you can.');
306
- }
307
- return (jsx_runtime_1.jsx(HtmlInCanvasAncestorContext.Provider, { value: true, children: jsx_runtime_1.jsx("canvas", { ref: setLayoutCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle, children: jsx_runtime_1.jsx("div", { ref: divRef, style: innerStyle, children: children }) }, canvasSizeKey) }));
348
+ const ancestorValue = (0, react_1.useMemo)(() => {
349
+ return {
350
+ requestParentPaint: () => {
351
+ var _a, _b;
352
+ (_b = (_a = canvas2dRef.current) === null || _a === void 0 ? void 0 : _a.requestPaint) === null || _b === void 0 ? void 0 : _b.call(_a);
353
+ },
354
+ };
355
+ }, []);
356
+ return (jsx_runtime_1.jsx(HtmlInCanvasAncestorContext.Provider, { value: ancestorValue, children: jsx_runtime_1.jsx("canvas", { ref: setLayoutCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle, children: jsx_runtime_1.jsx("div", { ref: divRef, style: innerStyle, children: children }) }, canvasSizeKey) }));
308
357
  });
309
358
  HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
310
359
  const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
package/dist/cjs/Img.d.ts CHANGED
@@ -82,6 +82,12 @@ export declare const imgSchema: {
82
82
  readonly hidden: import("./interactivity-schema.js").BooleanFieldSchema;
83
83
  readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
84
84
  readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
85
+ readonly src: {
86
+ readonly type: "asset";
87
+ readonly default: undefined;
88
+ readonly description: "Source";
89
+ readonly keyframable: false;
90
+ };
85
91
  };
86
92
  export declare const Img: React.ComponentType<NativeImgProps & {
87
93
  readonly maxRetries?: number | undefined;
package/dist/cjs/Img.js CHANGED
@@ -198,6 +198,12 @@ const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, trimBe
198
198
  };
199
199
  const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
200
200
  exports.imgSchema = {
201
+ src: {
202
+ type: 'asset',
203
+ default: undefined,
204
+ description: 'Source',
205
+ keyframable: false,
206
+ },
201
207
  ...interactivity_schema_js_1.baseSchema,
202
208
  ...interactivity_schema_js_1.transformSchema,
203
209
  };
@@ -46,6 +46,10 @@ export type SequencePropsWithoutDuration = {
46
46
  * @deprecated For internal use only.
47
47
  */
48
48
  readonly _remotionInternalDocumentationLink?: string;
49
+ /**
50
+ * @deprecated For internal use only.
51
+ */
52
+ readonly _remotionInternalSingleChildComponent?: unknown;
49
53
  /**
50
54
  * @deprecated For internal use only.
51
55
  */
@@ -19,7 +19,7 @@ const use_video_config_js_1 = require("./use-video-config.js");
19
19
  const v5_flag_js_1 = require("./v5-flag.js");
20
20
  const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
21
21
  const EMPTY_EFFECTS = [];
22
- const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, outlineRef: passedRefForOutline, ...other }, ref) => {
22
+ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalSingleChildComponent: singleChildComponent, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, outlineRef: passedRefForOutline, ...other }, ref) => {
23
23
  var _a, _b, _c;
24
24
  const { layout = 'absolute-fill' } = other;
25
25
  const [id] = (0, react_1.useState)(() => String(Math.random()));
@@ -210,6 +210,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
210
210
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
211
211
  isInsideSeries,
212
212
  frozenFrame: registeredFrozenFrame,
213
+ singleChildComponent: singleChildComponent !== null && singleChildComponent !== void 0 ? singleChildComponent : null,
213
214
  });
214
215
  }
215
216
  else {
@@ -235,11 +236,13 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
235
236
  src: isMedia.data.src,
236
237
  getStack: () => stackRef.current,
237
238
  startMediaFrom: startMediaFrom !== null && startMediaFrom !== void 0 ? startMediaFrom : isMedia.data.startMediaFrom,
239
+ mediaFrameAtSequenceZero,
238
240
  volume: isMedia.data.volumes,
239
241
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
240
242
  isInsideSeries,
241
243
  frozenFrame: registeredFrozenFrame,
242
244
  frozenMediaFrame,
245
+ singleChildComponent: singleChildComponent !== null && singleChildComponent !== void 0 ? singleChildComponent : null,
243
246
  });
244
247
  }
245
248
  return () => {
@@ -267,6 +270,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
267
270
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
268
271
  isInsideSeries,
269
272
  frozenFrame: registeredFrozenFrame,
273
+ singleChildComponent: singleChildComponent !== null && singleChildComponent !== void 0 ? singleChildComponent : null,
270
274
  });
271
275
  return () => {
272
276
  unregisterSequence(id);
@@ -298,7 +302,9 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
298
302
  isInsideSeries,
299
303
  registeredFrozenFrame,
300
304
  startMediaFrom,
305
+ mediaFrameAtSequenceZero,
301
306
  frozenMediaFrame,
307
+ singleChildComponent,
302
308
  ]);
303
309
  // Ceil to support floats
304
310
  // https://github.com/remotion-dev/remotion/issues/2958
@@ -64,6 +64,13 @@ export type SequencePropsSubscriptionKey = {
64
64
  nodePath: SequenceNodePath;
65
65
  sequenceKeys: string[];
66
66
  effectKeys: string[][];
67
+ videoConfigValues: VideoConfigValues | null;
68
+ };
69
+ export type VideoConfigValues = {
70
+ durationInFrames: number;
71
+ fps: number;
72
+ height: number;
73
+ width: number;
67
74
  };
68
75
  export declare const SequenceManagerProvider: React.FC<{
69
76
  readonly children: React.ReactNode;
@@ -49,7 +49,7 @@ exports.SequenceManagerRefContext = react_1.default.createContext({
49
49
  current: [],
50
50
  });
51
51
  const makeSequencePropsSubscriptionKey = (key) => {
52
- return `${key.nodePath.join('.')}.${key.sequenceKeys.join('.')}.${key.effectKeys.map((keys) => keys.join('.')).join('.')}`;
52
+ return `${key.absolutePath}\0${key.nodePath.join('.')}\0${key.sequenceKeys.join('.')}\0${key.effectKeys.map((keys) => keys.join('.')).join('.')}`;
53
53
  };
54
54
  exports.makeSequencePropsSubscriptionKey = makeSequencePropsSubscriptionKey;
55
55
  exports.VisualModePropStatusesContext = react_1.default.createContext({
@@ -17,6 +17,12 @@ const decode_image_js_1 = require("./decode-image.js");
17
17
  const request_init_1 = require("./request-init");
18
18
  const resolve_image_source_1 = require("./resolve-image-source");
19
19
  const animatedImageSchema = {
20
+ src: {
21
+ type: 'asset',
22
+ default: undefined,
23
+ description: 'Source',
24
+ keyframable: false,
25
+ },
20
26
  ...interactivity_schema_js_1.baseSchema,
21
27
  playbackRate: {
22
28
  type: 'number',
@@ -321,7 +321,9 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
321
321
  return;
322
322
  }
323
323
  if (data === undefined) {
324
- current.src = EMPTY_AUDIO;
324
+ if (current.src !== EMPTY_AUDIO) {
325
+ current.src = EMPTY_AUDIO;
326
+ }
325
327
  return;
326
328
  }
327
329
  if (!data) {
@@ -393,7 +395,9 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
393
395
  prevA.premounting === premounting &&
394
396
  prevA.postmounting === postmounting;
395
397
  if (isTheSame) {
396
- return prevA;
398
+ return prevA.audioMounted === audioMounted
399
+ ? prevA
400
+ : { ...prevA, audioMounted };
397
401
  }
398
402
  changed = true;
399
403
  return {
@@ -405,7 +409,9 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
405
409
  audioMounted,
406
410
  };
407
411
  }
408
- return prevA;
412
+ return prevA.audioMounted === audioMounted
413
+ ? prevA
414
+ : { ...prevA, audioMounted };
409
415
  });
410
416
  if (changed) {
411
417
  rerenderAudios();
@@ -444,13 +450,16 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
444
450
  unregisterAudio,
445
451
  updateAudio,
446
452
  ]);
447
- return (jsx_runtime_1.jsxs(exports.SharedAudioTagsContext.Provider, { value: audioTagsValue, children: [refs.map(({ id, ref }) => {
448
- return (
449
- // Without preload="metadata", iOS will seek the time internally
450
- // but not actually with sound. Adding `preload="metadata"` helps here.
451
- // https://discord.com/channels/809501355504959528/817306414069710848/1130519583367888906
452
- jsx_runtime_1.jsx("audio", { ref: ref, preload: "metadata", src: EMPTY_AUDIO }, id));
453
- }), children] }));
453
+ const sharedAudioTagElements = (0, react_1.useMemo)(() => {
454
+ return refs.map(({ id, ref }) => {
455
+ return (
456
+ // Without preload="metadata", iOS will seek the time internally
457
+ // but not actually with sound. Adding `preload="metadata"` helps here.
458
+ // https://discord.com/channels/809501355504959528/817306414069710848/1130519583367888906
459
+ jsx_runtime_1.jsx("audio", { ref: ref, preload: "metadata", src: EMPTY_AUDIO }, id));
460
+ });
461
+ }, [refs]);
462
+ return (jsx_runtime_1.jsxs(exports.SharedAudioTagsContext.Provider, { value: audioTagsValue, children: [sharedAudioTagElements, children] }));
454
463
  };
455
464
  exports.SharedAudioTagsContextProvider = SharedAudioTagsContextProvider;
456
465
  const useSharedAudio = ({ aud, audioId, premounting, postmounting, }) => {
@@ -1,2 +1,6 @@
1
+ import React from 'react';
1
2
  export declare const getComponentsToAddStacksTo: () => unknown[];
2
3
  export declare const addSequenceStackTraces: (component: unknown) => void;
4
+ export declare const setSequenceComponent: (component: unknown) => void;
5
+ export declare const getSequenceComponent: () => unknown;
6
+ export declare const getSingleChildComponent: (children: React.ReactNode) => unknown;
@@ -1,10 +1,36 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addSequenceStackTraces = exports.getComponentsToAddStacksTo = void 0;
6
+ exports.getSingleChildComponent = exports.getSequenceComponent = exports.setSequenceComponent = exports.addSequenceStackTraces = exports.getComponentsToAddStacksTo = void 0;
7
+ const react_1 = __importDefault(require("react"));
4
8
  const componentsToAddStacksTo = [];
9
+ let sequenceComponent = null;
5
10
  const getComponentsToAddStacksTo = () => componentsToAddStacksTo;
6
11
  exports.getComponentsToAddStacksTo = getComponentsToAddStacksTo;
7
12
  const addSequenceStackTraces = (component) => {
8
13
  componentsToAddStacksTo.push(component);
9
14
  };
10
15
  exports.addSequenceStackTraces = addSequenceStackTraces;
16
+ const setSequenceComponent = (component) => {
17
+ sequenceComponent = component;
18
+ };
19
+ exports.setSequenceComponent = setSequenceComponent;
20
+ const getSequenceComponent = () => sequenceComponent;
21
+ exports.getSequenceComponent = getSequenceComponent;
22
+ const getSingleChildComponent = (children) => {
23
+ const mountedChildren = react_1.default.Children.toArray(children);
24
+ if (mountedChildren.length !== 1) {
25
+ return null;
26
+ }
27
+ const child = mountedChildren[0];
28
+ if (!react_1.default.isValidElement(child)) {
29
+ return null;
30
+ }
31
+ if (typeof child.type !== 'function' && typeof child.type !== 'object') {
32
+ return null;
33
+ }
34
+ return child.type;
35
+ };
36
+ exports.getSingleChildComponent = getSingleChildComponent;
@@ -5,7 +5,7 @@ import type { AnyCompMetadata, AnyComposition, AudioOrVideoAsset, JsxComponentId
5
5
  import type { DelayRenderScope } from './delay-render.js';
6
6
  import { type TFolder } from './Folder.js';
7
7
  import type { StaticFile } from './get-static-files.js';
8
- import type { ArrayFieldSchema, ArrayItemFieldSchema, InteractivitySchemaField, InteractivitySchema } from './interactivity-schema.js';
8
+ import type { AssetFieldSchema, ArrayFieldSchema, ArrayItemFieldSchema, InteractivitySchemaField, InteractivitySchema } from './interactivity-schema.js';
9
9
  import type { LogLevel } from './log.js';
10
10
  import type { ProResProfile } from './prores-profile.js';
11
11
  import type { PixelFormat, VideoImageFormat } from './render-types.js';
@@ -43,6 +43,7 @@ declare global {
43
43
  remotion_logLevel: LogLevel | undefined;
44
44
  remotion_projectName: string;
45
45
  remotion_cwd: string;
46
+ remotion_fileSystemPlatform: string | null;
46
47
  remotion_studioServerCommand: string;
47
48
  remotion_setFrame: (frame: number, composition: string, attempt: number) => void;
48
49
  remotion_attempt: number;
@@ -182,4 +183,4 @@ export type _InternalTypes = {
182
183
  TRenderAsset: TRenderAsset;
183
184
  ProResProfile: ProResProfile;
184
185
  };
185
- export type { AnyComposition, ArrayFieldSchema, ArrayItemFieldSchema, DelayRenderScope, JsxComponentIdentity, LoopDisplay, SequenceControls, InteractivitySchemaField, InteractivitySchema, UseBufferState, };
186
+ export type { AnyComposition, AssetFieldSchema, ArrayFieldSchema, ArrayItemFieldSchema, DelayRenderScope, JsxComponentIdentity, LoopDisplay, SequenceControls, InteractivitySchemaField, InteractivitySchema, UseBufferState, };
package/dist/cjs/index.js CHANGED
@@ -154,5 +154,6 @@ exports.Config = new Proxy(proxyObj, {
154
154
  });
155
155
  Sequence_js_1.Sequence.displayName = 'Sequence';
156
156
  (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Sequence_js_1.Sequence);
157
+ (0, enable_sequence_stack_traces_js_1.setSequenceComponent)(Sequence_js_1.Sequence);
157
158
  (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Composition_js_1.Composition);
158
159
  (0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Folder_js_1.Folder);
@@ -97,6 +97,12 @@ export type FontFamilyFieldSchema = {
97
97
  description?: string;
98
98
  keyframable?: false;
99
99
  };
100
+ export type AssetFieldSchema = {
101
+ type: 'asset';
102
+ default: string | undefined;
103
+ description?: string;
104
+ keyframable?: false;
105
+ };
100
106
  export type EnumFieldSchema = {
101
107
  type: 'enum';
102
108
  default: string;
@@ -126,7 +132,7 @@ export type ArrayFieldSchema = {
126
132
  description?: string;
127
133
  keyframable?: false;
128
134
  };
129
- export type VisibleFieldSchema = NumberFieldSchema | BooleanFieldSchema | RotationCssFieldSchema | RotationDegreesFieldSchema | TranslateFieldSchema | TransformOriginFieldSchema | ScaleFieldSchema | UvCoordinateFieldSchema | ColorFieldSchema | TextContentFieldSchema | FontFamilyFieldSchema | ArrayFieldSchema | EnumFieldSchema;
135
+ export type VisibleFieldSchema = NumberFieldSchema | BooleanFieldSchema | RotationCssFieldSchema | RotationDegreesFieldSchema | TranslateFieldSchema | TransformOriginFieldSchema | ScaleFieldSchema | UvCoordinateFieldSchema | ColorFieldSchema | TextContentFieldSchema | FontFamilyFieldSchema | AssetFieldSchema | ArrayFieldSchema | EnumFieldSchema;
130
136
  export type InteractivitySchemaField = VisibleFieldSchema | HiddenFieldSchema;
131
137
  export type InteractivitySchema = {
132
138
  [key: string]: InteractivitySchemaField;