remotion 4.0.489 → 4.0.491
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.
- package/dist/cjs/CompositionManager.d.ts +2 -0
- package/dist/cjs/HtmlInCanvas.d.ts +1 -0
- package/dist/cjs/HtmlInCanvas.js +116 -67
- package/dist/cjs/Img.d.ts +1 -0
- package/dist/cjs/Interactive.d.ts +9 -10
- package/dist/cjs/Interactive.js +27 -4
- package/dist/cjs/Sequence.js +2 -0
- package/dist/cjs/SequenceManager.d.ts +7 -0
- package/dist/cjs/SequenceManager.js +1 -1
- package/dist/cjs/audio/shared-audio-tags.js +19 -10
- package/dist/cjs/canvas-image/CanvasImage.d.ts +1 -0
- package/dist/cjs/delay-render.d.ts +9 -5
- package/dist/cjs/delay-render.js +16 -31
- package/dist/cjs/effects/Solid.d.ts +1 -0
- package/dist/cjs/flatten-schema.js +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/interactivity-schema.d.ts +9 -1
- package/dist/cjs/interactivity-schema.js +1 -0
- package/dist/cjs/internals.d.ts +7 -3
- package/dist/cjs/interpolate-keyframed-status.js +1 -0
- package/dist/cjs/interpolate.d.ts +2 -0
- package/dist/cjs/interpolate.js +46 -7
- package/dist/cjs/no-react.d.ts +2 -1
- package/dist/cjs/series/index.js +107 -34
- package/dist/cjs/use-media-in-timeline.js +1 -0
- package/dist/cjs/use-schema.d.ts +19 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/with-interactivity-schema.d.ts +5 -4
- package/dist/esm/index.mjs +321 -149
- package/dist/esm/no-react.mjs +49 -11
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -33,6 +33,7 @@ type EnhancedTSequenceData = {
|
|
|
33
33
|
volume: string | number;
|
|
34
34
|
doesVolumeChange: boolean;
|
|
35
35
|
startMediaFrom: number;
|
|
36
|
+
mediaFrameAtSequenceZero: number | null;
|
|
36
37
|
playbackRate: number;
|
|
37
38
|
frozenMediaFrame: number | null;
|
|
38
39
|
} | {
|
|
@@ -41,6 +42,7 @@ type EnhancedTSequenceData = {
|
|
|
41
42
|
volume: string | number;
|
|
42
43
|
doesVolumeChange: boolean;
|
|
43
44
|
startMediaFrom: number;
|
|
45
|
+
mediaFrameAtSequenceZero: number | null;
|
|
44
46
|
playbackRate: number;
|
|
45
47
|
frozenMediaFrame: number | null;
|
|
46
48
|
} | {
|
package/dist/cjs/HtmlInCanvas.js
CHANGED
|
@@ -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
|
|
67
|
-
if (
|
|
68
|
-
|
|
66
|
+
const resizePaintTarget = ({ target, width, height, }) => {
|
|
67
|
+
if (target.width !== width) {
|
|
68
|
+
target.width = width;
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
71
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
132
|
-
if (!
|
|
133
|
-
throw new Error('HtmlInCanvas:
|
|
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
|
-
|
|
136
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
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
|
-
|
|
172
|
-
|
|
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:
|
|
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) &&
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
|
|
270
|
+
canRetryMissingPaintRecord,
|
|
236
271
|
]);
|
|
237
|
-
//
|
|
238
|
-
//
|
|
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
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
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
|
-
}, [
|
|
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
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { SequenceControls } from './CompositionManager.js';
|
|
3
2
|
import { type InteractivitySchema } from './interactivity-schema.js';
|
|
4
3
|
import type { AbsoluteFillLayout, SequenceProps } from './Sequence.js';
|
|
4
|
+
import { type WithInteractivitySchemaOptions } from './with-interactivity-schema.js';
|
|
5
5
|
type InteractiveHtmlTag = 'a' | 'article' | 'aside' | 'button' | 'code' | 'div' | 'em' | 'footer' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'header' | 'label' | 'li' | 'main' | 'nav' | 'ol' | 'p' | 'pre' | 'section' | 'small' | 'span' | 'strong' | 'ul';
|
|
6
6
|
type InteractiveSvgTag = 'circle' | 'ellipse' | 'g' | 'line' | 'path' | 'rect' | 'svg' | 'text';
|
|
7
7
|
type InteractiveTag = InteractiveHtmlTag | InteractiveSvgTag;
|
|
@@ -17,6 +17,7 @@ type InteractiveSequenceProps = InteractiveBaseProps & {
|
|
|
17
17
|
};
|
|
18
18
|
type InteractiveElementProps<Tag extends InteractiveTag> = Omit<React.ComponentPropsWithoutRef<Tag>, keyof InteractiveSequenceProps> & InteractiveSequenceProps;
|
|
19
19
|
type InteractiveElementComponent<Tag extends InteractiveTag> = React.ComponentType<InteractiveElementProps<Tag> & React.RefAttributes<ElementForTag<Tag>>>;
|
|
20
|
+
type RemotionComponentIdentityPackage = 'remotion' | `@remotion/${string}`;
|
|
20
21
|
/**
|
|
21
22
|
* @description HTML and SVG elements that are registered in the Remotion Studio timeline and can be visually edited.
|
|
22
23
|
*/
|
|
@@ -71,6 +72,7 @@ export declare const Interactive: {
|
|
|
71
72
|
readonly step: 0.01;
|
|
72
73
|
readonly default: 1;
|
|
73
74
|
readonly description: "Scale";
|
|
75
|
+
readonly defaultKeyframeOutput: "perceptual-scale";
|
|
74
76
|
};
|
|
75
77
|
readonly 'style.rotate': {
|
|
76
78
|
readonly type: "rotation-css";
|
|
@@ -242,6 +244,7 @@ export declare const Interactive: {
|
|
|
242
244
|
readonly step: 0.01;
|
|
243
245
|
readonly default: 1;
|
|
244
246
|
readonly description: "Scale";
|
|
247
|
+
readonly defaultKeyframeOutput: "perceptual-scale";
|
|
245
248
|
};
|
|
246
249
|
readonly 'style.rotate': {
|
|
247
250
|
readonly type: "rotation-css";
|
|
@@ -284,15 +287,11 @@ export declare const Interactive: {
|
|
|
284
287
|
};
|
|
285
288
|
};
|
|
286
289
|
};
|
|
287
|
-
withSchema: <S extends InteractivitySchema, Props extends object>(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
componentIdentity: string | null;
|
|
293
|
-
schema: S;
|
|
294
|
-
supportsEffects: boolean;
|
|
295
|
-
}) => React.ComponentType<Props>;
|
|
290
|
+
withSchema: <S extends InteractivitySchema, Props extends object>(options: WithInteractivitySchemaOptions<S, Props>) => React.ComponentType<Props>;
|
|
291
|
+
_internalMakeRemotionComponentIdentity: ({ packageName, componentName, }: {
|
|
292
|
+
readonly packageName: RemotionComponentIdentityPackage;
|
|
293
|
+
readonly componentName: string;
|
|
294
|
+
}) => string;
|
|
296
295
|
A: InteractiveElementComponent<"a">;
|
|
297
296
|
Article: InteractiveElementComponent<"article">;
|
|
298
297
|
Aside: InteractiveElementComponent<"aside">;
|
package/dist/cjs/Interactive.js
CHANGED
|
@@ -40,6 +40,21 @@ const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-trace
|
|
|
40
40
|
const interactivity_schema_js_1 = require("./interactivity-schema.js");
|
|
41
41
|
const Sequence_js_1 = require("./Sequence.js");
|
|
42
42
|
const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
|
|
43
|
+
const sourcePathToIdentityPrefix = (packageName) => {
|
|
44
|
+
if (packageName === 'remotion') {
|
|
45
|
+
return 'dev.remotion.remotion';
|
|
46
|
+
}
|
|
47
|
+
if (packageName.startsWith('@remotion/')) {
|
|
48
|
+
const normalizedPackageName = packageName
|
|
49
|
+
.slice('@remotion/'.length)
|
|
50
|
+
.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
51
|
+
return `dev.remotion.${normalizedPackageName}`;
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`Unsupported Remotion package name: ${packageName}`);
|
|
54
|
+
};
|
|
55
|
+
const makeRemotionComponentIdentity = ({ packageName, componentName, }) => {
|
|
56
|
+
return `${sourcePathToIdentityPrefix(packageName)}.${componentName}`;
|
|
57
|
+
};
|
|
43
58
|
const interactiveElementSchema = {
|
|
44
59
|
...interactivity_schema_js_1.baseSchema,
|
|
45
60
|
...interactivity_schema_js_1.transformSchema,
|
|
@@ -54,6 +69,11 @@ const setRef = (ref, value) => {
|
|
|
54
69
|
ref.current = value;
|
|
55
70
|
}
|
|
56
71
|
};
|
|
72
|
+
const withSchema = (options) => {
|
|
73
|
+
const Wrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)(options);
|
|
74
|
+
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Wrapped);
|
|
75
|
+
return Wrapped;
|
|
76
|
+
};
|
|
57
77
|
const makeInteractiveElement = (tag, displayName) => {
|
|
58
78
|
const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
|
|
59
79
|
const { durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, stack, controls, ...props } = propsWithControls;
|
|
@@ -68,15 +88,17 @@ const makeInteractiveElement = (tag, displayName) => {
|
|
|
68
88
|
}) }));
|
|
69
89
|
});
|
|
70
90
|
Inner.displayName = displayName;
|
|
71
|
-
const Wrapped = (
|
|
91
|
+
const Wrapped = withSchema({
|
|
72
92
|
Component: Inner,
|
|
73
93
|
componentName: displayName,
|
|
74
|
-
componentIdentity:
|
|
94
|
+
componentIdentity: makeRemotionComponentIdentity({
|
|
95
|
+
packageName: 'remotion',
|
|
96
|
+
componentName: displayName.slice(1, -1),
|
|
97
|
+
}),
|
|
75
98
|
schema: interactiveElementSchema,
|
|
76
99
|
supportsEffects: false,
|
|
77
100
|
});
|
|
78
101
|
Wrapped.displayName = displayName;
|
|
79
|
-
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Wrapped);
|
|
80
102
|
return Wrapped;
|
|
81
103
|
};
|
|
82
104
|
/**
|
|
@@ -88,7 +110,8 @@ exports.Interactive = {
|
|
|
88
110
|
textSchema: interactivity_schema_js_1.textSchema,
|
|
89
111
|
premountSchema: interactivity_schema_js_1.premountSchema,
|
|
90
112
|
sequenceSchema: interactivity_schema_js_1.sequenceSchema,
|
|
91
|
-
withSchema
|
|
113
|
+
withSchema,
|
|
114
|
+
_internalMakeRemotionComponentIdentity: makeRemotionComponentIdentity,
|
|
92
115
|
A: makeInteractiveElement('a', '<Interactive.A>'),
|
|
93
116
|
Article: makeInteractiveElement('article', '<Interactive.Article>'),
|
|
94
117
|
Aside: makeInteractiveElement('aside', '<Interactive.Aside>'),
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -235,6 +235,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
235
235
|
src: isMedia.data.src,
|
|
236
236
|
getStack: () => stackRef.current,
|
|
237
237
|
startMediaFrom: startMediaFrom !== null && startMediaFrom !== void 0 ? startMediaFrom : isMedia.data.startMediaFrom,
|
|
238
|
+
mediaFrameAtSequenceZero,
|
|
238
239
|
volume: isMedia.data.volumes,
|
|
239
240
|
refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
|
|
240
241
|
isInsideSeries,
|
|
@@ -298,6 +299,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
298
299
|
isInsideSeries,
|
|
299
300
|
registeredFrozenFrame,
|
|
300
301
|
startMediaFrom,
|
|
302
|
+
mediaFrameAtSequenceZero,
|
|
301
303
|
frozenMediaFrame,
|
|
302
304
|
]);
|
|
303
305
|
// Ceil to support floats
|
|
@@ -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('.')}
|
|
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({
|
|
@@ -321,7 +321,9 @@ const SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
323
|
if (data === undefined) {
|
|
324
|
-
current.src
|
|
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
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
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,3 +1,4 @@
|
|
|
1
|
+
import type { LogLevel } from './log.js';
|
|
1
2
|
import type { RemotionEnvironment } from './remotion-environment-context.js';
|
|
2
3
|
export type DelayRenderScope = {
|
|
3
4
|
remotion_renderReady: boolean;
|
|
@@ -26,21 +27,24 @@ export type DelayRenderOptions = {
|
|
|
26
27
|
* This allows useDelayRender to control its own environment source.
|
|
27
28
|
* @private
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
+
type DelayRenderInternalOptions = {
|
|
30
31
|
scope: DelayRenderScope;
|
|
31
32
|
environment: RemotionEnvironment;
|
|
32
33
|
label: string | null;
|
|
33
34
|
options: DelayRenderOptions;
|
|
34
|
-
}
|
|
35
|
+
};
|
|
36
|
+
export declare const delayRenderInternal: ({ scope, environment, label, options, }: DelayRenderInternalOptions) => number;
|
|
35
37
|
export declare const delayRender: (label?: string | undefined, options?: DelayRenderOptions | undefined) => number;
|
|
36
38
|
/**
|
|
37
39
|
* Internal function that accepts environment as parameter.
|
|
38
40
|
* @private
|
|
39
41
|
*/
|
|
40
|
-
|
|
42
|
+
type ContinueRenderInternalOptions = {
|
|
41
43
|
scope: DelayRenderScope;
|
|
42
44
|
handle: number;
|
|
43
45
|
environment: RemotionEnvironment;
|
|
44
|
-
logLevel:
|
|
45
|
-
}
|
|
46
|
+
logLevel: LogLevel;
|
|
47
|
+
};
|
|
48
|
+
export declare const continueRenderInternal: ({ scope, handle, environment, logLevel, }: ContinueRenderInternalOptions) => void;
|
|
46
49
|
export declare const continueRender: (handle: number) => void;
|
|
50
|
+
export {};
|