remotion 4.0.513 → 4.0.515
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 +3 -0
- package/dist/cjs/HtmlInCanvas.js +8 -37
- package/dist/cjs/Sequence.js +9 -0
- package/dist/cjs/audio/AudioForPreview.js +1 -0
- package/dist/cjs/delay-render-constants.d.ts +4 -0
- package/dist/cjs/delay-render-constants.js +7 -0
- package/dist/cjs/delay-render.d.ts +1 -5
- package/dist/cjs/delay-render.js +11 -9
- package/dist/cjs/effects/use-memoized-effects.d.ts +5 -2
- package/dist/cjs/effects/use-memoized-effects.js +20 -7
- package/dist/cjs/internals.d.ts +18 -3
- package/dist/cjs/internals.js +7 -0
- package/dist/cjs/interpolate-translate.d.ts +8 -0
- package/dist/cjs/interpolate-translate.js +70 -0
- package/dist/cjs/loading-indicator.js +11 -5
- package/dist/cjs/media-resource-manager.d.ts +25 -0
- package/dist/cjs/media-resource-manager.js +112 -0
- package/dist/cjs/no-react.js +5 -5
- package/dist/cjs/sequence-field-schema.d.ts +425 -0
- package/dist/cjs/sequence-field-schema.js +133 -0
- package/dist/cjs/use-media-in-timeline.d.ts +5 -2
- package/dist/cjs/use-media-in-timeline.js +15 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +1 -0
- package/dist/cjs/wrap-in-schema.d.ts +20 -0
- package/dist/cjs/wrap-in-schema.js +203 -0
- package/dist/esm/index.mjs +281 -141
- package/dist/esm/no-react.mjs +6 -13
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -34,6 +34,7 @@ type EnhancedTSequenceData = {
|
|
|
34
34
|
src: string;
|
|
35
35
|
volume: string | number;
|
|
36
36
|
doesVolumeChange: boolean;
|
|
37
|
+
muted: boolean;
|
|
37
38
|
startMediaFrom: number;
|
|
38
39
|
mediaFrameAtSequenceZero: number | null;
|
|
39
40
|
playbackRate: number;
|
|
@@ -43,6 +44,7 @@ type EnhancedTSequenceData = {
|
|
|
43
44
|
src: string;
|
|
44
45
|
volume: string | number;
|
|
45
46
|
doesVolumeChange: boolean;
|
|
47
|
+
muted: boolean;
|
|
46
48
|
startMediaFrom: number;
|
|
47
49
|
mediaFrameAtSequenceZero: number | null;
|
|
48
50
|
playbackRate: number;
|
|
@@ -85,6 +87,7 @@ export type TSequence = {
|
|
|
85
87
|
controls: SequenceRegistrationControls | null;
|
|
86
88
|
refForOutline: React.RefObject<Element | null> | null;
|
|
87
89
|
effects: readonly EffectDefinition<unknown>[];
|
|
90
|
+
effectRuntimeValues: readonly RuntimeValueStore[] | null;
|
|
88
91
|
isInsideSeries: boolean;
|
|
89
92
|
frozenFrame: number | null;
|
|
90
93
|
singleChildComponent?: unknown;
|
package/dist/cjs/HtmlInCanvas.js
CHANGED
|
@@ -53,17 +53,6 @@ const isHtmlInCanvasSupported = () => {
|
|
|
53
53
|
exports.isHtmlInCanvasSupported = isHtmlInCanvasSupported;
|
|
54
54
|
/** Shown when {@link isHtmlInCanvasSupported} is false: APIs are absent (old Chrome and/or flag off). */
|
|
55
55
|
exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = 'HTML in Canvas is not supported. Two common causes: Chrome is older than version 148 (update Chrome), or the HTML-in-Canvas flag is disabled at chrome://flags/#canvas-draw-element (enable it and restart Chrome).';
|
|
56
|
-
const MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS = 152;
|
|
57
|
-
const getChromeMajorVersion = () => {
|
|
58
|
-
if (typeof navigator === 'undefined') {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
const match = navigator.userAgent.match(/\b(?:HeadlessChrome|Chrome)\/(\d+)/);
|
|
62
|
-
if (!match) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
return Number(match[1]);
|
|
66
|
-
};
|
|
67
56
|
function assertHtmlInCanvasDimensions(width, height) {
|
|
68
57
|
if (typeof width !== 'number' || typeof height !== 'number') {
|
|
69
58
|
throw new Error(`HtmlInCanvas: \`width\` and \`height\` must be numbers. Received width=${String(width)}, height=${String(height)}.`);
|
|
@@ -107,16 +96,14 @@ const defaultOnPaint = ({ canvas, element, elementImage, }) => {
|
|
|
107
96
|
const transform = ctx.drawElementImage(elementImage, 0, 0);
|
|
108
97
|
element.style.transform = transform.toString();
|
|
109
98
|
};
|
|
110
|
-
|
|
99
|
+
/* eslint-enable react/require-default-props */
|
|
100
|
+
const HtmlInCanvasAncestorContext = (0, react_1.createContext)(false);
|
|
111
101
|
const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, children, onPaint, onInit, pixelDensity, controls, style, }, ref) => {
|
|
112
102
|
var _a;
|
|
113
|
-
const
|
|
103
|
+
const isInsideAncestorHtmlInCanvas = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
|
|
114
104
|
assertHtmlInCanvasDimensions(width, height);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
chromeMajorVersion !== null &&
|
|
118
|
-
chromeMajorVersion < MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS) {
|
|
119
|
-
throw new Error(`Nested <HtmlInCanvas> components require Chrome ${MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS} or newer, but the current browser is Chrome ${chromeMajorVersion}. Upgrade Chrome or avoid nesting components that use <HtmlInCanvas>, such as shapes with effects.`);
|
|
105
|
+
if (isInsideAncestorHtmlInCanvas) {
|
|
106
|
+
throw new Error('<HtmlInCanvas> components cannot be nested. Chrome does not reliably render nested HTML-in-canvas subtrees. Consider merging the effects into one <HtmlInCanvas> if you can.');
|
|
120
107
|
}
|
|
121
108
|
const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
|
|
122
109
|
const canvasWidth = Math.ceil(width * resolvedPixelDensity);
|
|
@@ -156,10 +143,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
156
143
|
const initializedRef = (0, react_1.useRef)(false);
|
|
157
144
|
const onInitCleanupRef = (0, react_1.useRef)(null);
|
|
158
145
|
const unmountedRef = (0, react_1.useRef)(false);
|
|
159
|
-
const ancestorRef = (0, react_1.useRef)(ancestor);
|
|
160
|
-
ancestorRef.current = ancestor;
|
|
161
146
|
const onPaintCb = (0, react_1.useCallback)(async () => {
|
|
162
|
-
var _a;
|
|
163
147
|
const element = divRef.current;
|
|
164
148
|
if (!element) {
|
|
165
149
|
throw new Error('Canvas or scene element not found');
|
|
@@ -284,10 +268,6 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
284
268
|
finally {
|
|
285
269
|
elImage.close();
|
|
286
270
|
}
|
|
287
|
-
// Effects may complete after Chromium has dispatched the parent's
|
|
288
|
-
// paint event. Repaint the direct parent so deeply nested canvases
|
|
289
|
-
// propagate their final pixels through every ancestor.
|
|
290
|
-
(_a = ancestorRef.current) === null || _a === void 0 ? void 0 : _a.requestParentPaint();
|
|
291
271
|
continueRender(handle);
|
|
292
272
|
}
|
|
293
273
|
catch (error) {
|
|
@@ -303,9 +283,8 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
303
283
|
resolvedPixelDensity,
|
|
304
284
|
canRetryMissingPaintRecord,
|
|
305
285
|
]);
|
|
306
|
-
// Default paint handlers draw synchronously on the layout canvas itself
|
|
307
|
-
//
|
|
308
|
-
// paint traversal. Custom handlers retain the transferred OffscreenCanvas API.
|
|
286
|
+
// Default paint handlers draw synchronously on the layout canvas itself.
|
|
287
|
+
// Custom handlers retain the transferred OffscreenCanvas API.
|
|
309
288
|
(0, react_1.useLayoutEffect)(() => {
|
|
310
289
|
const placeholder = canvas2dRef.current;
|
|
311
290
|
if (!placeholder) {
|
|
@@ -379,15 +358,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
|
|
|
379
358
|
...(style !== null && style !== void 0 ? style : {}),
|
|
380
359
|
};
|
|
381
360
|
}, [height, style, width]);
|
|
382
|
-
|
|
383
|
-
return {
|
|
384
|
-
requestParentPaint: () => {
|
|
385
|
-
var _a, _b;
|
|
386
|
-
(_b = (_a = canvas2dRef.current) === null || _a === void 0 ? void 0 : _a.requestPaint) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
387
|
-
},
|
|
388
|
-
};
|
|
389
|
-
}, []);
|
|
390
|
-
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) }));
|
|
361
|
+
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) }));
|
|
391
362
|
});
|
|
392
363
|
HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
|
|
393
364
|
const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, controls, style, cropLeft, cropRight, cropTop, cropBottom, durationInFrames, name, ...sequenceProps }, ref) => {
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -195,6 +195,10 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
195
195
|
const controlsSupportsEffects = controls === null || controls === void 0 ? void 0 : controls.supportsEffects;
|
|
196
196
|
const controlsComponentIdentity = controls === null || controls === void 0 ? void 0 : controls.componentIdentity;
|
|
197
197
|
const controlsComponentName = controls === null || controls === void 0 ? void 0 : controls.componentName;
|
|
198
|
+
const effectRuntimeValues = (0, react_1.useMemo)(() => {
|
|
199
|
+
var _a;
|
|
200
|
+
return (_a = _remotionInternalEffects === null || _remotionInternalEffects === void 0 ? void 0 : _remotionInternalEffects.runtimeValues) !== null && _a !== void 0 ? _a : null;
|
|
201
|
+
}, [_remotionInternalEffects]);
|
|
198
202
|
const registrationControls = (0, react_1.useMemo)(() => {
|
|
199
203
|
if (controlsSchema === undefined ||
|
|
200
204
|
controlsRuntimeValues === undefined ||
|
|
@@ -231,6 +235,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
231
235
|
type: 'image',
|
|
232
236
|
controls: registrationControls,
|
|
233
237
|
effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
|
|
238
|
+
effectRuntimeValues,
|
|
234
239
|
displayName: timelineClipName,
|
|
235
240
|
documentationLink: resolvedDocumentationLink,
|
|
236
241
|
duration: actualDurationInFrames,
|
|
@@ -256,6 +261,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
256
261
|
type: isMedia.type,
|
|
257
262
|
controls: registrationControls,
|
|
258
263
|
effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
|
|
264
|
+
effectRuntimeValues,
|
|
259
265
|
displayName: timelineClipName,
|
|
260
266
|
documentationLink: resolvedDocumentationLink,
|
|
261
267
|
doesVolumeChange: isMedia.data.doesVolumeChange,
|
|
@@ -275,6 +281,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
275
281
|
startMediaFrom: startMediaFrom !== null && startMediaFrom !== void 0 ? startMediaFrom : isMedia.data.startMediaFrom,
|
|
276
282
|
mediaFrameAtSequenceZero,
|
|
277
283
|
volume: isMedia.data.volumes,
|
|
284
|
+
muted: isMedia.data.muted,
|
|
278
285
|
refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
|
|
279
286
|
isInsideSeries,
|
|
280
287
|
frozenFrame: registeredFrozenFrame,
|
|
@@ -303,6 +310,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
303
310
|
postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
|
|
304
311
|
controls: registrationControls,
|
|
305
312
|
effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
|
|
313
|
+
effectRuntimeValues,
|
|
306
314
|
refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
|
|
307
315
|
isInsideSeries,
|
|
308
316
|
frozenFrame: registeredFrozenFrame,
|
|
@@ -331,6 +339,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
|
|
|
331
339
|
env.isStudio,
|
|
332
340
|
registrationControls,
|
|
333
341
|
_remotionInternalEffects,
|
|
342
|
+
effectRuntimeValues,
|
|
334
343
|
isMedia,
|
|
335
344
|
resolvedDocumentationLink,
|
|
336
345
|
refForOutline,
|
|
@@ -136,6 +136,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
136
136
|
loopDisplay: undefined,
|
|
137
137
|
documentationLink: 'https://www.remotion.dev/docs/html5-audio',
|
|
138
138
|
refForOutline: null,
|
|
139
|
+
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
139
140
|
});
|
|
140
141
|
// putting playback before useVolume
|
|
141
142
|
// because volume looks at playbackrate
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
2
|
+
export declare const DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
3
|
+
export declare const DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
4
|
+
export declare const DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DELAY_RENDER_CLEAR_TOKEN = exports.DELAY_RENDER_RETRY_TOKEN = exports.DELAY_RENDER_RETRIES_LEFT = exports.DELAY_RENDER_CALLSTACK_TOKEN = void 0;
|
|
4
|
+
exports.DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
|
|
5
|
+
exports.DELAY_RENDER_RETRIES_LEFT = 'Retries left: ';
|
|
6
|
+
exports.DELAY_RENDER_RETRY_TOKEN = '- Rendering the frame will be retried.';
|
|
7
|
+
exports.DELAY_RENDER_CLEAR_TOKEN = 'handle was cleared after';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LogLevel } from './log.js';
|
|
2
2
|
import type { RemotionEnvironment } from './remotion-environment-context.js';
|
|
3
|
+
export { DELAY_RENDER_CALLSTACK_TOKEN, DELAY_RENDER_CLEAR_TOKEN, DELAY_RENDER_RETRIES_LEFT, DELAY_RENDER_RETRY_TOKEN, } from './delay-render-constants.js';
|
|
3
4
|
export type DelayRenderScope = {
|
|
4
5
|
remotion_renderReady: boolean;
|
|
5
6
|
remotion_delayRenderTimeouts: {
|
|
@@ -14,10 +15,6 @@ export type DelayRenderScope = {
|
|
|
14
15
|
remotion_delayRenderHandles: number[];
|
|
15
16
|
remotion_cancelledError?: string;
|
|
16
17
|
};
|
|
17
|
-
export declare const DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
18
|
-
export declare const DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
19
|
-
export declare const DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
20
|
-
export declare const DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
21
18
|
export type DelayRenderOptions = {
|
|
22
19
|
timeoutInMilliseconds?: number;
|
|
23
20
|
retries?: number;
|
|
@@ -47,4 +44,3 @@ type ContinueRenderInternalOptions = {
|
|
|
47
44
|
};
|
|
48
45
|
export declare const continueRenderInternal: ({ scope, handle, environment, logLevel, }: ContinueRenderInternalOptions) => void;
|
|
49
46
|
export declare const continueRender: (handle: number) => void;
|
|
50
|
-
export {};
|
package/dist/cjs/delay-render.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.continueRender = exports.continueRenderInternal = exports.delayRender = exports.delayRenderInternal = exports.
|
|
3
|
+
exports.continueRender = exports.continueRenderInternal = exports.delayRender = exports.delayRenderInternal = exports.DELAY_RENDER_RETRY_TOKEN = exports.DELAY_RENDER_RETRIES_LEFT = exports.DELAY_RENDER_CLEAR_TOKEN = exports.DELAY_RENDER_CALLSTACK_TOKEN = void 0;
|
|
4
4
|
const cancel_render_js_1 = require("./cancel-render.js");
|
|
5
|
+
const delay_render_constants_js_1 = require("./delay-render-constants.js");
|
|
5
6
|
const get_remotion_environment_js_1 = require("./get-remotion-environment.js");
|
|
6
7
|
const log_js_1 = require("./log.js");
|
|
7
8
|
const truthy_js_1 = require("./truthy.js");
|
|
9
|
+
const delay_render_constants_js_2 = require("./delay-render-constants.js");
|
|
10
|
+
Object.defineProperty(exports, "DELAY_RENDER_CALLSTACK_TOKEN", { enumerable: true, get: function () { return delay_render_constants_js_2.DELAY_RENDER_CALLSTACK_TOKEN; } });
|
|
11
|
+
Object.defineProperty(exports, "DELAY_RENDER_CLEAR_TOKEN", { enumerable: true, get: function () { return delay_render_constants_js_2.DELAY_RENDER_CLEAR_TOKEN; } });
|
|
12
|
+
Object.defineProperty(exports, "DELAY_RENDER_RETRIES_LEFT", { enumerable: true, get: function () { return delay_render_constants_js_2.DELAY_RENDER_RETRIES_LEFT; } });
|
|
13
|
+
Object.defineProperty(exports, "DELAY_RENDER_RETRY_TOKEN", { enumerable: true, get: function () { return delay_render_constants_js_2.DELAY_RENDER_RETRY_TOKEN; } });
|
|
8
14
|
if (typeof window !== 'undefined') {
|
|
9
15
|
window.remotion_renderReady = false;
|
|
10
16
|
if (!window.remotion_delayRenderTimeouts) {
|
|
@@ -12,10 +18,6 @@ if (typeof window !== 'undefined') {
|
|
|
12
18
|
}
|
|
13
19
|
window.remotion_delayRenderHandles = [];
|
|
14
20
|
}
|
|
15
|
-
exports.DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
|
|
16
|
-
exports.DELAY_RENDER_RETRIES_LEFT = 'Retries left: ';
|
|
17
|
-
exports.DELAY_RENDER_RETRY_TOKEN = '- Rendering the frame will be retried.';
|
|
18
|
-
exports.DELAY_RENDER_CLEAR_TOKEN = 'handle was cleared after';
|
|
19
21
|
const defaultTimeout = 30000;
|
|
20
22
|
const delayRenderInternal = ({ scope, environment, label, options, }) => {
|
|
21
23
|
var _a;
|
|
@@ -38,9 +40,9 @@ const delayRenderInternal = ({ scope, environment, label, options, }) => {
|
|
|
38
40
|
`A delayRender()`,
|
|
39
41
|
label ? `"${label}"` : null,
|
|
40
42
|
`was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
|
|
41
|
-
retriesLeft > 0 ?
|
|
42
|
-
retriesLeft > 0 ?
|
|
43
|
-
|
|
43
|
+
retriesLeft > 0 ? delay_render_constants_js_1.DELAY_RENDER_RETRIES_LEFT + retriesLeft : null,
|
|
44
|
+
retriesLeft > 0 ? delay_render_constants_js_1.DELAY_RENDER_RETRY_TOKEN : null,
|
|
45
|
+
delay_render_constants_js_1.DELAY_RENDER_CALLSTACK_TOKEN,
|
|
44
46
|
called,
|
|
45
47
|
]
|
|
46
48
|
.filter(truthy_js_1.truthy)
|
|
@@ -90,7 +92,7 @@ const continueRenderInternal = ({ scope, handle, environment, logLevel, }) => {
|
|
|
90
92
|
clearTimeout(timeout);
|
|
91
93
|
const message = [
|
|
92
94
|
label ? `"${label}"` : 'A handle',
|
|
93
|
-
|
|
95
|
+
delay_render_constants_js_1.DELAY_RENDER_CLEAR_TOKEN,
|
|
94
96
|
`${Date.now() - startTime}ms`,
|
|
95
97
|
]
|
|
96
98
|
.filter(truthy_js_1.truthy)
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { RuntimeValueStore } from '../runtime-value-store.js';
|
|
1
2
|
import type { CannotUpdateEffectReason, CannotUpdateSequenceReason } from '../SequenceManager.js';
|
|
2
3
|
import { type SequencePropsSubscriptionKey } from '../SequenceManager.js';
|
|
3
4
|
import { type CanUpdateSequencePropStatus, type PropStatuses } from '../use-schema.js';
|
|
4
|
-
import type {
|
|
5
|
-
export declare const useMemoizedEffectDefinitions: (effects: readonly EffectDescriptor<unknown>[]) => readonly EffectDefinition<unknown>[]
|
|
5
|
+
import type { EffectDefinitionAndStack, EffectDescriptor, EffectDefinition } from './effect-types.js';
|
|
6
|
+
export declare const useMemoizedEffectDefinitions: (effects: readonly EffectDescriptor<unknown>[]) => readonly EffectDefinition<unknown>[] & {
|
|
7
|
+
readonly runtimeValues: readonly RuntimeValueStore[];
|
|
8
|
+
};
|
|
6
9
|
type EffectStatus = {
|
|
7
10
|
type: 'cannot-update-sequence';
|
|
8
11
|
reason: CannotUpdateSequenceReason;
|
|
@@ -4,6 +4,7 @@ exports.useMemoizedEffects = exports.getPropStatusesCtx = exports.getEffectPropS
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const get_effective_visual_mode_value_js_1 = require("../get-effective-visual-mode-value.js");
|
|
6
6
|
const interpolate_keyframed_status_js_1 = require("../interpolate-keyframed-status.js");
|
|
7
|
+
const runtime_value_store_js_1 = require("../runtime-value-store.js");
|
|
7
8
|
const sequence_node_path_js_1 = require("../sequence-node-path.js");
|
|
8
9
|
const SequenceManager_js_1 = require("../SequenceManager.js");
|
|
9
10
|
const use_current_frame_js_1 = require("../use-current-frame.js");
|
|
@@ -68,13 +69,25 @@ const useMemoizedEffectDefinitions = (effects) => {
|
|
|
68
69
|
const definitions = effects.map((descriptor) => descriptor.definition);
|
|
69
70
|
const previous = previousRef.current;
|
|
70
71
|
const isSame = previous !== null &&
|
|
71
|
-
previous.length === definitions.length &&
|
|
72
|
-
previous.every((
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
previous.definitions.length === definitions.length &&
|
|
73
|
+
previous.definitions.every((definition, i) => definition === definitions[i]);
|
|
74
|
+
const controllers = isSame
|
|
75
|
+
? previous.controllers
|
|
76
|
+
: effects.map((effect) => (0, runtime_value_store_js_1.createRuntimeValueStore)(effect.params));
|
|
77
|
+
const stableDefinitions = isSame ? previous.definitions : definitions;
|
|
78
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
79
|
+
// Stores are intentionally updated without changing the registered effect
|
|
80
|
+
// array, so frame-dependent parameters don't re-register the Sequence.
|
|
81
|
+
stableDefinitions.forEach((_definition, index) => {
|
|
82
|
+
var _a;
|
|
83
|
+
const snapshot = (_a = effects[index]) === null || _a === void 0 ? void 0 : _a.params;
|
|
84
|
+
controllers[index].setSnapshot(snapshot);
|
|
85
|
+
});
|
|
86
|
+
}, [controllers, effects, stableDefinitions]);
|
|
87
|
+
previousRef.current = { definitions: stableDefinitions, controllers };
|
|
88
|
+
return Object.assign(stableDefinitions, {
|
|
89
|
+
runtimeValues: controllers.map((controller) => controller.store),
|
|
90
|
+
});
|
|
78
91
|
};
|
|
79
92
|
exports.useMemoizedEffectDefinitions = useMemoizedEffectDefinitions;
|
|
80
93
|
const getEffectPropStatusesCtx = ({ propStatuses, nodePath, effectIndex, }) => {
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -25,7 +25,17 @@ import type { WatchRemotionStaticFilesPayload } from './watch-static-file.js';
|
|
|
25
25
|
import { useRemotionContexts } from './wrap-remotion-context.js';
|
|
26
26
|
export type { EffectChainState } from './effects/run-effect-chain.js';
|
|
27
27
|
export declare const Internals: {
|
|
28
|
+
readonly AbsoluteFillElement: import("react").ForwardRefExoticComponent<Omit<import("./AbsoluteFillElement.js").AbsoluteFillElementProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
29
|
readonly MaxMediaCacheSizeContext: import("react").Context<number | null>;
|
|
30
|
+
readonly getMediabunnyInputResourceKey: ({ src, credentials, requestInitFingerprint, revision, }: {
|
|
31
|
+
src: string;
|
|
32
|
+
credentials: RequestCredentials | null;
|
|
33
|
+
requestInitFingerprint: unknown;
|
|
34
|
+
revision: string | null;
|
|
35
|
+
}) => string;
|
|
36
|
+
readonly globalMediaResourceManager: import("./media-resource-manager.js").MediaResourceManager;
|
|
37
|
+
readonly makeMediaResourceManager: () => import("./media-resource-manager.js").MediaResourceManager;
|
|
38
|
+
readonly MEDIABUNNY_DURATION_VALUE_KEY: "mediabunny-duration";
|
|
29
39
|
readonly makeRenderResourceManager: () => import("./render-resource-manager.js").RenderResourceManager;
|
|
30
40
|
readonly RenderResourceManagerContext: import("react").Context<import("./render-resource-manager.js").RenderResourceManager | null>;
|
|
31
41
|
readonly useUnsafeVideoConfig: () => import("./video-config.js").VideoConfig | null;
|
|
@@ -753,7 +763,7 @@ export declare const Internals: {
|
|
|
753
763
|
readonly getRoot: () => import("react").FC<{}> | null;
|
|
754
764
|
readonly useMediaVolumeState: () => readonly [number, (u: number) => void];
|
|
755
765
|
readonly usePlayerMutedState: () => readonly [boolean, (u: import("react").SetStateAction<boolean>) => void];
|
|
756
|
-
readonly useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, getStack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, documentationLink, refForOutline, }: {
|
|
766
|
+
readonly useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, id, getStack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, documentationLink, refForOutline, muted, }: {
|
|
757
767
|
volume: import("./volume-prop.js").VolumeProp | undefined;
|
|
758
768
|
mediaVolume: number;
|
|
759
769
|
src: string | undefined;
|
|
@@ -768,6 +778,7 @@ export declare const Internals: {
|
|
|
768
778
|
loopDisplay: import("./CompositionManager.js").LoopDisplay | undefined;
|
|
769
779
|
documentationLink: string | null;
|
|
770
780
|
refForOutline: import("react").RefObject<Element | null> | null;
|
|
781
|
+
muted: boolean;
|
|
771
782
|
}) => void;
|
|
772
783
|
readonly useLazyComponent: <Props>({ compProps, componentName, noSuspense, }: {
|
|
773
784
|
compProps: CompProps<Props>;
|
|
@@ -1129,7 +1140,7 @@ export declare const Internals: {
|
|
|
1129
1140
|
}, "ref"> & import("react").RefAttributes<HTMLAudioElement>>;
|
|
1130
1141
|
readonly OBJECTFIT_CONTAIN_CLASS_NAME: "__remotion_objectfitcontain";
|
|
1131
1142
|
readonly InnerOffthreadVideo: import("react").FC<import("./video/props.js").AllOffthreadVideoProps>;
|
|
1132
|
-
readonly useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, sequenceDurationInFrames, mediaStartsAt, loop, }: {
|
|
1143
|
+
readonly useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType, src, displayName, trimBefore, trimAfter, playbackRate, sequenceDurationInFrames, mediaStartsAt, loop, muted, }: {
|
|
1133
1144
|
volume: import("./volume-prop.js").VolumeProp | undefined;
|
|
1134
1145
|
mediaVolume: number;
|
|
1135
1146
|
mediaType: "audio" | "image" | "video";
|
|
@@ -1141,6 +1152,7 @@ export declare const Internals: {
|
|
|
1141
1152
|
sequenceDurationInFrames: number;
|
|
1142
1153
|
mediaStartsAt: number;
|
|
1143
1154
|
loop: boolean;
|
|
1155
|
+
muted: boolean;
|
|
1144
1156
|
}) => {
|
|
1145
1157
|
volumes: string | number;
|
|
1146
1158
|
duration: number;
|
|
@@ -1150,6 +1162,7 @@ export declare const Internals: {
|
|
|
1150
1162
|
startMediaFrom: number;
|
|
1151
1163
|
src: string;
|
|
1152
1164
|
playbackRate: number;
|
|
1165
|
+
muted: boolean;
|
|
1153
1166
|
};
|
|
1154
1167
|
readonly getInputPropsOverride: () => Record<string, unknown> | null;
|
|
1155
1168
|
readonly setInputPropsOverride: (override: Record<string, unknown> | null) => void;
|
|
@@ -1197,7 +1210,9 @@ export declare const Internals: {
|
|
|
1197
1210
|
effects: readonly import("./index.js").EffectDescriptor<unknown>[];
|
|
1198
1211
|
readonly overrideId: string | null;
|
|
1199
1212
|
}) => import("./index.js").EffectDefinitionAndStack<unknown>[];
|
|
1200
|
-
readonly useMemoizedEffectDefinitions: (effects: readonly import("./index.js").EffectDescriptor<unknown>[]) => readonly import("./index.js").EffectDefinition<unknown>[]
|
|
1213
|
+
readonly useMemoizedEffectDefinitions: (effects: readonly import("./index.js").EffectDescriptor<unknown>[]) => readonly import("./index.js").EffectDefinition<unknown>[] & {
|
|
1214
|
+
readonly runtimeValues: readonly import("./runtime-value-store.js").RuntimeValueStore[];
|
|
1215
|
+
};
|
|
1201
1216
|
readonly createEffect: <P, S>(definition: import("./index.js").EffectDefinition<P, S>) => import("./index.js").EffectFactory<P>;
|
|
1202
1217
|
readonly createWebGLContextError: (effectName: string) => Error;
|
|
1203
1218
|
readonly createWebGL2ContextError: (effectName: string) => Error;
|
package/dist/cjs/internals.js
CHANGED
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.Internals = void 0;
|
|
37
37
|
const react_1 = require("react");
|
|
38
38
|
const absolute_src_js_1 = require("./absolute-src.js");
|
|
39
|
+
const AbsoluteFillElement_js_1 = require("./AbsoluteFillElement.js");
|
|
39
40
|
const get_duration_in_seconds_js_1 = require("./animated-image/get-duration-in-seconds.js");
|
|
40
41
|
const AudioForPreview_js_1 = require("./audio/AudioForPreview.js");
|
|
41
42
|
const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
|
|
@@ -69,6 +70,7 @@ const is_player_js_1 = require("./is-player.js");
|
|
|
69
70
|
const log_level_context_js_1 = require("./log-level-context.js");
|
|
70
71
|
const log_js_1 = require("./log.js");
|
|
71
72
|
const max_video_cache_size_js_1 = require("./max-video-cache-size.js");
|
|
73
|
+
const media_resource_manager_js_1 = require("./media-resource-manager.js");
|
|
72
74
|
const nonce_js_1 = require("./nonce.js");
|
|
73
75
|
const playback_logging_js_1 = require("./playback-logging.js");
|
|
74
76
|
const portal_node_js_1 = require("./portal-node.js");
|
|
@@ -123,7 +125,12 @@ const compositionSelectorRef = (0, react_1.createRef)();
|
|
|
123
125
|
// Mark them as Internals so use don't assume this is public
|
|
124
126
|
// API and are less likely to use it
|
|
125
127
|
exports.Internals = {
|
|
128
|
+
AbsoluteFillElement: AbsoluteFillElement_js_1.AbsoluteFillElement,
|
|
126
129
|
MaxMediaCacheSizeContext: max_video_cache_size_js_1.MaxMediaCacheSizeContext,
|
|
130
|
+
getMediabunnyInputResourceKey: media_resource_manager_js_1.getMediabunnyInputResourceKey,
|
|
131
|
+
globalMediaResourceManager: media_resource_manager_js_1.globalMediaResourceManager,
|
|
132
|
+
makeMediaResourceManager: media_resource_manager_js_1.makeMediaResourceManager,
|
|
133
|
+
MEDIABUNNY_DURATION_VALUE_KEY: media_resource_manager_js_1.MEDIABUNNY_DURATION_VALUE_KEY,
|
|
127
134
|
makeRenderResourceManager: render_resource_manager_js_1.makeRenderResourceManager,
|
|
128
135
|
RenderResourceManagerContext: render_resource_manager_js_1.RenderResourceManagerContext,
|
|
129
136
|
useUnsafeVideoConfig: use_unsafe_video_config_js_1.useUnsafeVideoConfig,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type InterpolateOptions } from './interpolate.js';
|
|
2
|
+
export type InterpolateTranslateOptions = InterpolateOptions;
|
|
3
|
+
export declare const interpolateTranslate: (input: number, inputRange: readonly number[], outputRange: readonly string[], options?: Partial<{
|
|
4
|
+
easing: import("./interpolate.js").EasingFunction | readonly import("./interpolate.js").EasingFunction[];
|
|
5
|
+
extrapolateLeft: import("./interpolate.js").ExtrapolateType;
|
|
6
|
+
extrapolateRight: import("./interpolate.js").ExtrapolateType;
|
|
7
|
+
posterize: number;
|
|
8
|
+
}> | undefined) => string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interpolateTranslate = void 0;
|
|
4
|
+
const interpolate_js_1 = require("./interpolate.js");
|
|
5
|
+
const pixelValueRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))px$/;
|
|
6
|
+
const parseTranslate = (value) => {
|
|
7
|
+
if (typeof value !== 'string') {
|
|
8
|
+
throw new TypeError(`outputRange must contain only strings, but got ${typeof value}`);
|
|
9
|
+
}
|
|
10
|
+
const parts = value.trim().split(/\s+/);
|
|
11
|
+
if (parts.length < 1 || parts.length > 3 || parts[0] === '') {
|
|
12
|
+
throw new TypeError(`translate values must contain 1 to 3 pixel values, but got "${value}"`);
|
|
13
|
+
}
|
|
14
|
+
return parts.map((part) => {
|
|
15
|
+
const match = pixelValueRegex.exec(part);
|
|
16
|
+
if (match === null) {
|
|
17
|
+
throw new TypeError(`interpolateTranslate() only supports px values, but got "${part}" in "${value}"`);
|
|
18
|
+
}
|
|
19
|
+
return Number(match[1]);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/*
|
|
23
|
+
* @description Allows you to map a range of values to CSS translate values using pixel units.
|
|
24
|
+
* @see [Documentation](https://remotion.dev/docs/interpolate-translate)
|
|
25
|
+
*/
|
|
26
|
+
const interpolateTranslate = (input, inputRange, outputRange, options) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (typeof input === 'undefined') {
|
|
29
|
+
throw new TypeError('input can not be undefined');
|
|
30
|
+
}
|
|
31
|
+
if (typeof inputRange === 'undefined') {
|
|
32
|
+
throw new TypeError('inputRange can not be undefined');
|
|
33
|
+
}
|
|
34
|
+
if (typeof outputRange === 'undefined') {
|
|
35
|
+
throw new TypeError('outputRange can not be undefined');
|
|
36
|
+
}
|
|
37
|
+
if (inputRange.length !== outputRange.length) {
|
|
38
|
+
throw new TypeError('inputRange (' +
|
|
39
|
+
inputRange.length +
|
|
40
|
+
' values provided) and outputRange (' +
|
|
41
|
+
outputRange.length +
|
|
42
|
+
' values provided) must have the same length');
|
|
43
|
+
}
|
|
44
|
+
const parsedOutputRange = outputRange.map((translateValue) => parseTranslate(translateValue));
|
|
45
|
+
const firstValueLength = (_a = parsedOutputRange[0]) === null || _a === void 0 ? void 0 : _a.length;
|
|
46
|
+
if (firstValueLength === undefined) {
|
|
47
|
+
throw new TypeError('outputRange must have at least 1 element');
|
|
48
|
+
}
|
|
49
|
+
for (const parsedTranslate of parsedOutputRange) {
|
|
50
|
+
if (parsedTranslate.length !== firstValueLength) {
|
|
51
|
+
throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${parsedTranslate.length}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return new Array(firstValueLength)
|
|
55
|
+
.fill(true)
|
|
56
|
+
.map((_, index) => {
|
|
57
|
+
const outputValues = [];
|
|
58
|
+
for (const translateValue of parsedOutputRange) {
|
|
59
|
+
const value = translateValue[index];
|
|
60
|
+
if (value === undefined) {
|
|
61
|
+
throw new TypeError(`All translate values must have the same number of pixel values, but got ${firstValueLength} and ${translateValue.length}`);
|
|
62
|
+
}
|
|
63
|
+
outputValues.push(value);
|
|
64
|
+
}
|
|
65
|
+
const interpolatedValue = (0, interpolate_js_1.interpolate)(input, inputRange, outputValues, options);
|
|
66
|
+
return `${interpolatedValue}px`;
|
|
67
|
+
})
|
|
68
|
+
.join(' ');
|
|
69
|
+
};
|
|
70
|
+
exports.interpolateTranslate = interpolateTranslate;
|
|
@@ -15,6 +15,14 @@ const label = {
|
|
|
15
15
|
const container = {
|
|
16
16
|
justifyContent: 'center',
|
|
17
17
|
alignItems: 'center',
|
|
18
|
+
backgroundColor: '#1f2428',
|
|
19
|
+
};
|
|
20
|
+
const content = {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'column',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
animation: 'anim 2s',
|
|
25
|
+
animationFillMode: 'forwards',
|
|
18
26
|
};
|
|
19
27
|
const Loading = () => {
|
|
20
28
|
return (jsx_runtime_1.jsxs(AbsoluteFillElement_js_1.AbsoluteFillElement, { style: container, id: "remotion-comp-loading", children: [
|
|
@@ -27,11 +35,9 @@ const Loading = () => {
|
|
|
27
35
|
opacity: 1
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
` }), jsx_runtime_1.jsx("svg", { width: ICON_SIZE, height: ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: jsx_runtime_1.jsx("path", { fill: "#555", stroke: "#555", strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }) }), jsx_runtime_1.jsxs("p", { style: label, children: ["Resolving ", '<Suspense>', "..."] })
|
|
38
|
+
` }), jsx_runtime_1.jsxs("div", { id: "remotion-comp-loading-content", style: content, children: [
|
|
39
|
+
jsx_runtime_1.jsx("svg", { width: ICON_SIZE, height: ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: jsx_runtime_1.jsx("path", { fill: "#555", stroke: "#555", strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }) }), jsx_runtime_1.jsxs("p", { style: label, children: ["Resolving ", '<Suspense>', "..."] })
|
|
40
|
+
] })
|
|
35
41
|
] }));
|
|
36
42
|
};
|
|
37
43
|
exports.Loading = Loading;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type MediaResourceLease<T> = {
|
|
2
|
+
resource: T;
|
|
3
|
+
getOrCreateValue: <Value>(key: string, create: () => Value) => Value;
|
|
4
|
+
release: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type MediaResourceManager = {
|
|
7
|
+
acquire: <T>({ key, create }: {
|
|
8
|
+
key: string;
|
|
9
|
+
create: () => {
|
|
10
|
+
resource: T;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
};
|
|
13
|
+
}) => MediaResourceLease<T>;
|
|
14
|
+
invalidate: (key: string) => void;
|
|
15
|
+
dispose: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const makeMediaResourceManager: () => MediaResourceManager;
|
|
18
|
+
export declare const getMediabunnyInputResourceKey: ({ src, credentials, requestInitFingerprint, revision, }: {
|
|
19
|
+
src: string;
|
|
20
|
+
credentials: RequestCredentials | null;
|
|
21
|
+
requestInitFingerprint: unknown;
|
|
22
|
+
revision: string | null;
|
|
23
|
+
}) => string;
|
|
24
|
+
export declare const MEDIABUNNY_DURATION_VALUE_KEY = "mediabunny-duration";
|
|
25
|
+
export declare const globalMediaResourceManager: MediaResourceManager;
|