remotion 4.0.371 → 4.0.373
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 +0 -8
- package/dist/cjs/CompositionManager.js +5 -138
- package/dist/cjs/CompositionManagerProvider.d.ts +10 -0
- package/dist/cjs/CompositionManagerProvider.js +100 -0
- package/dist/cjs/RemotionRoot.d.ts +1 -3
- package/dist/cjs/RemotionRoot.js +7 -61
- package/dist/cjs/Sequence.js +2 -1
- package/dist/cjs/TimelineContext.d.ts +22 -0
- package/dist/cjs/TimelineContext.js +89 -0
- package/dist/cjs/audio/shared-audio-tags.d.ts +1 -2
- package/dist/cjs/audio/shared-audio-tags.js +9 -1
- package/dist/cjs/delay-render.d.ts +14 -2
- package/dist/cjs/delay-render.js +20 -18
- package/dist/cjs/freeze.js +3 -3
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/internals.d.ts +13 -4
- package/dist/cjs/internals.js +8 -0
- package/dist/cjs/timeline-position-state.d.ts +0 -15
- package/dist/cjs/timeline-position-state.js +6 -26
- package/dist/cjs/use-delay-render.d.ts +2 -1
- package/dist/cjs/use-delay-render.js +7 -5
- package/dist/cjs/use-media-in-timeline.js +2 -2
- package/dist/cjs/use-media-playback.js +2 -1
- package/dist/cjs/use-media-tag.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-remotion-context.d.ts +2 -2
- package/dist/cjs/wrap-remotion-context.js +8 -8
- package/dist/esm/index.mjs +814 -800
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/esm/index.mjs
CHANGED
|
@@ -110,7 +110,7 @@ function truthy(value) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// src/version.ts
|
|
113
|
-
var VERSION = "4.0.
|
|
113
|
+
var VERSION = "4.0.373";
|
|
114
114
|
|
|
115
115
|
// src/multiple-versions-warning.ts
|
|
116
116
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -149,10 +149,10 @@ var Null = () => {
|
|
|
149
149
|
// src/Sequence.tsx
|
|
150
150
|
import {
|
|
151
151
|
forwardRef as forwardRef2,
|
|
152
|
-
useContext as
|
|
152
|
+
useContext as useContext12,
|
|
153
153
|
useEffect as useEffect3,
|
|
154
|
-
useMemo as
|
|
155
|
-
useState as
|
|
154
|
+
useMemo as useMemo10,
|
|
155
|
+
useState as useState6
|
|
156
156
|
} from "react";
|
|
157
157
|
|
|
158
158
|
// src/AbsoluteFill.tsx
|
|
@@ -306,28 +306,47 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
306
306
|
});
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
// src/
|
|
310
|
-
import {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
309
|
+
// src/TimelineContext.tsx
|
|
310
|
+
import {
|
|
311
|
+
createContext as createContext9,
|
|
312
|
+
useLayoutEffect,
|
|
313
|
+
useMemo as useMemo7,
|
|
314
|
+
useRef as useRef2,
|
|
315
|
+
useState as useState5
|
|
316
|
+
} from "react";
|
|
317
|
+
|
|
318
|
+
// src/random.ts
|
|
319
|
+
function mulberry32(a) {
|
|
320
|
+
let t = a + 1831565813;
|
|
321
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
322
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
323
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
324
|
+
}
|
|
325
|
+
function hashCode(str) {
|
|
326
|
+
let i = 0;
|
|
327
|
+
let chr = 0;
|
|
328
|
+
let hash = 0;
|
|
329
|
+
for (i = 0;i < str.length; i++) {
|
|
330
|
+
chr = str.charCodeAt(i);
|
|
331
|
+
hash = (hash << 5) - hash + chr;
|
|
332
|
+
hash |= 0;
|
|
333
|
+
}
|
|
334
|
+
return hash;
|
|
335
|
+
}
|
|
336
|
+
var random = (seed, dummy) => {
|
|
337
|
+
if (dummy !== undefined) {
|
|
338
|
+
throw new TypeError("random() takes only one argument");
|
|
339
|
+
}
|
|
340
|
+
if (seed === null) {
|
|
341
|
+
return Math.random();
|
|
342
|
+
}
|
|
343
|
+
if (typeof seed === "string") {
|
|
344
|
+
return mulberry32(hashCode(seed));
|
|
345
|
+
}
|
|
346
|
+
if (typeof seed === "number") {
|
|
347
|
+
return mulberry32(seed * 10000000000);
|
|
348
|
+
}
|
|
349
|
+
throw new Error("random() argument must be a number or a string");
|
|
331
350
|
};
|
|
332
351
|
|
|
333
352
|
// src/timeline-position-state.ts
|
|
@@ -338,14 +357,12 @@ __export(exports_timeline_position_state, {
|
|
|
338
357
|
usePlayingState: () => usePlayingState,
|
|
339
358
|
persistCurrentFrame: () => persistCurrentFrame,
|
|
340
359
|
getInitialFrameState: () => getInitialFrameState,
|
|
341
|
-
getFrameForComposition: () => getFrameForComposition
|
|
342
|
-
TimelineContext: () => TimelineContext,
|
|
343
|
-
SetTimelineContext: () => SetTimelineContext
|
|
360
|
+
getFrameForComposition: () => getFrameForComposition
|
|
344
361
|
});
|
|
345
|
-
import {
|
|
362
|
+
import { useContext as useContext6, useMemo as useMemo6 } from "react";
|
|
346
363
|
|
|
347
364
|
// src/use-remotion-environment.ts
|
|
348
|
-
import { useContext as
|
|
365
|
+
import { useContext as useContext2, useState as useState2 } from "react";
|
|
349
366
|
|
|
350
367
|
// src/remotion-environment-context.ts
|
|
351
368
|
import React4 from "react";
|
|
@@ -353,8 +370,8 @@ var RemotionEnvironmentContext = React4.createContext(null);
|
|
|
353
370
|
|
|
354
371
|
// src/use-remotion-environment.ts
|
|
355
372
|
var useRemotionEnvironment = () => {
|
|
356
|
-
const context =
|
|
357
|
-
const [env] =
|
|
373
|
+
const context = useContext2(RemotionEnvironmentContext);
|
|
374
|
+
const [env] = useState2(() => getRemotionEnvironment());
|
|
358
375
|
return context ?? env;
|
|
359
376
|
};
|
|
360
377
|
|
|
@@ -362,14 +379,14 @@ var useRemotionEnvironment = () => {
|
|
|
362
379
|
import { useContext as useContext5, useMemo as useMemo5 } from "react";
|
|
363
380
|
|
|
364
381
|
// src/CompositionManagerContext.tsx
|
|
365
|
-
import { createContext as
|
|
366
|
-
var CompositionManager =
|
|
382
|
+
import { createContext as createContext4 } from "react";
|
|
383
|
+
var CompositionManager = createContext4({
|
|
367
384
|
compositions: [],
|
|
368
385
|
folders: [],
|
|
369
386
|
currentCompositionMetadata: null,
|
|
370
387
|
canvasContent: null
|
|
371
388
|
});
|
|
372
|
-
var CompositionSetters =
|
|
389
|
+
var CompositionSetters = createContext4({
|
|
373
390
|
registerComposition: () => {
|
|
374
391
|
return;
|
|
375
392
|
},
|
|
@@ -405,13 +422,13 @@ import {
|
|
|
405
422
|
|
|
406
423
|
// src/EditorProps.tsx
|
|
407
424
|
import React5, {
|
|
408
|
-
createContext as
|
|
425
|
+
createContext as createContext5,
|
|
409
426
|
useCallback as useCallback2,
|
|
410
427
|
useImperativeHandle,
|
|
411
428
|
useMemo as useMemo3
|
|
412
429
|
} from "react";
|
|
413
430
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
414
|
-
var EditorPropsContext =
|
|
431
|
+
var EditorPropsContext = createContext5({
|
|
415
432
|
props: {},
|
|
416
433
|
updateProps: () => {
|
|
417
434
|
throw new Error("Not implemented");
|
|
@@ -577,6 +594,30 @@ var getInputProps = () => {
|
|
|
577
594
|
return parsed;
|
|
578
595
|
};
|
|
579
596
|
|
|
597
|
+
// src/nonce.ts
|
|
598
|
+
import { createContext as createContext6, useContext as useContext3, useEffect, useRef, useState as useState3 } from "react";
|
|
599
|
+
var NonceContext = createContext6({
|
|
600
|
+
getNonce: () => 0,
|
|
601
|
+
fastRefreshes: 0,
|
|
602
|
+
manualRefreshes: 0
|
|
603
|
+
});
|
|
604
|
+
var SetNonceContext = createContext6({
|
|
605
|
+
increaseManualRefreshes: () => {}
|
|
606
|
+
});
|
|
607
|
+
var useNonce = () => {
|
|
608
|
+
const context = useContext3(NonceContext);
|
|
609
|
+
const [nonce, setNonce] = useState3(() => context.getNonce());
|
|
610
|
+
const lastContext = useRef(context);
|
|
611
|
+
useEffect(() => {
|
|
612
|
+
if (lastContext.current === context) {
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
lastContext.current = context;
|
|
616
|
+
setNonce(context.getNonce);
|
|
617
|
+
}, [context]);
|
|
618
|
+
return nonce;
|
|
619
|
+
};
|
|
620
|
+
|
|
580
621
|
// src/codec.ts
|
|
581
622
|
var validCodecs = [
|
|
582
623
|
"h264",
|
|
@@ -1164,27 +1205,6 @@ var useVideo = () => {
|
|
|
1164
1205
|
};
|
|
1165
1206
|
|
|
1166
1207
|
// src/timeline-position-state.ts
|
|
1167
|
-
var TimelineContext = createContext8({
|
|
1168
|
-
frame: {},
|
|
1169
|
-
playing: false,
|
|
1170
|
-
playbackRate: 1,
|
|
1171
|
-
rootId: "",
|
|
1172
|
-
imperativePlaying: {
|
|
1173
|
-
current: false
|
|
1174
|
-
},
|
|
1175
|
-
setPlaybackRate: () => {
|
|
1176
|
-
throw new Error("default");
|
|
1177
|
-
},
|
|
1178
|
-
audioAndVideoTags: { current: [] }
|
|
1179
|
-
});
|
|
1180
|
-
var SetTimelineContext = createContext8({
|
|
1181
|
-
setFrame: () => {
|
|
1182
|
-
throw new Error("default");
|
|
1183
|
-
},
|
|
1184
|
-
setPlaying: () => {
|
|
1185
|
-
throw new Error("default");
|
|
1186
|
-
}
|
|
1187
|
-
});
|
|
1188
1208
|
var makeKey = () => {
|
|
1189
1209
|
return `remotion.time-all`;
|
|
1190
1210
|
};
|
|
@@ -1227,29 +1247,309 @@ var usePlayingState = () => {
|
|
|
1227
1247
|
return useMemo6(() => [playing, setPlaying, imperativePlaying], [imperativePlaying, playing, setPlaying]);
|
|
1228
1248
|
};
|
|
1229
1249
|
|
|
1250
|
+
// src/use-delay-render.tsx
|
|
1251
|
+
import { createContext as createContext8, useCallback as useCallback4, useContext as useContext7 } from "react";
|
|
1252
|
+
|
|
1253
|
+
// src/cancel-render.ts
|
|
1254
|
+
var isErrorLike = (err) => {
|
|
1255
|
+
if (err instanceof Error) {
|
|
1256
|
+
return true;
|
|
1257
|
+
}
|
|
1258
|
+
if (err === null) {
|
|
1259
|
+
return false;
|
|
1260
|
+
}
|
|
1261
|
+
if (typeof err !== "object") {
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
if (!("stack" in err)) {
|
|
1265
|
+
return false;
|
|
1266
|
+
}
|
|
1267
|
+
if (typeof err.stack !== "string") {
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
if (!("message" in err)) {
|
|
1271
|
+
return false;
|
|
1272
|
+
}
|
|
1273
|
+
if (typeof err.message !== "string") {
|
|
1274
|
+
return false;
|
|
1275
|
+
}
|
|
1276
|
+
return true;
|
|
1277
|
+
};
|
|
1278
|
+
function cancelRender(err) {
|
|
1279
|
+
let error;
|
|
1280
|
+
if (isErrorLike(err)) {
|
|
1281
|
+
error = err;
|
|
1282
|
+
if (!error.stack) {
|
|
1283
|
+
error.stack = new Error(error.message).stack;
|
|
1284
|
+
}
|
|
1285
|
+
} else if (typeof err === "string") {
|
|
1286
|
+
error = Error(err);
|
|
1287
|
+
} else {
|
|
1288
|
+
error = Error("Rendering was cancelled");
|
|
1289
|
+
}
|
|
1290
|
+
window.remotion_cancelledError = error.stack;
|
|
1291
|
+
throw error;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// src/log.ts
|
|
1295
|
+
var logLevels = ["trace", "verbose", "info", "warn", "error"];
|
|
1296
|
+
var getNumberForLogLevel = (level) => {
|
|
1297
|
+
return logLevels.indexOf(level);
|
|
1298
|
+
};
|
|
1299
|
+
var isEqualOrBelowLogLevel = (currentLevel, level) => {
|
|
1300
|
+
return getNumberForLogLevel(currentLevel) <= getNumberForLogLevel(level);
|
|
1301
|
+
};
|
|
1302
|
+
var transformArgs = ({
|
|
1303
|
+
args,
|
|
1304
|
+
logLevel,
|
|
1305
|
+
tag
|
|
1306
|
+
}) => {
|
|
1307
|
+
const arr = [...args];
|
|
1308
|
+
if (getRemotionEnvironment().isRendering && !getRemotionEnvironment().isClientSideRendering) {
|
|
1309
|
+
arr.unshift(Symbol.for(`__remotion_level_${logLevel}`));
|
|
1310
|
+
}
|
|
1311
|
+
if (tag && getRemotionEnvironment().isRendering && !getRemotionEnvironment().isClientSideRendering) {
|
|
1312
|
+
arr.unshift(Symbol.for(`__remotion_tag_${tag}`));
|
|
1313
|
+
}
|
|
1314
|
+
return arr;
|
|
1315
|
+
};
|
|
1316
|
+
var verbose = (options, ...args) => {
|
|
1317
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "verbose")) {
|
|
1318
|
+
return console.debug(...transformArgs({ args, logLevel: "verbose", tag: options.tag }));
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
var trace = (options, ...args) => {
|
|
1322
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "trace")) {
|
|
1323
|
+
return console.debug(...transformArgs({ args, logLevel: "trace", tag: options.tag }));
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
var info = (options, ...args) => {
|
|
1327
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "info")) {
|
|
1328
|
+
return console.log(...transformArgs({ args, logLevel: "info", tag: options.tag }));
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
var warn = (options, ...args) => {
|
|
1332
|
+
if (isEqualOrBelowLogLevel(options.logLevel, "warn")) {
|
|
1333
|
+
return console.warn(...transformArgs({ args, logLevel: "warn", tag: options.tag }));
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
var error = (options, ...args) => {
|
|
1337
|
+
return console.error(...transformArgs({ args, logLevel: "error", tag: options.tag }));
|
|
1338
|
+
};
|
|
1339
|
+
var Log = {
|
|
1340
|
+
trace,
|
|
1341
|
+
verbose,
|
|
1342
|
+
info,
|
|
1343
|
+
warn,
|
|
1344
|
+
error
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
// src/delay-render.ts
|
|
1348
|
+
var handles = [];
|
|
1349
|
+
if (typeof window !== "undefined") {
|
|
1350
|
+
window.remotion_renderReady = false;
|
|
1351
|
+
if (!window.remotion_delayRenderTimeouts) {
|
|
1352
|
+
window.remotion_delayRenderTimeouts = {};
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
1356
|
+
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
1357
|
+
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
1358
|
+
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
1359
|
+
var defaultTimeout = 30000;
|
|
1360
|
+
var delayRenderInternal = (scope, environment, label, options) => {
|
|
1361
|
+
if (typeof label !== "string" && typeof label !== "undefined") {
|
|
1362
|
+
throw new Error("The label parameter of delayRender() must be a string or undefined, got: " + JSON.stringify(label));
|
|
1363
|
+
}
|
|
1364
|
+
const handle = Math.random();
|
|
1365
|
+
handles.push(handle);
|
|
1366
|
+
const called = Error().stack?.replace(/^Error/g, "") ?? "";
|
|
1367
|
+
if (environment.isRendering) {
|
|
1368
|
+
const timeoutToUse = (options?.timeoutInMilliseconds ?? (typeof scope === "undefined" ? defaultTimeout : scope.remotion_puppeteerTimeout ?? defaultTimeout)) - 2000;
|
|
1369
|
+
if (typeof scope !== "undefined") {
|
|
1370
|
+
const retriesLeft = (options?.retries ?? 0) - (scope.remotion_attempt - 1);
|
|
1371
|
+
scope.remotion_delayRenderTimeouts[handle] = {
|
|
1372
|
+
label: label ?? null,
|
|
1373
|
+
startTime: Date.now(),
|
|
1374
|
+
timeout: setTimeout(() => {
|
|
1375
|
+
const message = [
|
|
1376
|
+
`A delayRender()`,
|
|
1377
|
+
label ? `"${label}"` : null,
|
|
1378
|
+
`was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
|
|
1379
|
+
retriesLeft > 0 ? DELAY_RENDER_RETRIES_LEFT + retriesLeft : null,
|
|
1380
|
+
retriesLeft > 0 ? DELAY_RENDER_RETRY_TOKEN : null,
|
|
1381
|
+
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
1382
|
+
called
|
|
1383
|
+
].filter(truthy).join(" ");
|
|
1384
|
+
cancelRender(Error(message));
|
|
1385
|
+
}, timeoutToUse)
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
if (typeof scope !== "undefined") {
|
|
1390
|
+
scope.remotion_renderReady = false;
|
|
1391
|
+
}
|
|
1392
|
+
return handle;
|
|
1393
|
+
};
|
|
1394
|
+
var delayRender = (label, options) => {
|
|
1395
|
+
return delayRenderInternal(typeof window !== "undefined" ? window : undefined, getRemotionEnvironment(), label, options);
|
|
1396
|
+
};
|
|
1397
|
+
var continueRenderInternal = (scope, handle, environment) => {
|
|
1398
|
+
if (typeof handle === "undefined") {
|
|
1399
|
+
throw new TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");
|
|
1400
|
+
}
|
|
1401
|
+
if (typeof handle !== "number") {
|
|
1402
|
+
throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: " + JSON.stringify(handle));
|
|
1403
|
+
}
|
|
1404
|
+
handles = handles.filter((h) => {
|
|
1405
|
+
if (h === handle) {
|
|
1406
|
+
if (environment.isRendering && scope !== undefined) {
|
|
1407
|
+
if (!scope.remotion_delayRenderTimeouts[handle]) {
|
|
1408
|
+
return false;
|
|
1409
|
+
}
|
|
1410
|
+
const { label, startTime, timeout } = scope.remotion_delayRenderTimeouts[handle];
|
|
1411
|
+
clearTimeout(timeout);
|
|
1412
|
+
const message = [
|
|
1413
|
+
label ? `"${label}"` : "A handle",
|
|
1414
|
+
DELAY_RENDER_CLEAR_TOKEN,
|
|
1415
|
+
`${Date.now() - startTime}ms`
|
|
1416
|
+
].filter(truthy).join(" ");
|
|
1417
|
+
Log.verbose({ logLevel: window.remotion_logLevel, tag: "delayRender()" }, message);
|
|
1418
|
+
delete scope.remotion_delayRenderTimeouts[handle];
|
|
1419
|
+
}
|
|
1420
|
+
return false;
|
|
1421
|
+
}
|
|
1422
|
+
return true;
|
|
1423
|
+
});
|
|
1424
|
+
if (handles.length === 0 && typeof scope !== "undefined") {
|
|
1425
|
+
scope.remotion_renderReady = true;
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
var continueRender = (handle) => {
|
|
1429
|
+
continueRenderInternal(typeof window !== "undefined" ? window : undefined, handle, getRemotionEnvironment());
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// src/use-delay-render.tsx
|
|
1433
|
+
var DelayRenderContextType = createContext8(null);
|
|
1434
|
+
var useDelayRender = () => {
|
|
1435
|
+
const environment = useRemotionEnvironment();
|
|
1436
|
+
const scope = useContext7(DelayRenderContextType);
|
|
1437
|
+
const delayRender2 = useCallback4((label, options) => {
|
|
1438
|
+
return delayRenderInternal(scope ?? (typeof window !== "undefined" ? window : undefined), environment, label, options);
|
|
1439
|
+
}, [environment, scope]);
|
|
1440
|
+
const continueRender2 = useCallback4((handle) => {
|
|
1441
|
+
continueRenderInternal(scope ?? (typeof window !== "undefined" ? window : undefined), handle, environment);
|
|
1442
|
+
}, [environment, scope]);
|
|
1443
|
+
return { delayRender: delayRender2, continueRender: continueRender2 };
|
|
1444
|
+
};
|
|
1445
|
+
|
|
1446
|
+
// src/TimelineContext.tsx
|
|
1447
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1448
|
+
var SetTimelineContext = createContext9({
|
|
1449
|
+
setFrame: () => {
|
|
1450
|
+
throw new Error("default");
|
|
1451
|
+
},
|
|
1452
|
+
setPlaying: () => {
|
|
1453
|
+
throw new Error("default");
|
|
1454
|
+
}
|
|
1455
|
+
});
|
|
1456
|
+
var TimelineContext = createContext9({
|
|
1457
|
+
frame: {},
|
|
1458
|
+
playing: false,
|
|
1459
|
+
playbackRate: 1,
|
|
1460
|
+
rootId: "",
|
|
1461
|
+
imperativePlaying: {
|
|
1462
|
+
current: false
|
|
1463
|
+
},
|
|
1464
|
+
setPlaybackRate: () => {
|
|
1465
|
+
throw new Error("default");
|
|
1466
|
+
},
|
|
1467
|
+
audioAndVideoTags: { current: [] }
|
|
1468
|
+
});
|
|
1469
|
+
var TimelineContextProvider = ({ children, frameState }) => {
|
|
1470
|
+
const [playing, setPlaying] = useState5(false);
|
|
1471
|
+
const imperativePlaying = useRef2(false);
|
|
1472
|
+
const [playbackRate, setPlaybackRate] = useState5(1);
|
|
1473
|
+
const audioAndVideoTags = useRef2([]);
|
|
1474
|
+
const [remotionRootId] = useState5(() => String(random(null)));
|
|
1475
|
+
const [_frame, setFrame] = useState5(() => getInitialFrameState());
|
|
1476
|
+
const frame = frameState ?? _frame;
|
|
1477
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
1478
|
+
if (typeof window !== "undefined") {
|
|
1479
|
+
useLayoutEffect(() => {
|
|
1480
|
+
window.remotion_setFrame = (f, composition, attempt) => {
|
|
1481
|
+
window.remotion_attempt = attempt;
|
|
1482
|
+
const id = delayRender2(`Setting the current frame to ${f}`);
|
|
1483
|
+
let asyncUpdate = true;
|
|
1484
|
+
setFrame((s) => {
|
|
1485
|
+
const currentFrame = s[composition] ?? window.remotion_initialFrame;
|
|
1486
|
+
if (currentFrame === f) {
|
|
1487
|
+
asyncUpdate = false;
|
|
1488
|
+
return s;
|
|
1489
|
+
}
|
|
1490
|
+
return {
|
|
1491
|
+
...s,
|
|
1492
|
+
[composition]: f
|
|
1493
|
+
};
|
|
1494
|
+
});
|
|
1495
|
+
if (asyncUpdate) {
|
|
1496
|
+
requestAnimationFrame(() => continueRender2(id));
|
|
1497
|
+
} else {
|
|
1498
|
+
continueRender2(id);
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
window.remotion_isPlayer = false;
|
|
1502
|
+
}, [continueRender2, delayRender2]);
|
|
1503
|
+
}
|
|
1504
|
+
const timelineContextValue = useMemo7(() => {
|
|
1505
|
+
return {
|
|
1506
|
+
frame,
|
|
1507
|
+
playing,
|
|
1508
|
+
imperativePlaying,
|
|
1509
|
+
rootId: remotionRootId,
|
|
1510
|
+
playbackRate,
|
|
1511
|
+
setPlaybackRate,
|
|
1512
|
+
audioAndVideoTags
|
|
1513
|
+
};
|
|
1514
|
+
}, [frame, playbackRate, playing, remotionRootId]);
|
|
1515
|
+
const setTimelineContextValue = useMemo7(() => {
|
|
1516
|
+
return {
|
|
1517
|
+
setFrame,
|
|
1518
|
+
setPlaying
|
|
1519
|
+
};
|
|
1520
|
+
}, []);
|
|
1521
|
+
return /* @__PURE__ */ jsx6(TimelineContext.Provider, {
|
|
1522
|
+
value: timelineContextValue,
|
|
1523
|
+
children: /* @__PURE__ */ jsx6(SetTimelineContext.Provider, {
|
|
1524
|
+
value: setTimelineContextValue,
|
|
1525
|
+
children
|
|
1526
|
+
})
|
|
1527
|
+
});
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1230
1530
|
// src/use-video-config.ts
|
|
1231
|
-
import { useContext as
|
|
1531
|
+
import { useContext as useContext9 } from "react";
|
|
1232
1532
|
|
|
1233
1533
|
// src/CanUseRemotionHooks.tsx
|
|
1234
|
-
import { createContext as
|
|
1235
|
-
import { jsx as
|
|
1236
|
-
var CanUseRemotionHooks =
|
|
1534
|
+
import { createContext as createContext10 } from "react";
|
|
1535
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1536
|
+
var CanUseRemotionHooks = createContext10(false);
|
|
1237
1537
|
var CanUseRemotionHooksProvider = ({ children }) => {
|
|
1238
|
-
return /* @__PURE__ */
|
|
1538
|
+
return /* @__PURE__ */ jsx7(CanUseRemotionHooks.Provider, {
|
|
1239
1539
|
value: true,
|
|
1240
1540
|
children
|
|
1241
1541
|
});
|
|
1242
1542
|
};
|
|
1243
1543
|
|
|
1244
1544
|
// src/use-unsafe-video-config.ts
|
|
1245
|
-
import { useContext as
|
|
1545
|
+
import { useContext as useContext8, useMemo as useMemo8 } from "react";
|
|
1246
1546
|
var useUnsafeVideoConfig = () => {
|
|
1247
|
-
const context =
|
|
1547
|
+
const context = useContext8(SequenceContext);
|
|
1248
1548
|
const ctxWidth = context?.width ?? null;
|
|
1249
1549
|
const ctxHeight = context?.height ?? null;
|
|
1250
1550
|
const ctxDuration = context?.durationInFrames ?? null;
|
|
1251
1551
|
const video = useVideo();
|
|
1252
|
-
return
|
|
1552
|
+
return useMemo8(() => {
|
|
1253
1553
|
if (!video) {
|
|
1254
1554
|
return null;
|
|
1255
1555
|
}
|
|
@@ -1287,7 +1587,7 @@ var useUnsafeVideoConfig = () => {
|
|
|
1287
1587
|
// src/use-video-config.ts
|
|
1288
1588
|
var useVideoConfig = () => {
|
|
1289
1589
|
const videoConfig = useUnsafeVideoConfig();
|
|
1290
|
-
const context =
|
|
1590
|
+
const context = useContext9(CanUseRemotionHooks);
|
|
1291
1591
|
const isPlayer = useIsPlayer();
|
|
1292
1592
|
if (!videoConfig) {
|
|
1293
1593
|
if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
|
|
@@ -1306,12 +1606,12 @@ var useVideoConfig = () => {
|
|
|
1306
1606
|
};
|
|
1307
1607
|
|
|
1308
1608
|
// src/freeze.tsx
|
|
1309
|
-
import { useContext as
|
|
1609
|
+
import { useContext as useContext11, useMemo as useMemo9 } from "react";
|
|
1310
1610
|
|
|
1311
1611
|
// src/use-current-frame.ts
|
|
1312
|
-
import { useContext as
|
|
1612
|
+
import { useContext as useContext10 } from "react";
|
|
1313
1613
|
var useCurrentFrame = () => {
|
|
1314
|
-
const canUseRemotionHooks =
|
|
1614
|
+
const canUseRemotionHooks = useContext10(CanUseRemotionHooks);
|
|
1315
1615
|
const env = useRemotionEnvironment();
|
|
1316
1616
|
if (!canUseRemotionHooks) {
|
|
1317
1617
|
if (env.isPlayer) {
|
|
@@ -1320,13 +1620,13 @@ var useCurrentFrame = () => {
|
|
|
1320
1620
|
throw new Error(`useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions`);
|
|
1321
1621
|
}
|
|
1322
1622
|
const frame = useTimelinePosition();
|
|
1323
|
-
const context =
|
|
1623
|
+
const context = useContext10(SequenceContext);
|
|
1324
1624
|
const contextOffset = context ? context.cumulatedFrom + context.relativeFrom : 0;
|
|
1325
1625
|
return frame - contextOffset;
|
|
1326
1626
|
};
|
|
1327
1627
|
|
|
1328
1628
|
// src/freeze.tsx
|
|
1329
|
-
import { jsx as
|
|
1629
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1330
1630
|
var Freeze = ({
|
|
1331
1631
|
frame: frameToFreeze,
|
|
1332
1632
|
children,
|
|
@@ -1346,7 +1646,7 @@ var Freeze = ({
|
|
|
1346
1646
|
if (!Number.isFinite(frameToFreeze)) {
|
|
1347
1647
|
throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frameToFreeze}.`);
|
|
1348
1648
|
}
|
|
1349
|
-
const isActive =
|
|
1649
|
+
const isActive = useMemo9(() => {
|
|
1350
1650
|
if (typeof active === "boolean") {
|
|
1351
1651
|
return active;
|
|
1352
1652
|
}
|
|
@@ -1354,10 +1654,10 @@ var Freeze = ({
|
|
|
1354
1654
|
return active(frame);
|
|
1355
1655
|
}
|
|
1356
1656
|
}, [active, frame]);
|
|
1357
|
-
const timelineContext =
|
|
1358
|
-
const sequenceContext =
|
|
1657
|
+
const timelineContext = useContext11(TimelineContext);
|
|
1658
|
+
const sequenceContext = useContext11(SequenceContext);
|
|
1359
1659
|
const relativeFrom = sequenceContext?.relativeFrom ?? 0;
|
|
1360
|
-
const timelineValue =
|
|
1660
|
+
const timelineValue = useMemo9(() => {
|
|
1361
1661
|
if (!isActive) {
|
|
1362
1662
|
return timelineContext;
|
|
1363
1663
|
}
|
|
@@ -1372,7 +1672,7 @@ var Freeze = ({
|
|
|
1372
1672
|
}
|
|
1373
1673
|
};
|
|
1374
1674
|
}, [isActive, timelineContext, videoConfig.id, frameToFreeze, relativeFrom]);
|
|
1375
|
-
const newSequenceContext =
|
|
1675
|
+
const newSequenceContext = useMemo9(() => {
|
|
1376
1676
|
if (!sequenceContext) {
|
|
1377
1677
|
return null;
|
|
1378
1678
|
}
|
|
@@ -1385,9 +1685,9 @@ var Freeze = ({
|
|
|
1385
1685
|
cumulatedFrom: 0
|
|
1386
1686
|
};
|
|
1387
1687
|
}, [sequenceContext, isActive]);
|
|
1388
|
-
return /* @__PURE__ */
|
|
1688
|
+
return /* @__PURE__ */ jsx8(TimelineContext.Provider, {
|
|
1389
1689
|
value: timelineValue,
|
|
1390
|
-
children: /* @__PURE__ */
|
|
1690
|
+
children: /* @__PURE__ */ jsx8(SequenceContext.Provider, {
|
|
1391
1691
|
value: newSequenceContext,
|
|
1392
1692
|
children
|
|
1393
1693
|
})
|
|
@@ -1395,7 +1695,7 @@ var Freeze = ({
|
|
|
1395
1695
|
};
|
|
1396
1696
|
|
|
1397
1697
|
// src/Sequence.tsx
|
|
1398
|
-
import { jsx as
|
|
1698
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1399
1699
|
var RegularSequenceRefForwardingFunction = ({
|
|
1400
1700
|
from = 0,
|
|
1401
1701
|
durationInFrames = Infinity,
|
|
@@ -1411,9 +1711,9 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1411
1711
|
...other
|
|
1412
1712
|
}, ref) => {
|
|
1413
1713
|
const { layout = "absolute-fill" } = other;
|
|
1414
|
-
const [id] =
|
|
1415
|
-
const parentSequence =
|
|
1416
|
-
const { rootId } =
|
|
1714
|
+
const [id] = useState6(() => String(Math.random()));
|
|
1715
|
+
const parentSequence = useContext12(SequenceContext);
|
|
1716
|
+
const { rootId } = useContext12(TimelineContext);
|
|
1417
1717
|
const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
|
|
1418
1718
|
const nonce = useNonce();
|
|
1419
1719
|
if (layout !== "absolute-fill" && layout !== "none") {
|
|
@@ -1438,15 +1738,15 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1438
1738
|
const videoConfig = useVideoConfig();
|
|
1439
1739
|
const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
|
|
1440
1740
|
const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
|
|
1441
|
-
const { registerSequence, unregisterSequence } =
|
|
1442
|
-
const { hidden } =
|
|
1443
|
-
const premounting =
|
|
1741
|
+
const { registerSequence, unregisterSequence } = useContext12(SequenceManager);
|
|
1742
|
+
const { hidden } = useContext12(SequenceVisibilityToggleContext);
|
|
1743
|
+
const premounting = useMemo10(() => {
|
|
1444
1744
|
return parentSequence?.premounting || Boolean(other._remotionInternalIsPremounting);
|
|
1445
1745
|
}, [other._remotionInternalIsPremounting, parentSequence?.premounting]);
|
|
1446
|
-
const postmounting =
|
|
1746
|
+
const postmounting = useMemo10(() => {
|
|
1447
1747
|
return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
|
|
1448
1748
|
}, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
|
|
1449
|
-
const contextValue =
|
|
1749
|
+
const contextValue = useMemo10(() => {
|
|
1450
1750
|
return {
|
|
1451
1751
|
cumulatedFrom,
|
|
1452
1752
|
relativeFrom: from,
|
|
@@ -1473,7 +1773,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1473
1773
|
premountDisplay,
|
|
1474
1774
|
postmountDisplay
|
|
1475
1775
|
]);
|
|
1476
|
-
const timelineClipName =
|
|
1776
|
+
const timelineClipName = useMemo10(() => {
|
|
1477
1777
|
return name ?? "";
|
|
1478
1778
|
}, [name]);
|
|
1479
1779
|
const env = useRemotionEnvironment();
|
|
@@ -1521,7 +1821,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1521
1821
|
const endThreshold = Math.ceil(cumulatedFrom + from + durationInFrames - 1);
|
|
1522
1822
|
const content = absoluteFrame < cumulatedFrom + from ? null : absoluteFrame > endThreshold ? null : children;
|
|
1523
1823
|
const styleIfThere = other.layout === "none" ? undefined : other.style;
|
|
1524
|
-
const defaultStyle =
|
|
1824
|
+
const defaultStyle = useMemo10(() => {
|
|
1525
1825
|
return {
|
|
1526
1826
|
flexDirection: undefined,
|
|
1527
1827
|
...width ? { width } : {},
|
|
@@ -1536,9 +1836,9 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1536
1836
|
if (isSequenceHidden) {
|
|
1537
1837
|
return null;
|
|
1538
1838
|
}
|
|
1539
|
-
return /* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ jsx9(SequenceContext.Provider, {
|
|
1540
1840
|
value: contextValue,
|
|
1541
|
-
children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */
|
|
1841
|
+
children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */ jsx9(AbsoluteFill, {
|
|
1542
1842
|
ref,
|
|
1543
1843
|
style: defaultStyle,
|
|
1544
1844
|
className: other.className,
|
|
@@ -1567,7 +1867,7 @@ var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
|
1567
1867
|
const postmountingActive = frame > endThreshold && frame <= endThreshold + postmountFor;
|
|
1568
1868
|
const freezeFrame = premountingActive ? from : postmountingActive ? from + durationInFrames - 1 : 0;
|
|
1569
1869
|
const isFreezingActive = premountingActive || postmountingActive;
|
|
1570
|
-
const style =
|
|
1870
|
+
const style = useMemo10(() => {
|
|
1571
1871
|
return {
|
|
1572
1872
|
...passedStyle,
|
|
1573
1873
|
opacity: premountingActive || postmountingActive ? 0 : 1,
|
|
@@ -1582,246 +1882,52 @@ var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
|
1582
1882
|
styleWhilePremounted,
|
|
1583
1883
|
styleWhilePostmounted
|
|
1584
1884
|
]);
|
|
1585
|
-
return /* @__PURE__ */
|
|
1885
|
+
return /* @__PURE__ */ jsx9(Freeze, {
|
|
1586
1886
|
frame: freezeFrame,
|
|
1587
1887
|
active: isFreezingActive,
|
|
1588
|
-
children: /* @__PURE__ */
|
|
1888
|
+
children: /* @__PURE__ */ jsx9(Sequence, {
|
|
1589
1889
|
ref,
|
|
1590
1890
|
from,
|
|
1591
1891
|
durationInFrames,
|
|
1592
1892
|
style,
|
|
1593
1893
|
_remotionInternalPremountDisplay: premountFor,
|
|
1594
1894
|
_remotionInternalPostmountDisplay: postmountFor,
|
|
1595
|
-
_remotionInternalIsPremounting: premountingActive,
|
|
1596
|
-
_remotionInternalIsPostmounting: postmountingActive,
|
|
1597
|
-
...otherProps
|
|
1598
|
-
})
|
|
1599
|
-
});
|
|
1600
|
-
};
|
|
1601
|
-
var PremountedPostmountedSequence = forwardRef2(PremountedPostmountedSequenceRefForwardingFunction);
|
|
1602
|
-
var SequenceRefForwardingFunction = (props, ref) => {
|
|
1603
|
-
const env = useRemotionEnvironment();
|
|
1604
|
-
if (props.layout !== "none" && !env.isRendering) {
|
|
1605
|
-
if (props.premountFor || props.postmountFor) {
|
|
1606
|
-
return /* @__PURE__ */ jsx8(PremountedPostmountedSequence, {
|
|
1607
|
-
...props,
|
|
1608
|
-
ref
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
return /* @__PURE__ */ jsx8(RegularSequence, {
|
|
1613
|
-
...props,
|
|
1614
|
-
ref
|
|
1615
|
-
});
|
|
1616
|
-
};
|
|
1617
|
-
var Sequence = forwardRef2(SequenceRefForwardingFunction);
|
|
1618
|
-
// src/animated-image/AnimatedImage.tsx
|
|
1619
|
-
import {
|
|
1620
|
-
forwardRef as forwardRef3,
|
|
1621
|
-
useEffect as useEffect4,
|
|
1622
|
-
useImperativeHandle as useImperativeHandle4,
|
|
1623
|
-
useLayoutEffect,
|
|
1624
|
-
useRef as useRef3,
|
|
1625
|
-
useState as useState6
|
|
1626
|
-
} from "react";
|
|
1627
|
-
|
|
1628
|
-
// src/cancel-render.ts
|
|
1629
|
-
var isErrorLike = (err) => {
|
|
1630
|
-
if (err instanceof Error) {
|
|
1631
|
-
return true;
|
|
1632
|
-
}
|
|
1633
|
-
if (err === null) {
|
|
1634
|
-
return false;
|
|
1635
|
-
}
|
|
1636
|
-
if (typeof err !== "object") {
|
|
1637
|
-
return false;
|
|
1638
|
-
}
|
|
1639
|
-
if (!("stack" in err)) {
|
|
1640
|
-
return false;
|
|
1641
|
-
}
|
|
1642
|
-
if (typeof err.stack !== "string") {
|
|
1643
|
-
return false;
|
|
1644
|
-
}
|
|
1645
|
-
if (!("message" in err)) {
|
|
1646
|
-
return false;
|
|
1647
|
-
}
|
|
1648
|
-
if (typeof err.message !== "string") {
|
|
1649
|
-
return false;
|
|
1650
|
-
}
|
|
1651
|
-
return true;
|
|
1652
|
-
};
|
|
1653
|
-
function cancelRender(err) {
|
|
1654
|
-
let error;
|
|
1655
|
-
if (isErrorLike(err)) {
|
|
1656
|
-
error = err;
|
|
1657
|
-
if (!error.stack) {
|
|
1658
|
-
error.stack = new Error(error.message).stack;
|
|
1659
|
-
}
|
|
1660
|
-
} else if (typeof err === "string") {
|
|
1661
|
-
error = Error(err);
|
|
1662
|
-
} else {
|
|
1663
|
-
error = Error("Rendering was cancelled");
|
|
1664
|
-
}
|
|
1665
|
-
window.remotion_cancelledError = error.stack;
|
|
1666
|
-
throw error;
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
// src/use-delay-render.ts
|
|
1670
|
-
import { useCallback as useCallback4 } from "react";
|
|
1671
|
-
|
|
1672
|
-
// src/log.ts
|
|
1673
|
-
var logLevels = ["trace", "verbose", "info", "warn", "error"];
|
|
1674
|
-
var getNumberForLogLevel = (level) => {
|
|
1675
|
-
return logLevels.indexOf(level);
|
|
1676
|
-
};
|
|
1677
|
-
var isEqualOrBelowLogLevel = (currentLevel, level) => {
|
|
1678
|
-
return getNumberForLogLevel(currentLevel) <= getNumberForLogLevel(level);
|
|
1679
|
-
};
|
|
1680
|
-
var transformArgs = ({
|
|
1681
|
-
args,
|
|
1682
|
-
logLevel,
|
|
1683
|
-
tag
|
|
1684
|
-
}) => {
|
|
1685
|
-
const arr = [...args];
|
|
1686
|
-
if (getRemotionEnvironment().isRendering && !getRemotionEnvironment().isClientSideRendering) {
|
|
1687
|
-
arr.unshift(Symbol.for(`__remotion_level_${logLevel}`));
|
|
1688
|
-
}
|
|
1689
|
-
if (tag && getRemotionEnvironment().isRendering && !getRemotionEnvironment().isClientSideRendering) {
|
|
1690
|
-
arr.unshift(Symbol.for(`__remotion_tag_${tag}`));
|
|
1691
|
-
}
|
|
1692
|
-
return arr;
|
|
1693
|
-
};
|
|
1694
|
-
var verbose = (options, ...args) => {
|
|
1695
|
-
if (isEqualOrBelowLogLevel(options.logLevel, "verbose")) {
|
|
1696
|
-
return console.debug(...transformArgs({ args, logLevel: "verbose", tag: options.tag }));
|
|
1697
|
-
}
|
|
1698
|
-
};
|
|
1699
|
-
var trace = (options, ...args) => {
|
|
1700
|
-
if (isEqualOrBelowLogLevel(options.logLevel, "trace")) {
|
|
1701
|
-
return console.debug(...transformArgs({ args, logLevel: "trace", tag: options.tag }));
|
|
1702
|
-
}
|
|
1703
|
-
};
|
|
1704
|
-
var info = (options, ...args) => {
|
|
1705
|
-
if (isEqualOrBelowLogLevel(options.logLevel, "info")) {
|
|
1706
|
-
return console.log(...transformArgs({ args, logLevel: "info", tag: options.tag }));
|
|
1707
|
-
}
|
|
1708
|
-
};
|
|
1709
|
-
var warn = (options, ...args) => {
|
|
1710
|
-
if (isEqualOrBelowLogLevel(options.logLevel, "warn")) {
|
|
1711
|
-
return console.warn(...transformArgs({ args, logLevel: "warn", tag: options.tag }));
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
var error = (options, ...args) => {
|
|
1715
|
-
return console.error(...transformArgs({ args, logLevel: "error", tag: options.tag }));
|
|
1716
|
-
};
|
|
1717
|
-
var Log = {
|
|
1718
|
-
trace,
|
|
1719
|
-
verbose,
|
|
1720
|
-
info,
|
|
1721
|
-
warn,
|
|
1722
|
-
error
|
|
1723
|
-
};
|
|
1724
|
-
|
|
1725
|
-
// src/delay-render.ts
|
|
1726
|
-
var handles = [];
|
|
1727
|
-
if (typeof window !== "undefined") {
|
|
1728
|
-
window.remotion_renderReady = false;
|
|
1729
|
-
if (!window.remotion_delayRenderTimeouts) {
|
|
1730
|
-
window.remotion_delayRenderTimeouts = {};
|
|
1731
|
-
}
|
|
1732
|
-
}
|
|
1733
|
-
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
1734
|
-
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
1735
|
-
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
1736
|
-
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
1737
|
-
var defaultTimeout = 30000;
|
|
1738
|
-
var delayRenderInternal = (environment, label, options) => {
|
|
1739
|
-
if (typeof label !== "string" && typeof label !== "undefined") {
|
|
1740
|
-
throw new Error("The label parameter of delayRender() must be a string or undefined, got: " + JSON.stringify(label));
|
|
1741
|
-
}
|
|
1742
|
-
const handle = Math.random();
|
|
1743
|
-
handles.push(handle);
|
|
1744
|
-
const called = Error().stack?.replace(/^Error/g, "") ?? "";
|
|
1745
|
-
if (environment.isRendering) {
|
|
1746
|
-
const timeoutToUse = (options?.timeoutInMilliseconds ?? (typeof window === "undefined" ? defaultTimeout : window.remotion_puppeteerTimeout ?? defaultTimeout)) - 2000;
|
|
1747
|
-
if (typeof window !== "undefined") {
|
|
1748
|
-
const retriesLeft = (options?.retries ?? 0) - (window.remotion_attempt - 1);
|
|
1749
|
-
window.remotion_delayRenderTimeouts[handle] = {
|
|
1750
|
-
label: label ?? null,
|
|
1751
|
-
startTime: Date.now(),
|
|
1752
|
-
timeout: setTimeout(() => {
|
|
1753
|
-
const message = [
|
|
1754
|
-
`A delayRender()`,
|
|
1755
|
-
label ? `"${label}"` : null,
|
|
1756
|
-
`was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
|
|
1757
|
-
retriesLeft > 0 ? DELAY_RENDER_RETRIES_LEFT + retriesLeft : null,
|
|
1758
|
-
retriesLeft > 0 ? DELAY_RENDER_RETRY_TOKEN : null,
|
|
1759
|
-
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
1760
|
-
called
|
|
1761
|
-
].filter(truthy).join(" ");
|
|
1762
|
-
cancelRender(Error(message));
|
|
1763
|
-
}, timeoutToUse)
|
|
1764
|
-
};
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
if (typeof window !== "undefined") {
|
|
1768
|
-
window.remotion_renderReady = false;
|
|
1769
|
-
}
|
|
1770
|
-
return handle;
|
|
1771
|
-
};
|
|
1772
|
-
var delayRender = (label, options) => {
|
|
1773
|
-
return delayRenderInternal(getRemotionEnvironment(), label, options);
|
|
1895
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
1896
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
1897
|
+
...otherProps
|
|
1898
|
+
})
|
|
1899
|
+
});
|
|
1774
1900
|
};
|
|
1775
|
-
var
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
if (environment.isRendering) {
|
|
1785
|
-
if (!window.remotion_delayRenderTimeouts[handle]) {
|
|
1786
|
-
return false;
|
|
1787
|
-
}
|
|
1788
|
-
const { label, startTime, timeout } = window.remotion_delayRenderTimeouts[handle];
|
|
1789
|
-
clearTimeout(timeout);
|
|
1790
|
-
const message = [
|
|
1791
|
-
label ? `"${label}"` : "A handle",
|
|
1792
|
-
DELAY_RENDER_CLEAR_TOKEN,
|
|
1793
|
-
`${Date.now() - startTime}ms`
|
|
1794
|
-
].filter(truthy).join(" ");
|
|
1795
|
-
Log.verbose({ logLevel: window.remotion_logLevel, tag: "delayRender()" }, message);
|
|
1796
|
-
delete window.remotion_delayRenderTimeouts[handle];
|
|
1797
|
-
}
|
|
1798
|
-
return false;
|
|
1901
|
+
var PremountedPostmountedSequence = forwardRef2(PremountedPostmountedSequenceRefForwardingFunction);
|
|
1902
|
+
var SequenceRefForwardingFunction = (props, ref) => {
|
|
1903
|
+
const env = useRemotionEnvironment();
|
|
1904
|
+
if (props.layout !== "none" && !env.isRendering) {
|
|
1905
|
+
if (props.premountFor || props.postmountFor) {
|
|
1906
|
+
return /* @__PURE__ */ jsx9(PremountedPostmountedSequence, {
|
|
1907
|
+
...props,
|
|
1908
|
+
ref
|
|
1909
|
+
});
|
|
1799
1910
|
}
|
|
1800
|
-
return true;
|
|
1801
|
-
});
|
|
1802
|
-
if (handles.length === 0 && typeof window !== "undefined") {
|
|
1803
|
-
window.remotion_renderReady = true;
|
|
1804
1911
|
}
|
|
1912
|
+
return /* @__PURE__ */ jsx9(RegularSequence, {
|
|
1913
|
+
...props,
|
|
1914
|
+
ref
|
|
1915
|
+
});
|
|
1805
1916
|
};
|
|
1806
|
-
var
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
const continueRender2 = useCallback4((handle) => {
|
|
1817
|
-
continueRenderInternal(handle, environment);
|
|
1818
|
-
}, [environment]);
|
|
1819
|
-
return { delayRender: delayRender2, continueRender: continueRender2 };
|
|
1820
|
-
};
|
|
1917
|
+
var Sequence = forwardRef2(SequenceRefForwardingFunction);
|
|
1918
|
+
// src/animated-image/AnimatedImage.tsx
|
|
1919
|
+
import {
|
|
1920
|
+
forwardRef as forwardRef3,
|
|
1921
|
+
useEffect as useEffect4,
|
|
1922
|
+
useImperativeHandle as useImperativeHandle4,
|
|
1923
|
+
useLayoutEffect as useLayoutEffect2,
|
|
1924
|
+
useRef as useRef4,
|
|
1925
|
+
useState as useState7
|
|
1926
|
+
} from "react";
|
|
1821
1927
|
|
|
1822
1928
|
// src/animated-image/canvas.tsx
|
|
1823
|
-
import
|
|
1824
|
-
import { jsx as
|
|
1929
|
+
import React10, { useCallback as useCallback5, useImperativeHandle as useImperativeHandle3, useRef as useRef3 } from "react";
|
|
1930
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1825
1931
|
var calcArgs = (fit, frameSize, canvasSize) => {
|
|
1826
1932
|
switch (fit) {
|
|
1827
1933
|
case "fill": {
|
|
@@ -1871,7 +1977,7 @@ var calcArgs = (fit, frameSize, canvasSize) => {
|
|
|
1871
1977
|
}
|
|
1872
1978
|
};
|
|
1873
1979
|
var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref) => {
|
|
1874
|
-
const canvasRef =
|
|
1980
|
+
const canvasRef = useRef3(null);
|
|
1875
1981
|
const draw = useCallback5((imageData) => {
|
|
1876
1982
|
const canvas = canvasRef.current;
|
|
1877
1983
|
const canvasWidth = width ?? imageData.displayWidth;
|
|
@@ -1911,13 +2017,13 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref
|
|
|
1911
2017
|
}
|
|
1912
2018
|
};
|
|
1913
2019
|
}, [draw]);
|
|
1914
|
-
return /* @__PURE__ */
|
|
2020
|
+
return /* @__PURE__ */ jsx10("canvas", {
|
|
1915
2021
|
ref: canvasRef,
|
|
1916
2022
|
className,
|
|
1917
2023
|
style
|
|
1918
2024
|
});
|
|
1919
2025
|
};
|
|
1920
|
-
var Canvas =
|
|
2026
|
+
var Canvas = React10.forwardRef(CanvasRefForwardingFunction);
|
|
1921
2027
|
|
|
1922
2028
|
// src/animated-image/decode-image.ts
|
|
1923
2029
|
var CACHE_SIZE = 5;
|
|
@@ -2070,7 +2176,7 @@ var resolveAnimatedImageSource = (src) => {
|
|
|
2070
2176
|
};
|
|
2071
2177
|
|
|
2072
2178
|
// src/animated-image/AnimatedImage.tsx
|
|
2073
|
-
import { jsx as
|
|
2179
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2074
2180
|
var AnimatedImage = forwardRef3(({
|
|
2075
2181
|
src,
|
|
2076
2182
|
width,
|
|
@@ -2081,7 +2187,7 @@ var AnimatedImage = forwardRef3(({
|
|
|
2081
2187
|
fit = "fill",
|
|
2082
2188
|
...props
|
|
2083
2189
|
}, canvasRef) => {
|
|
2084
|
-
const mountState =
|
|
2190
|
+
const mountState = useRef4({ isMounted: true });
|
|
2085
2191
|
useEffect4(() => {
|
|
2086
2192
|
const { current } = mountState;
|
|
2087
2193
|
current.isMounted = true;
|
|
@@ -2090,15 +2196,15 @@ var AnimatedImage = forwardRef3(({
|
|
|
2090
2196
|
};
|
|
2091
2197
|
}, []);
|
|
2092
2198
|
const resolvedSrc = resolveAnimatedImageSource(src);
|
|
2093
|
-
const [imageDecoder, setImageDecoder] =
|
|
2199
|
+
const [imageDecoder, setImageDecoder] = useState7(null);
|
|
2094
2200
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
2095
|
-
const [decodeHandle] =
|
|
2201
|
+
const [decodeHandle] = useState7(() => delayRender2(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
|
|
2096
2202
|
const frame = useCurrentFrame();
|
|
2097
2203
|
const { fps } = useVideoConfig();
|
|
2098
2204
|
const currentTime = frame / playbackRate / fps;
|
|
2099
|
-
const currentTimeRef =
|
|
2205
|
+
const currentTimeRef = useRef4(currentTime);
|
|
2100
2206
|
currentTimeRef.current = currentTime;
|
|
2101
|
-
const ref =
|
|
2207
|
+
const ref = useRef4(null);
|
|
2102
2208
|
useImperativeHandle4(canvasRef, () => {
|
|
2103
2209
|
const c = ref.current?.getCanvas();
|
|
2104
2210
|
if (!c) {
|
|
@@ -2106,7 +2212,7 @@ var AnimatedImage = forwardRef3(({
|
|
|
2106
2212
|
}
|
|
2107
2213
|
return c;
|
|
2108
2214
|
}, []);
|
|
2109
|
-
const [initialLoopBehavior] =
|
|
2215
|
+
const [initialLoopBehavior] = useState7(() => loopBehavior);
|
|
2110
2216
|
useEffect4(() => {
|
|
2111
2217
|
const controller = new AbortController;
|
|
2112
2218
|
decodeImage({
|
|
@@ -2139,7 +2245,7 @@ var AnimatedImage = forwardRef3(({
|
|
|
2139
2245
|
initialLoopBehavior,
|
|
2140
2246
|
continueRender2
|
|
2141
2247
|
]);
|
|
2142
|
-
|
|
2248
|
+
useLayoutEffect2(() => {
|
|
2143
2249
|
if (!imageDecoder) {
|
|
2144
2250
|
return;
|
|
2145
2251
|
}
|
|
@@ -2170,7 +2276,7 @@ var AnimatedImage = forwardRef3(({
|
|
|
2170
2276
|
continueRender2,
|
|
2171
2277
|
delayRender2
|
|
2172
2278
|
]);
|
|
2173
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ jsx11(Canvas, {
|
|
2174
2280
|
ref,
|
|
2175
2281
|
width,
|
|
2176
2282
|
height,
|
|
@@ -2179,15 +2285,15 @@ var AnimatedImage = forwardRef3(({
|
|
|
2179
2285
|
});
|
|
2180
2286
|
});
|
|
2181
2287
|
// src/Artifact.tsx
|
|
2182
|
-
import { useContext as
|
|
2288
|
+
import { useContext as useContext13, useEffect as useEffect5, useState as useState9 } from "react";
|
|
2183
2289
|
|
|
2184
2290
|
// src/RenderAssetManager.tsx
|
|
2185
2291
|
import {
|
|
2186
|
-
createContext as
|
|
2292
|
+
createContext as createContext11,
|
|
2187
2293
|
useCallback as useCallback6,
|
|
2188
|
-
useLayoutEffect as
|
|
2189
|
-
useMemo as
|
|
2190
|
-
useState as
|
|
2294
|
+
useLayoutEffect as useLayoutEffect3,
|
|
2295
|
+
useMemo as useMemo11,
|
|
2296
|
+
useState as useState8
|
|
2191
2297
|
} from "react";
|
|
2192
2298
|
|
|
2193
2299
|
// src/validation/validate-artifact.ts
|
|
@@ -2222,8 +2328,8 @@ var validateRenderAsset = (artifact) => {
|
|
|
2222
2328
|
};
|
|
2223
2329
|
|
|
2224
2330
|
// src/RenderAssetManager.tsx
|
|
2225
|
-
import { jsx as
|
|
2226
|
-
var RenderAssetManager =
|
|
2331
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2332
|
+
var RenderAssetManager = createContext11({
|
|
2227
2333
|
registerRenderAsset: () => {
|
|
2228
2334
|
return;
|
|
2229
2335
|
},
|
|
@@ -2233,7 +2339,7 @@ var RenderAssetManager = createContext10({
|
|
|
2233
2339
|
renderAssets: []
|
|
2234
2340
|
});
|
|
2235
2341
|
var RenderAssetManagerProvider = ({ children }) => {
|
|
2236
|
-
const [renderAssets, setRenderAssets] =
|
|
2342
|
+
const [renderAssets, setRenderAssets] = useState8([]);
|
|
2237
2343
|
const registerRenderAsset = useCallback6((renderAsset) => {
|
|
2238
2344
|
validateRenderAsset(renderAsset);
|
|
2239
2345
|
setRenderAssets((assets) => {
|
|
@@ -2245,7 +2351,7 @@ var RenderAssetManagerProvider = ({ children }) => {
|
|
|
2245
2351
|
return assts.filter((a) => a.id !== id);
|
|
2246
2352
|
});
|
|
2247
2353
|
}, []);
|
|
2248
|
-
|
|
2354
|
+
useLayoutEffect3(() => {
|
|
2249
2355
|
if (typeof window !== "undefined") {
|
|
2250
2356
|
window.remotion_collectAssets = () => {
|
|
2251
2357
|
setRenderAssets([]);
|
|
@@ -2253,14 +2359,14 @@ var RenderAssetManagerProvider = ({ children }) => {
|
|
|
2253
2359
|
};
|
|
2254
2360
|
}
|
|
2255
2361
|
}, [renderAssets]);
|
|
2256
|
-
const contextValue =
|
|
2362
|
+
const contextValue = useMemo11(() => {
|
|
2257
2363
|
return {
|
|
2258
2364
|
registerRenderAsset,
|
|
2259
2365
|
unregisterRenderAsset,
|
|
2260
2366
|
renderAssets
|
|
2261
2367
|
};
|
|
2262
2368
|
}, [renderAssets, registerRenderAsset, unregisterRenderAsset]);
|
|
2263
|
-
return /* @__PURE__ */
|
|
2369
|
+
return /* @__PURE__ */ jsx12(RenderAssetManager.Provider, {
|
|
2264
2370
|
value: contextValue,
|
|
2265
2371
|
children
|
|
2266
2372
|
});
|
|
@@ -2269,10 +2375,10 @@ var RenderAssetManagerProvider = ({ children }) => {
|
|
|
2269
2375
|
// src/Artifact.tsx
|
|
2270
2376
|
var ArtifactThumbnail = Symbol("Thumbnail");
|
|
2271
2377
|
var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
2272
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
2378
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext13(RenderAssetManager);
|
|
2273
2379
|
const env = useRemotionEnvironment();
|
|
2274
2380
|
const frame = useCurrentFrame();
|
|
2275
|
-
const [id] =
|
|
2381
|
+
const [id] = useState9(() => {
|
|
2276
2382
|
return String(Math.random());
|
|
2277
2383
|
});
|
|
2278
2384
|
useEffect5(() => {
|
|
@@ -2326,7 +2432,7 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
|
2326
2432
|
};
|
|
2327
2433
|
Artifact.Thumbnail = ArtifactThumbnail;
|
|
2328
2434
|
// src/audio/Audio.tsx
|
|
2329
|
-
import { forwardRef as forwardRef6, useCallback as useCallback11, useContext as
|
|
2435
|
+
import { forwardRef as forwardRef6, useCallback as useCallback11, useContext as useContext27 } from "react";
|
|
2330
2436
|
|
|
2331
2437
|
// src/absolute-src.ts
|
|
2332
2438
|
var getAbsoluteSrc = (relativeSrc) => {
|
|
@@ -2358,11 +2464,11 @@ var calculateMediaDuration = ({
|
|
|
2358
2464
|
};
|
|
2359
2465
|
|
|
2360
2466
|
// src/loop/index.tsx
|
|
2361
|
-
import
|
|
2362
|
-
import { jsx as
|
|
2363
|
-
var LoopContext =
|
|
2467
|
+
import React11, { createContext as createContext12, useMemo as useMemo12 } from "react";
|
|
2468
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2469
|
+
var LoopContext = createContext12(null);
|
|
2364
2470
|
var useLoop = () => {
|
|
2365
|
-
return
|
|
2471
|
+
return React11.useContext(LoopContext);
|
|
2366
2472
|
};
|
|
2367
2473
|
var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) => {
|
|
2368
2474
|
const currentFrame = useCurrentFrame();
|
|
@@ -2387,22 +2493,22 @@ var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) =>
|
|
|
2387
2493
|
const iteration = Math.floor(currentFrame / durationInFrames);
|
|
2388
2494
|
const start = iteration * durationInFrames;
|
|
2389
2495
|
const from = Math.min(start, maxFrame);
|
|
2390
|
-
const loopDisplay =
|
|
2496
|
+
const loopDisplay = useMemo12(() => {
|
|
2391
2497
|
return {
|
|
2392
2498
|
numberOfTimes: actualTimes,
|
|
2393
2499
|
startOffset: -from,
|
|
2394
2500
|
durationInFrames
|
|
2395
2501
|
};
|
|
2396
2502
|
}, [actualTimes, durationInFrames, from]);
|
|
2397
|
-
const loopContext =
|
|
2503
|
+
const loopContext = useMemo12(() => {
|
|
2398
2504
|
return {
|
|
2399
2505
|
iteration: Math.floor(currentFrame / durationInFrames),
|
|
2400
2506
|
durationInFrames
|
|
2401
2507
|
};
|
|
2402
2508
|
}, [currentFrame, durationInFrames]);
|
|
2403
|
-
return /* @__PURE__ */
|
|
2509
|
+
return /* @__PURE__ */ jsx13(LoopContext.Provider, {
|
|
2404
2510
|
value: loopContext,
|
|
2405
|
-
children: /* @__PURE__ */
|
|
2511
|
+
children: /* @__PURE__ */ jsx13(Sequence, {
|
|
2406
2512
|
durationInFrames,
|
|
2407
2513
|
from,
|
|
2408
2514
|
name: name ?? "<Loop>",
|
|
@@ -2416,7 +2522,7 @@ var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) =>
|
|
|
2416
2522
|
Loop.useLoop = useLoop;
|
|
2417
2523
|
|
|
2418
2524
|
// src/prefetch.ts
|
|
2419
|
-
import { useContext as
|
|
2525
|
+
import { useContext as useContext14 } from "react";
|
|
2420
2526
|
|
|
2421
2527
|
// src/playback-logging.ts
|
|
2422
2528
|
var playbackLogging = ({
|
|
@@ -2430,9 +2536,9 @@ var playbackLogging = ({
|
|
|
2430
2536
|
};
|
|
2431
2537
|
|
|
2432
2538
|
// src/prefetch-state.tsx
|
|
2433
|
-
import { createContext as
|
|
2434
|
-
import { jsx as
|
|
2435
|
-
var PreloadContext =
|
|
2539
|
+
import { createContext as createContext13, useEffect as useEffect6, useState as useState10 } from "react";
|
|
2540
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2541
|
+
var PreloadContext = createContext13({});
|
|
2436
2542
|
var preloads = {};
|
|
2437
2543
|
var updaters = [];
|
|
2438
2544
|
var setPreloads = (updater) => {
|
|
@@ -2440,7 +2546,7 @@ var setPreloads = (updater) => {
|
|
|
2440
2546
|
updaters.forEach((u) => u());
|
|
2441
2547
|
};
|
|
2442
2548
|
var PrefetchProvider = ({ children }) => {
|
|
2443
|
-
const [_preloads, _setPreloads] =
|
|
2549
|
+
const [_preloads, _setPreloads] = useState10(() => preloads);
|
|
2444
2550
|
useEffect6(() => {
|
|
2445
2551
|
const updaterFunction = () => {
|
|
2446
2552
|
_setPreloads(preloads);
|
|
@@ -2450,7 +2556,7 @@ var PrefetchProvider = ({ children }) => {
|
|
|
2450
2556
|
updaters = updaters.filter((u) => u !== updaterFunction);
|
|
2451
2557
|
};
|
|
2452
2558
|
}, []);
|
|
2453
|
-
return /* @__PURE__ */
|
|
2559
|
+
return /* @__PURE__ */ jsx14(PreloadContext.Provider, {
|
|
2454
2560
|
value: _preloads,
|
|
2455
2561
|
children
|
|
2456
2562
|
});
|
|
@@ -2472,7 +2578,7 @@ var getSrcWithoutHash = (src) => {
|
|
|
2472
2578
|
return src.slice(0, hashIndex);
|
|
2473
2579
|
};
|
|
2474
2580
|
var usePreload = (src) => {
|
|
2475
|
-
const preloads2 =
|
|
2581
|
+
const preloads2 = useContext14(PreloadContext);
|
|
2476
2582
|
const hashFragmentIndex = removeAndGetHashFragment(src);
|
|
2477
2583
|
const withoutHashFragment = getSrcWithoutHash(src);
|
|
2478
2584
|
if (!preloads2[withoutHashFragment]) {
|
|
@@ -2745,8 +2851,8 @@ var resolveTrimProps = ({
|
|
|
2745
2851
|
};
|
|
2746
2852
|
|
|
2747
2853
|
// src/video/duration-state.tsx
|
|
2748
|
-
import { createContext as
|
|
2749
|
-
import { jsx as
|
|
2854
|
+
import { createContext as createContext14, useMemo as useMemo13, useReducer } from "react";
|
|
2855
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2750
2856
|
var durationReducer = (state, action) => {
|
|
2751
2857
|
switch (action.type) {
|
|
2752
2858
|
case "got-duration": {
|
|
@@ -2763,7 +2869,7 @@ var durationReducer = (state, action) => {
|
|
|
2763
2869
|
return state;
|
|
2764
2870
|
}
|
|
2765
2871
|
};
|
|
2766
|
-
var DurationsContext =
|
|
2872
|
+
var DurationsContext = createContext14({
|
|
2767
2873
|
durations: {},
|
|
2768
2874
|
setDurations: () => {
|
|
2769
2875
|
throw new Error("context missing");
|
|
@@ -2771,13 +2877,13 @@ var DurationsContext = createContext13({
|
|
|
2771
2877
|
});
|
|
2772
2878
|
var DurationsContextProvider = ({ children }) => {
|
|
2773
2879
|
const [durations, setDurations] = useReducer(durationReducer, {});
|
|
2774
|
-
const value =
|
|
2880
|
+
const value = useMemo13(() => {
|
|
2775
2881
|
return {
|
|
2776
2882
|
durations,
|
|
2777
2883
|
setDurations
|
|
2778
2884
|
};
|
|
2779
2885
|
}, [durations]);
|
|
2780
|
-
return /* @__PURE__ */
|
|
2886
|
+
return /* @__PURE__ */ jsx15(DurationsContext.Provider, {
|
|
2781
2887
|
value,
|
|
2782
2888
|
children
|
|
2783
2889
|
});
|
|
@@ -2786,12 +2892,12 @@ var DurationsContextProvider = ({ children }) => {
|
|
|
2786
2892
|
// src/audio/AudioForPreview.tsx
|
|
2787
2893
|
import {
|
|
2788
2894
|
forwardRef as forwardRef4,
|
|
2789
|
-
useContext as
|
|
2895
|
+
useContext as useContext25,
|
|
2790
2896
|
useEffect as useEffect14,
|
|
2791
2897
|
useImperativeHandle as useImperativeHandle5,
|
|
2792
|
-
useMemo as
|
|
2793
|
-
useRef as
|
|
2794
|
-
useState as
|
|
2898
|
+
useMemo as useMemo21,
|
|
2899
|
+
useRef as useRef12,
|
|
2900
|
+
useState as useState15
|
|
2795
2901
|
} from "react";
|
|
2796
2902
|
|
|
2797
2903
|
// src/get-cross-origin-value.ts
|
|
@@ -2809,74 +2915,40 @@ var getCrossOriginValue = ({
|
|
|
2809
2915
|
};
|
|
2810
2916
|
|
|
2811
2917
|
// src/log-level-context.tsx
|
|
2812
|
-
import { createContext as
|
|
2813
|
-
import * as
|
|
2814
|
-
var LogLevelContext =
|
|
2918
|
+
import { createContext as createContext15 } from "react";
|
|
2919
|
+
import * as React14 from "react";
|
|
2920
|
+
var LogLevelContext = createContext15({
|
|
2815
2921
|
logLevel: "info",
|
|
2816
2922
|
mountTime: 0
|
|
2817
2923
|
});
|
|
2818
2924
|
var useLogLevel = () => {
|
|
2819
|
-
const { logLevel } =
|
|
2925
|
+
const { logLevel } = React14.useContext(LogLevelContext);
|
|
2820
2926
|
if (logLevel === null) {
|
|
2821
2927
|
throw new Error("useLogLevel must be used within a LogLevelProvider");
|
|
2822
2928
|
}
|
|
2823
2929
|
return logLevel;
|
|
2824
2930
|
};
|
|
2825
2931
|
var useMountTime = () => {
|
|
2826
|
-
const { mountTime } =
|
|
2932
|
+
const { mountTime } = React14.useContext(LogLevelContext);
|
|
2827
2933
|
if (mountTime === null) {
|
|
2828
2934
|
throw new Error("useMountTime must be used within a LogLevelProvider");
|
|
2829
2935
|
}
|
|
2830
2936
|
return mountTime;
|
|
2831
2937
|
};
|
|
2832
2938
|
|
|
2833
|
-
// src/random.ts
|
|
2834
|
-
function mulberry32(a) {
|
|
2835
|
-
let t = a + 1831565813;
|
|
2836
|
-
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
2837
|
-
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
2838
|
-
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
2839
|
-
}
|
|
2840
|
-
function hashCode(str) {
|
|
2841
|
-
let i = 0;
|
|
2842
|
-
let chr = 0;
|
|
2843
|
-
let hash = 0;
|
|
2844
|
-
for (i = 0;i < str.length; i++) {
|
|
2845
|
-
chr = str.charCodeAt(i);
|
|
2846
|
-
hash = (hash << 5) - hash + chr;
|
|
2847
|
-
hash |= 0;
|
|
2848
|
-
}
|
|
2849
|
-
return hash;
|
|
2850
|
-
}
|
|
2851
|
-
var random = (seed, dummy) => {
|
|
2852
|
-
if (dummy !== undefined) {
|
|
2853
|
-
throw new TypeError("random() takes only one argument");
|
|
2854
|
-
}
|
|
2855
|
-
if (seed === null) {
|
|
2856
|
-
return Math.random();
|
|
2857
|
-
}
|
|
2858
|
-
if (typeof seed === "string") {
|
|
2859
|
-
return mulberry32(hashCode(seed));
|
|
2860
|
-
}
|
|
2861
|
-
if (typeof seed === "number") {
|
|
2862
|
-
return mulberry32(seed * 10000000000);
|
|
2863
|
-
}
|
|
2864
|
-
throw new Error("random() argument must be a number or a string");
|
|
2865
|
-
};
|
|
2866
|
-
|
|
2867
2939
|
// src/use-amplification.ts
|
|
2868
|
-
import { useContext as
|
|
2940
|
+
import { useContext as useContext17, useLayoutEffect as useLayoutEffect4, useRef as useRef7 } from "react";
|
|
2869
2941
|
|
|
2870
2942
|
// src/audio/shared-audio-tags.tsx
|
|
2871
|
-
import
|
|
2872
|
-
createContext as
|
|
2943
|
+
import React15, {
|
|
2944
|
+
createContext as createContext16,
|
|
2873
2945
|
createRef as createRef2,
|
|
2874
2946
|
useCallback as useCallback7,
|
|
2875
|
-
useContext as
|
|
2947
|
+
useContext as useContext16,
|
|
2876
2948
|
useEffect as useEffect7,
|
|
2877
|
-
useMemo as
|
|
2878
|
-
useRef as
|
|
2879
|
-
useState as
|
|
2949
|
+
useMemo as useMemo15,
|
|
2950
|
+
useRef as useRef5,
|
|
2951
|
+
useState as useState11
|
|
2880
2952
|
} from "react";
|
|
2881
2953
|
|
|
2882
2954
|
// src/play-and-handle-not-allowed-error.ts
|
|
@@ -2964,7 +3036,7 @@ var makeSharedElementSourceNode = ({
|
|
|
2964
3036
|
};
|
|
2965
3037
|
|
|
2966
3038
|
// src/audio/use-audio-context.ts
|
|
2967
|
-
import { useMemo as
|
|
3039
|
+
import { useMemo as useMemo14 } from "react";
|
|
2968
3040
|
var warned = false;
|
|
2969
3041
|
var warnOnce = (logLevel) => {
|
|
2970
3042
|
if (warned) {
|
|
@@ -2976,7 +3048,7 @@ var warnOnce = (logLevel) => {
|
|
|
2976
3048
|
}
|
|
2977
3049
|
};
|
|
2978
3050
|
var useSingletonAudioContext = (logLevel, latencyHint) => {
|
|
2979
|
-
const audioContext =
|
|
3051
|
+
const audioContext = useMemo14(() => {
|
|
2980
3052
|
if (typeof AudioContext === "undefined") {
|
|
2981
3053
|
warnOnce(logLevel);
|
|
2982
3054
|
return null;
|
|
@@ -2989,7 +3061,7 @@ var useSingletonAudioContext = (logLevel, latencyHint) => {
|
|
|
2989
3061
|
};
|
|
2990
3062
|
|
|
2991
3063
|
// src/audio/shared-audio-tags.tsx
|
|
2992
|
-
import { jsx as
|
|
3064
|
+
import { jsx as jsx16, jsxs } from "react/jsx-runtime";
|
|
2993
3065
|
var EMPTY_AUDIO = "data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV";
|
|
2994
3066
|
var compareProps = (obj1, obj2) => {
|
|
2995
3067
|
const keysA = Object.keys(obj1).sort();
|
|
@@ -3016,16 +3088,18 @@ var didPropChange = (key, newProp, prevProp) => {
|
|
|
3016
3088
|
}
|
|
3017
3089
|
return true;
|
|
3018
3090
|
};
|
|
3019
|
-
var SharedAudioContext =
|
|
3020
|
-
var SharedAudioContextProvider = ({ children, numberOfAudioTags,
|
|
3021
|
-
const audios =
|
|
3022
|
-
const [initialNumberOfAudioTags] =
|
|
3091
|
+
var SharedAudioContext = createContext16(null);
|
|
3092
|
+
var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
|
|
3093
|
+
const audios = useRef5([]);
|
|
3094
|
+
const [initialNumberOfAudioTags] = useState11(numberOfAudioTags);
|
|
3023
3095
|
if (numberOfAudioTags !== initialNumberOfAudioTags) {
|
|
3024
3096
|
throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");
|
|
3025
3097
|
}
|
|
3098
|
+
const compositionManager = useContext16(CompositionManager);
|
|
3099
|
+
const component = compositionManager.compositions.find((c) => compositionManager.canvasContent?.type === "composition" ? c.id === compositionManager.canvasContent.compositionId : null);
|
|
3026
3100
|
const logLevel = useLogLevel();
|
|
3027
3101
|
const audioContext = useSingletonAudioContext(logLevel, audioLatencyHint);
|
|
3028
|
-
const refs =
|
|
3102
|
+
const refs = useMemo15(() => {
|
|
3029
3103
|
return new Array(numberOfAudioTags).fill(true).map(() => {
|
|
3030
3104
|
const ref = createRef2();
|
|
3031
3105
|
return {
|
|
@@ -3038,7 +3112,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
3038
3112
|
};
|
|
3039
3113
|
});
|
|
3040
3114
|
}, [audioContext, numberOfAudioTags]);
|
|
3041
|
-
const takenAudios =
|
|
3115
|
+
const takenAudios = useRef5(new Array(numberOfAudioTags).fill(false));
|
|
3042
3116
|
const rerenderAudios = useCallback7(() => {
|
|
3043
3117
|
refs.forEach(({ ref, id }) => {
|
|
3044
3118
|
const data = audios.current?.find((a) => a.id === id);
|
|
@@ -3144,7 +3218,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
3144
3218
|
});
|
|
3145
3219
|
audioContext?.resume();
|
|
3146
3220
|
}, [audioContext, logLevel, mountTime, refs, env.isPlayer]);
|
|
3147
|
-
const value =
|
|
3221
|
+
const value = useMemo15(() => {
|
|
3148
3222
|
return {
|
|
3149
3223
|
registerAudio,
|
|
3150
3224
|
unregisterAudio,
|
|
@@ -3175,7 +3249,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
3175
3249
|
value,
|
|
3176
3250
|
children: [
|
|
3177
3251
|
refs.map(({ id, ref }) => {
|
|
3178
|
-
return /* @__PURE__ */
|
|
3252
|
+
return /* @__PURE__ */ jsx16("audio", {
|
|
3179
3253
|
ref,
|
|
3180
3254
|
preload: "metadata",
|
|
3181
3255
|
src: EMPTY_AUDIO
|
|
@@ -3190,12 +3264,12 @@ var useSharedAudio = ({
|
|
|
3190
3264
|
audioId,
|
|
3191
3265
|
premounting
|
|
3192
3266
|
}) => {
|
|
3193
|
-
const ctx =
|
|
3194
|
-
const [elem] =
|
|
3267
|
+
const ctx = useContext16(SharedAudioContext);
|
|
3268
|
+
const [elem] = useState11(() => {
|
|
3195
3269
|
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
3196
3270
|
return ctx.registerAudio({ aud, audioId, premounting });
|
|
3197
3271
|
}
|
|
3198
|
-
const el =
|
|
3272
|
+
const el = React15.createRef();
|
|
3199
3273
|
const mediaElementSourceNode = ctx?.audioContext ? makeSharedElementSourceNode({
|
|
3200
3274
|
audioContext: ctx.audioContext,
|
|
3201
3275
|
ref: el
|
|
@@ -3209,7 +3283,7 @@ var useSharedAudio = ({
|
|
|
3209
3283
|
premounting
|
|
3210
3284
|
};
|
|
3211
3285
|
});
|
|
3212
|
-
const effectToUse =
|
|
3286
|
+
const effectToUse = React15.useInsertionEffect ?? React15.useLayoutEffect;
|
|
3213
3287
|
if (typeof document !== "undefined") {
|
|
3214
3288
|
effectToUse(() => {
|
|
3215
3289
|
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
@@ -3234,7 +3308,7 @@ var isApproximatelyTheSame = (num1, num2) => {
|
|
|
3234
3308
|
};
|
|
3235
3309
|
|
|
3236
3310
|
// src/video/video-fragment.ts
|
|
3237
|
-
import { useRef as
|
|
3311
|
+
import { useRef as useRef6 } from "react";
|
|
3238
3312
|
var toSeconds = (time, fps) => {
|
|
3239
3313
|
return Math.round(time / fps * 100) / 100;
|
|
3240
3314
|
};
|
|
@@ -3321,9 +3395,9 @@ var useAppendVideoFragment = ({
|
|
|
3321
3395
|
duration: initialDuration,
|
|
3322
3396
|
fps
|
|
3323
3397
|
}) => {
|
|
3324
|
-
const actualFromRef =
|
|
3325
|
-
const actualDuration =
|
|
3326
|
-
const actualSrc =
|
|
3398
|
+
const actualFromRef = useRef6(initialActualFrom);
|
|
3399
|
+
const actualDuration = useRef6(initialDuration);
|
|
3400
|
+
const actualSrc = useRef6(initialActualSrc);
|
|
3327
3401
|
if (!isSubsetOfDuration({
|
|
3328
3402
|
prevStartFrom: actualFromRef.current,
|
|
3329
3403
|
newStartFrom: initialActualFrom,
|
|
@@ -3362,16 +3436,16 @@ var useVolume = ({
|
|
|
3362
3436
|
source,
|
|
3363
3437
|
shouldUseWebAudioApi
|
|
3364
3438
|
}) => {
|
|
3365
|
-
const audioStuffRef =
|
|
3366
|
-
const currentVolumeRef =
|
|
3439
|
+
const audioStuffRef = useRef7(null);
|
|
3440
|
+
const currentVolumeRef = useRef7(volume);
|
|
3367
3441
|
currentVolumeRef.current = volume;
|
|
3368
|
-
const sharedAudioContext =
|
|
3442
|
+
const sharedAudioContext = useContext17(SharedAudioContext);
|
|
3369
3443
|
if (!sharedAudioContext) {
|
|
3370
3444
|
throw new Error("useAmplification must be used within a SharedAudioContext");
|
|
3371
3445
|
}
|
|
3372
3446
|
const { audioContext } = sharedAudioContext;
|
|
3373
3447
|
if (typeof window !== "undefined") {
|
|
3374
|
-
|
|
3448
|
+
useLayoutEffect4(() => {
|
|
3375
3449
|
if (!audioContext) {
|
|
3376
3450
|
return;
|
|
3377
3451
|
}
|
|
@@ -3421,12 +3495,12 @@ var useVolume = ({
|
|
|
3421
3495
|
};
|
|
3422
3496
|
|
|
3423
3497
|
// src/use-media-in-timeline.ts
|
|
3424
|
-
import { useContext as
|
|
3498
|
+
import { useContext as useContext19, useEffect as useEffect8, useMemo as useMemo16, useState as useState12 } from "react";
|
|
3425
3499
|
|
|
3426
3500
|
// src/audio/use-audio-frame.ts
|
|
3427
|
-
import { useContext as
|
|
3501
|
+
import { useContext as useContext18 } from "react";
|
|
3428
3502
|
var useMediaStartsAt = () => {
|
|
3429
|
-
const parentSequence =
|
|
3503
|
+
const parentSequence = useContext18(SequenceContext);
|
|
3430
3504
|
const startsAt = Math.min(0, parentSequence?.relativeFrom ?? 0);
|
|
3431
3505
|
return startsAt;
|
|
3432
3506
|
};
|
|
@@ -3497,9 +3571,9 @@ var useBasicMediaInTimeline = ({
|
|
|
3497
3571
|
throw new Error("No src passed");
|
|
3498
3572
|
}
|
|
3499
3573
|
const startsAt = useMediaStartsAt();
|
|
3500
|
-
const parentSequence =
|
|
3574
|
+
const parentSequence = useContext19(SequenceContext);
|
|
3501
3575
|
const videoConfig = useVideoConfig();
|
|
3502
|
-
const [initialVolume] =
|
|
3576
|
+
const [initialVolume] = useState12(() => volume);
|
|
3503
3577
|
const mediaDuration = calculateMediaDuration({
|
|
3504
3578
|
mediaDurationInFrames: videoConfig.durationInFrames,
|
|
3505
3579
|
playbackRate,
|
|
@@ -3507,7 +3581,7 @@ var useBasicMediaInTimeline = ({
|
|
|
3507
3581
|
trimAfter
|
|
3508
3582
|
});
|
|
3509
3583
|
const duration = parentSequence ? Math.min(parentSequence.durationInFrames, mediaDuration) : mediaDuration;
|
|
3510
|
-
const volumes =
|
|
3584
|
+
const volumes = useMemo16(() => {
|
|
3511
3585
|
if (typeof volume === "number") {
|
|
3512
3586
|
return volume;
|
|
3513
3587
|
}
|
|
@@ -3526,7 +3600,7 @@ var useBasicMediaInTimeline = ({
|
|
|
3526
3600
|
}, [initialVolume, mediaType, src, volume]);
|
|
3527
3601
|
const doesVolumeChange = typeof volume === "function";
|
|
3528
3602
|
const nonce = useNonce();
|
|
3529
|
-
const { rootId } =
|
|
3603
|
+
const { rootId } = useContext19(TimelineContext);
|
|
3530
3604
|
const env = useRemotionEnvironment();
|
|
3531
3605
|
return {
|
|
3532
3606
|
volumes,
|
|
@@ -3552,9 +3626,9 @@ var useMediaInTimeline = ({
|
|
|
3552
3626
|
postmountDisplay,
|
|
3553
3627
|
loopDisplay
|
|
3554
3628
|
}) => {
|
|
3555
|
-
const parentSequence =
|
|
3629
|
+
const parentSequence = useContext19(SequenceContext);
|
|
3556
3630
|
const startsAt = useMediaStartsAt();
|
|
3557
|
-
const { registerSequence, unregisterSequence } =
|
|
3631
|
+
const { registerSequence, unregisterSequence } = useContext19(SequenceManager);
|
|
3558
3632
|
const {
|
|
3559
3633
|
volumes,
|
|
3560
3634
|
duration,
|
|
@@ -3633,34 +3707,34 @@ var useMediaInTimeline = ({
|
|
|
3633
3707
|
// src/use-media-playback.ts
|
|
3634
3708
|
import {
|
|
3635
3709
|
useCallback as useCallback10,
|
|
3636
|
-
useContext as
|
|
3710
|
+
useContext as useContext22,
|
|
3637
3711
|
useEffect as useEffect12,
|
|
3638
|
-
useLayoutEffect as
|
|
3639
|
-
useRef as
|
|
3712
|
+
useLayoutEffect as useLayoutEffect6,
|
|
3713
|
+
useRef as useRef11
|
|
3640
3714
|
} from "react";
|
|
3641
3715
|
|
|
3642
3716
|
// src/buffer-until-first-frame.ts
|
|
3643
|
-
import { useCallback as useCallback9, useMemo as
|
|
3717
|
+
import { useCallback as useCallback9, useMemo as useMemo19, useRef as useRef9 } from "react";
|
|
3644
3718
|
|
|
3645
3719
|
// src/use-buffer-state.ts
|
|
3646
|
-
import { useContext as
|
|
3720
|
+
import { useContext as useContext21, useMemo as useMemo18 } from "react";
|
|
3647
3721
|
|
|
3648
3722
|
// src/buffering.tsx
|
|
3649
|
-
import
|
|
3723
|
+
import React16, {
|
|
3650
3724
|
useCallback as useCallback8,
|
|
3651
|
-
useContext as
|
|
3725
|
+
useContext as useContext20,
|
|
3652
3726
|
useEffect as useEffect9,
|
|
3653
|
-
useLayoutEffect as
|
|
3654
|
-
useMemo as
|
|
3655
|
-
useRef as
|
|
3656
|
-
useState as
|
|
3727
|
+
useLayoutEffect as useLayoutEffect5,
|
|
3728
|
+
useMemo as useMemo17,
|
|
3729
|
+
useRef as useRef8,
|
|
3730
|
+
useState as useState13
|
|
3657
3731
|
} from "react";
|
|
3658
|
-
import { jsx as
|
|
3732
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3659
3733
|
var useBufferManager = (logLevel, mountTime) => {
|
|
3660
|
-
const [blocks, setBlocks] =
|
|
3661
|
-
const [onBufferingCallbacks, setOnBufferingCallbacks] =
|
|
3662
|
-
const [onResumeCallbacks, setOnResumeCallbacks] =
|
|
3663
|
-
const buffering =
|
|
3734
|
+
const [blocks, setBlocks] = useState13([]);
|
|
3735
|
+
const [onBufferingCallbacks, setOnBufferingCallbacks] = useState13([]);
|
|
3736
|
+
const [onResumeCallbacks, setOnResumeCallbacks] = useState13([]);
|
|
3737
|
+
const buffering = useRef8(false);
|
|
3664
3738
|
const addBlock = useCallback8((block) => {
|
|
3665
3739
|
setBlocks((b) => [...b, block]);
|
|
3666
3740
|
return {
|
|
@@ -3703,7 +3777,7 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3703
3777
|
}
|
|
3704
3778
|
}, [blocks]);
|
|
3705
3779
|
if (typeof window !== "undefined") {
|
|
3706
|
-
|
|
3780
|
+
useLayoutEffect5(() => {
|
|
3707
3781
|
if (blocks.length === 0) {
|
|
3708
3782
|
onResumeCallbacks.forEach((c) => c());
|
|
3709
3783
|
playbackLogging({
|
|
@@ -3715,21 +3789,21 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3715
3789
|
}
|
|
3716
3790
|
}, [blocks]);
|
|
3717
3791
|
}
|
|
3718
|
-
return
|
|
3792
|
+
return useMemo17(() => {
|
|
3719
3793
|
return { addBlock, listenForBuffering, listenForResume, buffering };
|
|
3720
3794
|
}, [addBlock, buffering, listenForBuffering, listenForResume]);
|
|
3721
3795
|
};
|
|
3722
|
-
var BufferingContextReact =
|
|
3796
|
+
var BufferingContextReact = React16.createContext(null);
|
|
3723
3797
|
var BufferingProvider = ({ children }) => {
|
|
3724
|
-
const { logLevel, mountTime } =
|
|
3798
|
+
const { logLevel, mountTime } = useContext20(LogLevelContext);
|
|
3725
3799
|
const bufferManager = useBufferManager(logLevel ?? "info", mountTime);
|
|
3726
|
-
return /* @__PURE__ */
|
|
3800
|
+
return /* @__PURE__ */ jsx17(BufferingContextReact.Provider, {
|
|
3727
3801
|
value: bufferManager,
|
|
3728
3802
|
children
|
|
3729
3803
|
});
|
|
3730
3804
|
};
|
|
3731
3805
|
var useIsPlayerBuffering = (bufferManager) => {
|
|
3732
|
-
const [isBuffering, setIsBuffering] =
|
|
3806
|
+
const [isBuffering, setIsBuffering] = useState13(bufferManager.buffering.current);
|
|
3733
3807
|
useEffect9(() => {
|
|
3734
3808
|
const onBuffer = () => {
|
|
3735
3809
|
setIsBuffering(true);
|
|
@@ -3753,9 +3827,9 @@ var useIsPlayerBuffering = (bufferManager) => {
|
|
|
3753
3827
|
|
|
3754
3828
|
// src/use-buffer-state.ts
|
|
3755
3829
|
var useBufferState = () => {
|
|
3756
|
-
const buffer =
|
|
3830
|
+
const buffer = useContext21(BufferingContextReact);
|
|
3757
3831
|
const addBlock = buffer ? buffer.addBlock : null;
|
|
3758
|
-
return
|
|
3832
|
+
return useMemo18(() => ({
|
|
3759
3833
|
delayPlayback: () => {
|
|
3760
3834
|
if (!addBlock) {
|
|
3761
3835
|
throw new Error("Tried to enable the buffering state, but a Remotion context was not found. This API can only be called in a component that was passed to the Remotion Player or a <Composition>. Or you might have experienced a version mismatch - run `npx remotion versions` and ensure all packages have the same version. This error is thrown by the buffer state https://remotion.dev/docs/player/buffer-state");
|
|
@@ -3781,7 +3855,7 @@ var useBufferUntilFirstFrame = ({
|
|
|
3781
3855
|
logLevel,
|
|
3782
3856
|
mountTime
|
|
3783
3857
|
}) => {
|
|
3784
|
-
const bufferingRef =
|
|
3858
|
+
const bufferingRef = useRef9(false);
|
|
3785
3859
|
const { delayPlayback } = useBufferState();
|
|
3786
3860
|
const bufferUntilFirstFrame = useCallback9((requestedTime) => {
|
|
3787
3861
|
if (mediaType !== "video") {
|
|
@@ -3854,7 +3928,7 @@ var useBufferUntilFirstFrame = ({
|
|
|
3854
3928
|
onVariableFpsVideoDetected,
|
|
3855
3929
|
pauseWhenBuffering
|
|
3856
3930
|
]);
|
|
3857
|
-
return
|
|
3931
|
+
return useMemo19(() => {
|
|
3858
3932
|
return {
|
|
3859
3933
|
isBuffering: () => bufferingRef.current,
|
|
3860
3934
|
bufferUntilFirstFrame
|
|
@@ -3863,9 +3937,9 @@ var useBufferUntilFirstFrame = ({
|
|
|
3863
3937
|
};
|
|
3864
3938
|
|
|
3865
3939
|
// src/media-tag-current-time-timestamp.ts
|
|
3866
|
-
import
|
|
3940
|
+
import React17 from "react";
|
|
3867
3941
|
var useCurrentTimeOfMediaTagWithUpdateTimeStamp = (mediaRef) => {
|
|
3868
|
-
const lastUpdate =
|
|
3942
|
+
const lastUpdate = React17.useRef({
|
|
3869
3943
|
time: mediaRef.current?.currentTime ?? 0,
|
|
3870
3944
|
lastUpdate: performance.now()
|
|
3871
3945
|
});
|
|
@@ -3899,7 +3973,7 @@ var seek = ({
|
|
|
3899
3973
|
};
|
|
3900
3974
|
|
|
3901
3975
|
// src/use-media-buffering.ts
|
|
3902
|
-
import { useEffect as useEffect10, useState as
|
|
3976
|
+
import { useEffect as useEffect10, useState as useState14 } from "react";
|
|
3903
3977
|
var useMediaBuffering = ({
|
|
3904
3978
|
element,
|
|
3905
3979
|
shouldBuffer,
|
|
@@ -3910,7 +3984,7 @@ var useMediaBuffering = ({
|
|
|
3910
3984
|
src
|
|
3911
3985
|
}) => {
|
|
3912
3986
|
const buffer = useBufferState();
|
|
3913
|
-
const [isBuffering, setIsBuffering] =
|
|
3987
|
+
const [isBuffering, setIsBuffering] = useState14(false);
|
|
3914
3988
|
useEffect10(() => {
|
|
3915
3989
|
let cleanupFns = [];
|
|
3916
3990
|
const { current } = element;
|
|
@@ -4039,14 +4113,14 @@ var useMediaBuffering = ({
|
|
|
4039
4113
|
};
|
|
4040
4114
|
|
|
4041
4115
|
// src/use-request-video-callback-time.ts
|
|
4042
|
-
import { useEffect as useEffect11, useRef as
|
|
4116
|
+
import { useEffect as useEffect11, useRef as useRef10 } from "react";
|
|
4043
4117
|
var useRequestVideoCallbackTime = ({
|
|
4044
4118
|
mediaRef,
|
|
4045
4119
|
mediaType,
|
|
4046
4120
|
lastSeek,
|
|
4047
4121
|
onVariableFpsVideoDetected
|
|
4048
4122
|
}) => {
|
|
4049
|
-
const currentTime =
|
|
4123
|
+
const currentTime = useRef10(null);
|
|
4050
4124
|
useEffect11(() => {
|
|
4051
4125
|
const { current } = mediaRef;
|
|
4052
4126
|
if (current) {
|
|
@@ -4275,21 +4349,21 @@ var useMediaPlayback = ({
|
|
|
4275
4349
|
isPostmounting,
|
|
4276
4350
|
onAutoPlayError
|
|
4277
4351
|
}) => {
|
|
4278
|
-
const { playbackRate: globalPlaybackRate } =
|
|
4352
|
+
const { playbackRate: globalPlaybackRate } = useContext22(TimelineContext);
|
|
4279
4353
|
const frame = useCurrentFrame();
|
|
4280
4354
|
const absoluteFrame = useTimelinePosition();
|
|
4281
4355
|
const [playing] = usePlayingState();
|
|
4282
|
-
const buffering =
|
|
4356
|
+
const buffering = useContext22(BufferingContextReact);
|
|
4283
4357
|
const { fps } = useVideoConfig();
|
|
4284
4358
|
const mediaStartsAt = useMediaStartsAt();
|
|
4285
|
-
const lastSeekDueToShift =
|
|
4286
|
-
const lastSeek =
|
|
4359
|
+
const lastSeekDueToShift = useRef11(null);
|
|
4360
|
+
const lastSeek = useRef11(null);
|
|
4287
4361
|
const logLevel = useLogLevel();
|
|
4288
4362
|
const mountTime = useMountTime();
|
|
4289
4363
|
if (!buffering) {
|
|
4290
4364
|
throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
|
|
4291
4365
|
}
|
|
4292
|
-
const isVariableFpsVideoMap =
|
|
4366
|
+
const isVariableFpsVideoMap = useRef11({});
|
|
4293
4367
|
const onVariableFpsVideoDetected = useCallback10(() => {
|
|
4294
4368
|
if (!src) {
|
|
4295
4369
|
return;
|
|
@@ -4380,7 +4454,7 @@ var useMediaPlayback = ({
|
|
|
4380
4454
|
isPostmounting
|
|
4381
4455
|
]);
|
|
4382
4456
|
const env = useRemotionEnvironment();
|
|
4383
|
-
|
|
4457
|
+
useLayoutEffect6(() => {
|
|
4384
4458
|
const playbackRateToSet = Math.max(0, playbackRate);
|
|
4385
4459
|
if (mediaRef.current && mediaRef.current.playbackRate !== playbackRateToSet) {
|
|
4386
4460
|
mediaRef.current.playbackRate = playbackRateToSet;
|
|
@@ -4505,7 +4579,7 @@ var useMediaPlayback = ({
|
|
|
4505
4579
|
};
|
|
4506
4580
|
|
|
4507
4581
|
// src/use-media-tag.ts
|
|
4508
|
-
import { useContext as
|
|
4582
|
+
import { useContext as useContext23, useEffect as useEffect13 } from "react";
|
|
4509
4583
|
var useMediaTag = ({
|
|
4510
4584
|
mediaRef,
|
|
4511
4585
|
id,
|
|
@@ -4514,7 +4588,7 @@ var useMediaTag = ({
|
|
|
4514
4588
|
isPremounting,
|
|
4515
4589
|
isPostmounting
|
|
4516
4590
|
}) => {
|
|
4517
|
-
const { audioAndVideoTags, imperativePlaying } =
|
|
4591
|
+
const { audioAndVideoTags, imperativePlaying } = useContext23(TimelineContext);
|
|
4518
4592
|
const logLevel = useLogLevel();
|
|
4519
4593
|
const mountTime = useMountTime();
|
|
4520
4594
|
const env = useRemotionEnvironment();
|
|
@@ -4559,12 +4633,12 @@ var useMediaTag = ({
|
|
|
4559
4633
|
};
|
|
4560
4634
|
|
|
4561
4635
|
// src/volume-position-state.ts
|
|
4562
|
-
import { createContext as
|
|
4563
|
-
var MediaVolumeContext =
|
|
4636
|
+
import { createContext as createContext17, useContext as useContext24, useMemo as useMemo20 } from "react";
|
|
4637
|
+
var MediaVolumeContext = createContext17({
|
|
4564
4638
|
mediaMuted: false,
|
|
4565
4639
|
mediaVolume: 1
|
|
4566
4640
|
});
|
|
4567
|
-
var SetMediaVolumeContext =
|
|
4641
|
+
var SetMediaVolumeContext = createContext17({
|
|
4568
4642
|
setMediaMuted: () => {
|
|
4569
4643
|
throw new Error("default");
|
|
4570
4644
|
},
|
|
@@ -4573,16 +4647,16 @@ var SetMediaVolumeContext = createContext16({
|
|
|
4573
4647
|
}
|
|
4574
4648
|
});
|
|
4575
4649
|
var useMediaVolumeState = () => {
|
|
4576
|
-
const { mediaVolume } =
|
|
4577
|
-
const { setMediaVolume } =
|
|
4578
|
-
return
|
|
4650
|
+
const { mediaVolume } = useContext24(MediaVolumeContext);
|
|
4651
|
+
const { setMediaVolume } = useContext24(SetMediaVolumeContext);
|
|
4652
|
+
return useMemo20(() => {
|
|
4579
4653
|
return [mediaVolume, setMediaVolume];
|
|
4580
4654
|
}, [mediaVolume, setMediaVolume]);
|
|
4581
4655
|
};
|
|
4582
4656
|
var useMediaMutedState = () => {
|
|
4583
|
-
const { mediaMuted } =
|
|
4584
|
-
const { setMediaMuted } =
|
|
4585
|
-
return
|
|
4657
|
+
const { mediaMuted } = useContext24(MediaVolumeContext);
|
|
4658
|
+
const { setMediaMuted } = useContext24(SetMediaVolumeContext);
|
|
4659
|
+
return useMemo20(() => {
|
|
4586
4660
|
return [mediaMuted, setMediaMuted];
|
|
4587
4661
|
}, [mediaMuted, setMediaMuted]);
|
|
4588
4662
|
};
|
|
@@ -4595,9 +4669,9 @@ var warnAboutTooHighVolume = (volume) => {
|
|
|
4595
4669
|
};
|
|
4596
4670
|
|
|
4597
4671
|
// src/audio/AudioForPreview.tsx
|
|
4598
|
-
import { jsx as
|
|
4672
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
4599
4673
|
var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
4600
|
-
const [initialShouldPreMountAudioElements] =
|
|
4674
|
+
const [initialShouldPreMountAudioElements] = useState15(props.shouldPreMountAudioTags);
|
|
4601
4675
|
if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
|
|
4602
4676
|
throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");
|
|
4603
4677
|
}
|
|
@@ -4636,13 +4710,13 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4636
4710
|
const [mediaVolume] = useMediaVolumeState();
|
|
4637
4711
|
const [mediaMuted] = useMediaMutedState();
|
|
4638
4712
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
4639
|
-
const { hidden } =
|
|
4713
|
+
const { hidden } = useContext25(SequenceVisibilityToggleContext);
|
|
4640
4714
|
if (!src) {
|
|
4641
4715
|
throw new TypeError("No 'src' was passed to <Html5Audio>.");
|
|
4642
4716
|
}
|
|
4643
4717
|
const preloadedSrc = usePreload(src);
|
|
4644
|
-
const sequenceContext =
|
|
4645
|
-
const [timelineId] =
|
|
4718
|
+
const sequenceContext = useContext25(SequenceContext);
|
|
4719
|
+
const [timelineId] = useState15(() => String(Math.random()));
|
|
4646
4720
|
const isSequenceHidden = hidden[timelineId] ?? false;
|
|
4647
4721
|
const userPreferredVolume = evaluateVolume({
|
|
4648
4722
|
frame: volumePropFrame,
|
|
@@ -4654,7 +4728,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4654
4728
|
crossOrigin,
|
|
4655
4729
|
requestsVideoFrame: false
|
|
4656
4730
|
});
|
|
4657
|
-
const propsToPass =
|
|
4731
|
+
const propsToPass = useMemo21(() => {
|
|
4658
4732
|
return {
|
|
4659
4733
|
muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
|
|
4660
4734
|
src: preloadedSrc,
|
|
@@ -4672,7 +4746,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4672
4746
|
userPreferredVolume,
|
|
4673
4747
|
crossOriginValue
|
|
4674
4748
|
]);
|
|
4675
|
-
const id =
|
|
4749
|
+
const id = useMemo21(() => `audio-${random(src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
|
|
4676
4750
|
src,
|
|
4677
4751
|
sequenceContext?.relativeFrom,
|
|
4678
4752
|
sequenceContext?.cumulatedFrom,
|
|
@@ -4680,7 +4754,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4680
4754
|
props.muted,
|
|
4681
4755
|
props.loop
|
|
4682
4756
|
]);
|
|
4683
|
-
const context =
|
|
4757
|
+
const context = useContext25(SharedAudioContext);
|
|
4684
4758
|
if (!context) {
|
|
4685
4759
|
throw new Error("SharedAudioContext not found");
|
|
4686
4760
|
}
|
|
@@ -4733,7 +4807,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4733
4807
|
useImperativeHandle5(ref, () => {
|
|
4734
4808
|
return audioRef.current;
|
|
4735
4809
|
}, [audioRef]);
|
|
4736
|
-
const currentOnDurationCallback =
|
|
4810
|
+
const currentOnDurationCallback = useRef12(onDuration);
|
|
4737
4811
|
currentOnDurationCallback.current = onDuration;
|
|
4738
4812
|
useEffect14(() => {
|
|
4739
4813
|
const { current } = audioRef;
|
|
@@ -4755,7 +4829,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4755
4829
|
if (initialShouldPreMountAudioElements) {
|
|
4756
4830
|
return null;
|
|
4757
4831
|
}
|
|
4758
|
-
return /* @__PURE__ */
|
|
4832
|
+
return /* @__PURE__ */ jsx18("audio", {
|
|
4759
4833
|
ref: audioRef,
|
|
4760
4834
|
preload: "metadata",
|
|
4761
4835
|
crossOrigin: crossOriginValue,
|
|
@@ -4767,16 +4841,16 @@ var AudioForPreview = forwardRef4(AudioForDevelopmentForwardRefFunction);
|
|
|
4767
4841
|
// src/audio/AudioForRendering.tsx
|
|
4768
4842
|
import {
|
|
4769
4843
|
forwardRef as forwardRef5,
|
|
4770
|
-
useContext as
|
|
4844
|
+
useContext as useContext26,
|
|
4771
4845
|
useEffect as useEffect15,
|
|
4772
4846
|
useImperativeHandle as useImperativeHandle6,
|
|
4773
|
-
useLayoutEffect as
|
|
4774
|
-
useMemo as
|
|
4775
|
-
useRef as
|
|
4847
|
+
useLayoutEffect as useLayoutEffect7,
|
|
4848
|
+
useMemo as useMemo22,
|
|
4849
|
+
useRef as useRef13
|
|
4776
4850
|
} from "react";
|
|
4777
|
-
import { jsx as
|
|
4851
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
4778
4852
|
var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
4779
|
-
const audioRef =
|
|
4853
|
+
const audioRef = useRef13(null);
|
|
4780
4854
|
const {
|
|
4781
4855
|
volume: volumeProp,
|
|
4782
4856
|
playbackRate,
|
|
@@ -4798,10 +4872,10 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4798
4872
|
const absoluteFrame = useTimelinePosition();
|
|
4799
4873
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
4800
4874
|
const frame = useCurrentFrame();
|
|
4801
|
-
const sequenceContext =
|
|
4802
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
4875
|
+
const sequenceContext = useContext26(SequenceContext);
|
|
4876
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext26(RenderAssetManager);
|
|
4803
4877
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
4804
|
-
const id =
|
|
4878
|
+
const id = useMemo22(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
|
|
4805
4879
|
props.src,
|
|
4806
4880
|
sequenceContext?.relativeFrom,
|
|
4807
4881
|
sequenceContext?.cumulatedFrom,
|
|
@@ -4860,7 +4934,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4860
4934
|
]);
|
|
4861
4935
|
const { src } = props;
|
|
4862
4936
|
const needsToRenderAudioTag = ref || _remotionInternalNeedsDurationCalculation;
|
|
4863
|
-
|
|
4937
|
+
useLayoutEffect7(() => {
|
|
4864
4938
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
4865
4939
|
return;
|
|
4866
4940
|
}
|
|
@@ -4900,7 +4974,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4900
4974
|
if (!needsToRenderAudioTag) {
|
|
4901
4975
|
return null;
|
|
4902
4976
|
}
|
|
4903
|
-
return /* @__PURE__ */
|
|
4977
|
+
return /* @__PURE__ */ jsx19("audio", {
|
|
4904
4978
|
ref: audioRef,
|
|
4905
4979
|
...nativeProps,
|
|
4906
4980
|
onError: onNativeError
|
|
@@ -4909,9 +4983,9 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4909
4983
|
var AudioForRendering = forwardRef5(AudioForRenderingRefForwardingFunction);
|
|
4910
4984
|
|
|
4911
4985
|
// src/audio/Audio.tsx
|
|
4912
|
-
import { jsx as
|
|
4986
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4913
4987
|
var AudioRefForwardingFunction = (props, ref) => {
|
|
4914
|
-
const audioContext =
|
|
4988
|
+
const audioContext = useContext27(SharedAudioContext);
|
|
4915
4989
|
const {
|
|
4916
4990
|
startFrom,
|
|
4917
4991
|
endAt,
|
|
@@ -4927,7 +5001,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4927
5001
|
const { loop, ...propsOtherThanLoop } = props;
|
|
4928
5002
|
const { fps } = useVideoConfig();
|
|
4929
5003
|
const environment = useRemotionEnvironment();
|
|
4930
|
-
const { durations, setDurations } =
|
|
5004
|
+
const { durations, setDurations } = useContext27(DurationsContext);
|
|
4931
5005
|
if (typeof props.src !== "string") {
|
|
4932
5006
|
throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
4933
5007
|
}
|
|
@@ -4959,14 +5033,14 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4959
5033
|
});
|
|
4960
5034
|
if (loop && durationFetched !== undefined) {
|
|
4961
5035
|
if (!Number.isFinite(durationFetched)) {
|
|
4962
|
-
return /* @__PURE__ */
|
|
5036
|
+
return /* @__PURE__ */ jsx20(Html5Audio, {
|
|
4963
5037
|
...propsOtherThanLoop,
|
|
4964
5038
|
ref,
|
|
4965
5039
|
_remotionInternalNativeLoopPassed: true
|
|
4966
5040
|
});
|
|
4967
5041
|
}
|
|
4968
5042
|
const duration = durationFetched * fps;
|
|
4969
|
-
return /* @__PURE__ */
|
|
5043
|
+
return /* @__PURE__ */ jsx20(Loop, {
|
|
4970
5044
|
layout: "none",
|
|
4971
5045
|
durationInFrames: calculateMediaDuration({
|
|
4972
5046
|
trimAfter: trimAfterValue,
|
|
@@ -4974,7 +5048,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4974
5048
|
playbackRate: props.playbackRate ?? 1,
|
|
4975
5049
|
trimBefore: trimBeforeValue
|
|
4976
5050
|
}),
|
|
4977
|
-
children: /* @__PURE__ */
|
|
5051
|
+
children: /* @__PURE__ */ jsx20(Html5Audio, {
|
|
4978
5052
|
...propsOtherThanLoop,
|
|
4979
5053
|
ref,
|
|
4980
5054
|
_remotionInternalNativeLoopPassed: true
|
|
@@ -4982,13 +5056,13 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4982
5056
|
});
|
|
4983
5057
|
}
|
|
4984
5058
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
4985
|
-
return /* @__PURE__ */
|
|
5059
|
+
return /* @__PURE__ */ jsx20(Sequence, {
|
|
4986
5060
|
layout: "none",
|
|
4987
5061
|
from: 0 - (trimBeforeValue ?? 0),
|
|
4988
5062
|
showInTimeline: false,
|
|
4989
5063
|
durationInFrames: trimAfterValue,
|
|
4990
5064
|
name,
|
|
4991
|
-
children: /* @__PURE__ */
|
|
5065
|
+
children: /* @__PURE__ */ jsx20(Html5Audio, {
|
|
4992
5066
|
_remotionInternalNeedsDurationCalculation: Boolean(loop),
|
|
4993
5067
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
4994
5068
|
...otherProps,
|
|
@@ -4998,7 +5072,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4998
5072
|
}
|
|
4999
5073
|
validateMediaProps({ playbackRate: props.playbackRate, volume: props.volume }, "Html5Audio");
|
|
5000
5074
|
if (environment.isRendering) {
|
|
5001
|
-
return /* @__PURE__ */
|
|
5075
|
+
return /* @__PURE__ */ jsx20(AudioForRendering, {
|
|
5002
5076
|
onDuration,
|
|
5003
5077
|
...props,
|
|
5004
5078
|
ref,
|
|
@@ -5006,7 +5080,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5006
5080
|
_remotionInternalNeedsDurationCalculation: Boolean(loop)
|
|
5007
5081
|
});
|
|
5008
5082
|
}
|
|
5009
|
-
return /* @__PURE__ */
|
|
5083
|
+
return /* @__PURE__ */ jsx20(AudioForPreview, {
|
|
5010
5084
|
_remotionInternalNativeLoopPassed: props._remotionInternalNativeLoopPassed ?? false,
|
|
5011
5085
|
_remotionInternalStack: stack ?? null,
|
|
5012
5086
|
shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0,
|
|
@@ -5023,11 +5097,11 @@ var Html5Audio = forwardRef6(AudioRefForwardingFunction);
|
|
|
5023
5097
|
addSequenceStackTraces(Html5Audio);
|
|
5024
5098
|
var Audio = Html5Audio;
|
|
5025
5099
|
// src/Composition.tsx
|
|
5026
|
-
import { Suspense, useContext as
|
|
5100
|
+
import { Suspense, useContext as useContext29, useEffect as useEffect17 } from "react";
|
|
5027
5101
|
import { createPortal } from "react-dom";
|
|
5028
5102
|
|
|
5029
5103
|
// src/Folder.tsx
|
|
5030
|
-
import { createContext as
|
|
5104
|
+
import { createContext as createContext18, useContext as useContext28, useEffect as useEffect16, useMemo as useMemo23 } from "react";
|
|
5031
5105
|
|
|
5032
5106
|
// src/validation/validate-folder-name.ts
|
|
5033
5107
|
var getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
|
|
@@ -5046,18 +5120,18 @@ var validateFolderName = (name) => {
|
|
|
5046
5120
|
var invalidFolderNameErrorMessage = `Folder name must match ${String(getRegex())}`;
|
|
5047
5121
|
|
|
5048
5122
|
// src/Folder.tsx
|
|
5049
|
-
import { jsx as
|
|
5050
|
-
var FolderContext =
|
|
5123
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
5124
|
+
var FolderContext = createContext18({
|
|
5051
5125
|
folderName: null,
|
|
5052
5126
|
parentName: null
|
|
5053
5127
|
});
|
|
5054
5128
|
var Folder = ({ name, children }) => {
|
|
5055
|
-
const parent =
|
|
5056
|
-
const { registerFolder, unregisterFolder } =
|
|
5129
|
+
const parent = useContext28(FolderContext);
|
|
5130
|
+
const { registerFolder, unregisterFolder } = useContext28(CompositionSetters);
|
|
5057
5131
|
validateFolderName(name);
|
|
5058
5132
|
const parentNameArr = [parent.parentName, parent.folderName].filter(truthy);
|
|
5059
5133
|
const parentName = parentNameArr.length === 0 ? null : parentNameArr.join("/");
|
|
5060
|
-
const value =
|
|
5134
|
+
const value = useMemo23(() => {
|
|
5061
5135
|
return {
|
|
5062
5136
|
folderName: name,
|
|
5063
5137
|
parentName
|
|
@@ -5069,14 +5143,14 @@ var Folder = ({ name, children }) => {
|
|
|
5069
5143
|
unregisterFolder(name, parentName);
|
|
5070
5144
|
};
|
|
5071
5145
|
}, [name, parent.folderName, parentName, registerFolder, unregisterFolder]);
|
|
5072
|
-
return /* @__PURE__ */
|
|
5146
|
+
return /* @__PURE__ */ jsx21(FolderContext.Provider, {
|
|
5073
5147
|
value,
|
|
5074
5148
|
children
|
|
5075
5149
|
});
|
|
5076
5150
|
};
|
|
5077
5151
|
|
|
5078
5152
|
// src/loading-indicator.tsx
|
|
5079
|
-
import { jsx as
|
|
5153
|
+
import { jsx as jsx22, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5080
5154
|
var rotate = {
|
|
5081
5155
|
transform: `rotate(90deg)`
|
|
5082
5156
|
};
|
|
@@ -5095,7 +5169,7 @@ var Loading = () => {
|
|
|
5095
5169
|
style: container,
|
|
5096
5170
|
id: "remotion-comp-loading",
|
|
5097
5171
|
children: [
|
|
5098
|
-
/* @__PURE__ */
|
|
5172
|
+
/* @__PURE__ */ jsx22("style", {
|
|
5099
5173
|
type: "text/css",
|
|
5100
5174
|
children: `
|
|
5101
5175
|
@keyframes anim {
|
|
@@ -5112,12 +5186,12 @@ var Loading = () => {
|
|
|
5112
5186
|
}
|
|
5113
5187
|
`
|
|
5114
5188
|
}),
|
|
5115
|
-
/* @__PURE__ */
|
|
5189
|
+
/* @__PURE__ */ jsx22("svg", {
|
|
5116
5190
|
width: ICON_SIZE,
|
|
5117
5191
|
height: ICON_SIZE,
|
|
5118
5192
|
viewBox: "-100 -100 400 400",
|
|
5119
5193
|
style: rotate,
|
|
5120
|
-
children: /* @__PURE__ */
|
|
5194
|
+
children: /* @__PURE__ */ jsx22("path", {
|
|
5121
5195
|
fill: "#555",
|
|
5122
5196
|
stroke: "#555",
|
|
5123
5197
|
strokeWidth: "100",
|
|
@@ -5164,13 +5238,13 @@ var portalNode = () => {
|
|
|
5164
5238
|
};
|
|
5165
5239
|
|
|
5166
5240
|
// src/use-lazy-component.ts
|
|
5167
|
-
import
|
|
5241
|
+
import React21, { useMemo as useMemo24 } from "react";
|
|
5168
5242
|
var useLazyComponent = ({
|
|
5169
5243
|
compProps,
|
|
5170
5244
|
componentName,
|
|
5171
5245
|
noSuspense
|
|
5172
5246
|
}) => {
|
|
5173
|
-
const lazy =
|
|
5247
|
+
const lazy = useMemo24(() => {
|
|
5174
5248
|
if ("component" in compProps) {
|
|
5175
5249
|
if (typeof document === "undefined" || noSuspense) {
|
|
5176
5250
|
return compProps.component;
|
|
@@ -5184,7 +5258,7 @@ var useLazyComponent = ({
|
|
|
5184
5258
|
if (typeof compProps.lazyComponent === "undefined") {
|
|
5185
5259
|
throw new Error(`A value of \`undefined\` was passed to the \`lazyComponent\` prop. Check the value you are passing to the <${componentName}/> component.`);
|
|
5186
5260
|
}
|
|
5187
|
-
return
|
|
5261
|
+
return React21.lazy(compProps.lazyComponent);
|
|
5188
5262
|
}
|
|
5189
5263
|
throw new Error("You must pass either 'component' or 'lazyComponent'");
|
|
5190
5264
|
}, [compProps.component, compProps.lazyComponent]);
|
|
@@ -5215,7 +5289,7 @@ var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
|
5215
5289
|
};
|
|
5216
5290
|
|
|
5217
5291
|
// src/Composition.tsx
|
|
5218
|
-
import { jsx as
|
|
5292
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5219
5293
|
var Fallback = () => {
|
|
5220
5294
|
const { continueRender: continueRender2, delayRender: delayRender2 } = useDelayRender();
|
|
5221
5295
|
useEffect17(() => {
|
|
@@ -5234,7 +5308,7 @@ var InnerComposition = ({
|
|
|
5234
5308
|
schema,
|
|
5235
5309
|
...compProps
|
|
5236
5310
|
}) => {
|
|
5237
|
-
const compManager =
|
|
5311
|
+
const compManager = useContext29(CompositionSetters);
|
|
5238
5312
|
const { registerComposition, unregisterComposition } = compManager;
|
|
5239
5313
|
const video = useVideo();
|
|
5240
5314
|
const lazy = useLazyComponent({
|
|
@@ -5245,7 +5319,7 @@ var InnerComposition = ({
|
|
|
5245
5319
|
const nonce = useNonce();
|
|
5246
5320
|
const isPlayer = useIsPlayer();
|
|
5247
5321
|
const environment = useRemotionEnvironment();
|
|
5248
|
-
const canUseComposition =
|
|
5322
|
+
const canUseComposition = useContext29(CanUseRemotionHooks);
|
|
5249
5323
|
if (typeof window !== "undefined") {
|
|
5250
5324
|
window.remotion_seenCompositionIds = Array.from(new Set([...window.remotion_seenCompositionIds ?? [], id]));
|
|
5251
5325
|
}
|
|
@@ -5255,7 +5329,7 @@ var InnerComposition = ({
|
|
|
5255
5329
|
}
|
|
5256
5330
|
throw new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");
|
|
5257
5331
|
}
|
|
5258
|
-
const { folderName, parentName } =
|
|
5332
|
+
const { folderName, parentName } = useContext29(FolderContext);
|
|
5259
5333
|
useEffect17(() => {
|
|
5260
5334
|
if (!id) {
|
|
5261
5335
|
throw new Error("No id for composition passed.");
|
|
@@ -5308,10 +5382,10 @@ var InnerComposition = ({
|
|
|
5308
5382
|
if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
|
|
5309
5383
|
return null;
|
|
5310
5384
|
}
|
|
5311
|
-
return createPortal(/* @__PURE__ */
|
|
5312
|
-
children: /* @__PURE__ */
|
|
5313
|
-
fallback: /* @__PURE__ */
|
|
5314
|
-
children: /* @__PURE__ */
|
|
5385
|
+
return createPortal(/* @__PURE__ */ jsx23(CanUseRemotionHooksProvider, {
|
|
5386
|
+
children: /* @__PURE__ */ jsx23(Suspense, {
|
|
5387
|
+
fallback: /* @__PURE__ */ jsx23(Loading, {}),
|
|
5388
|
+
children: /* @__PURE__ */ jsx23(Comp, {
|
|
5315
5389
|
...resolved.result.props ?? {}
|
|
5316
5390
|
})
|
|
5317
5391
|
})
|
|
@@ -5322,10 +5396,10 @@ var InnerComposition = ({
|
|
|
5322
5396
|
if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
|
|
5323
5397
|
return null;
|
|
5324
5398
|
}
|
|
5325
|
-
return createPortal(/* @__PURE__ */
|
|
5326
|
-
children: /* @__PURE__ */
|
|
5327
|
-
fallback: /* @__PURE__ */
|
|
5328
|
-
children: /* @__PURE__ */
|
|
5399
|
+
return createPortal(/* @__PURE__ */ jsx23(CanUseRemotionHooksProvider, {
|
|
5400
|
+
children: /* @__PURE__ */ jsx23(Suspense, {
|
|
5401
|
+
fallback: /* @__PURE__ */ jsx23(Fallback, {}),
|
|
5402
|
+
children: /* @__PURE__ */ jsx23(Comp, {
|
|
5329
5403
|
...resolved.result.props ?? {}
|
|
5330
5404
|
})
|
|
5331
5405
|
})
|
|
@@ -5334,11 +5408,11 @@ var InnerComposition = ({
|
|
|
5334
5408
|
return null;
|
|
5335
5409
|
};
|
|
5336
5410
|
var Composition = (props2) => {
|
|
5337
|
-
const { onlyRenderComposition } =
|
|
5411
|
+
const { onlyRenderComposition } = useContext29(CompositionSetters);
|
|
5338
5412
|
if (onlyRenderComposition && onlyRenderComposition !== props2.id) {
|
|
5339
5413
|
return null;
|
|
5340
5414
|
}
|
|
5341
|
-
return /* @__PURE__ */
|
|
5415
|
+
return /* @__PURE__ */ jsx23(InnerComposition, {
|
|
5342
5416
|
...props2
|
|
5343
5417
|
});
|
|
5344
5418
|
};
|
|
@@ -5556,8 +5630,8 @@ var getStaticFiles = () => {
|
|
|
5556
5630
|
return window.remotion_staticFiles;
|
|
5557
5631
|
};
|
|
5558
5632
|
// src/IFrame.tsx
|
|
5559
|
-
import { forwardRef as forwardRef7, useCallback as useCallback12, useState as
|
|
5560
|
-
import { jsx as
|
|
5633
|
+
import { forwardRef as forwardRef7, useCallback as useCallback12, useState as useState16 } from "react";
|
|
5634
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5561
5635
|
var IFrameRefForwarding = ({
|
|
5562
5636
|
onLoad,
|
|
5563
5637
|
onError,
|
|
@@ -5566,7 +5640,7 @@ var IFrameRefForwarding = ({
|
|
|
5566
5640
|
...props2
|
|
5567
5641
|
}, ref) => {
|
|
5568
5642
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
5569
|
-
const [handle] =
|
|
5643
|
+
const [handle] = useState16(() => delayRender2(`Loading <IFrame> with source ${props2.src}`, {
|
|
5570
5644
|
retries: delayRenderRetries ?? undefined,
|
|
5571
5645
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
5572
5646
|
}));
|
|
@@ -5582,7 +5656,7 @@ var IFrameRefForwarding = ({
|
|
|
5582
5656
|
console.error("Error loading iframe:", e, "Handle the event using the onError() prop to make this message disappear.");
|
|
5583
5657
|
}
|
|
5584
5658
|
}, [handle, onError, continueRender2]);
|
|
5585
|
-
return /* @__PURE__ */
|
|
5659
|
+
return /* @__PURE__ */ jsx24("iframe", {
|
|
5586
5660
|
referrerPolicy: "strict-origin-when-cross-origin",
|
|
5587
5661
|
...props2,
|
|
5588
5662
|
ref,
|
|
@@ -5595,12 +5669,12 @@ var IFrame = forwardRef7(IFrameRefForwarding);
|
|
|
5595
5669
|
import {
|
|
5596
5670
|
forwardRef as forwardRef8,
|
|
5597
5671
|
useCallback as useCallback13,
|
|
5598
|
-
useContext as
|
|
5672
|
+
useContext as useContext30,
|
|
5599
5673
|
useImperativeHandle as useImperativeHandle7,
|
|
5600
|
-
useLayoutEffect as
|
|
5601
|
-
useRef as
|
|
5674
|
+
useLayoutEffect as useLayoutEffect8,
|
|
5675
|
+
useRef as useRef14
|
|
5602
5676
|
} from "react";
|
|
5603
|
-
import { jsx as
|
|
5677
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
5604
5678
|
function exponentialBackoff(errorCount) {
|
|
5605
5679
|
return 1000 * 2 ** (errorCount - 1);
|
|
5606
5680
|
}
|
|
@@ -5615,10 +5689,10 @@ var ImgRefForwarding = ({
|
|
|
5615
5689
|
crossOrigin,
|
|
5616
5690
|
...props2
|
|
5617
5691
|
}, ref) => {
|
|
5618
|
-
const imageRef =
|
|
5619
|
-
const errors =
|
|
5692
|
+
const imageRef = useRef14(null);
|
|
5693
|
+
const errors = useRef14({});
|
|
5620
5694
|
const { delayPlayback } = useBufferState();
|
|
5621
|
-
const sequenceContext =
|
|
5695
|
+
const sequenceContext = useContext30(SequenceContext);
|
|
5622
5696
|
if (!src) {
|
|
5623
5697
|
throw new Error('No "src" prop was passed to <Img>.');
|
|
5624
5698
|
}
|
|
@@ -5668,7 +5742,7 @@ var ImgRefForwarding = ({
|
|
|
5668
5742
|
if (typeof window !== "undefined") {
|
|
5669
5743
|
const isPremounting = Boolean(sequenceContext?.premounting);
|
|
5670
5744
|
const isPostmounting = Boolean(sequenceContext?.postmounting);
|
|
5671
|
-
|
|
5745
|
+
useLayoutEffect8(() => {
|
|
5672
5746
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
5673
5747
|
if (imageRef.current) {
|
|
5674
5748
|
imageRef.current.src = actualSrc;
|
|
@@ -5738,7 +5812,7 @@ var ImgRefForwarding = ({
|
|
|
5738
5812
|
crossOrigin,
|
|
5739
5813
|
requestsVideoFrame: false
|
|
5740
5814
|
});
|
|
5741
|
-
return /* @__PURE__ */
|
|
5815
|
+
return /* @__PURE__ */ jsx25("img", {
|
|
5742
5816
|
...props2,
|
|
5743
5817
|
ref: imageRef,
|
|
5744
5818
|
crossOrigin: crossOriginValue,
|
|
@@ -5751,26 +5825,29 @@ var Img = forwardRef8(ImgRefForwarding);
|
|
|
5751
5825
|
import { createRef as createRef3 } from "react";
|
|
5752
5826
|
|
|
5753
5827
|
// src/CompositionManager.tsx
|
|
5754
|
-
import
|
|
5828
|
+
import React25 from "react";
|
|
5829
|
+
var compositionsRef = React25.createRef();
|
|
5830
|
+
|
|
5831
|
+
// src/CompositionManagerProvider.tsx
|
|
5832
|
+
import {
|
|
5755
5833
|
useCallback as useCallback14,
|
|
5756
5834
|
useImperativeHandle as useImperativeHandle8,
|
|
5757
|
-
useMemo as
|
|
5758
|
-
useRef as
|
|
5759
|
-
useState as
|
|
5835
|
+
useMemo as useMemo25,
|
|
5836
|
+
useRef as useRef15,
|
|
5837
|
+
useState as useState17
|
|
5760
5838
|
} from "react";
|
|
5761
|
-
import { jsx as
|
|
5762
|
-
var compositionsRef = React24.createRef();
|
|
5839
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
5763
5840
|
var CompositionManagerProvider = ({
|
|
5764
5841
|
children,
|
|
5765
|
-
numberOfAudioTags,
|
|
5766
5842
|
onlyRenderComposition,
|
|
5767
5843
|
currentCompositionMetadata,
|
|
5768
|
-
|
|
5844
|
+
initialCompositions,
|
|
5845
|
+
initialCanvasContent
|
|
5769
5846
|
}) => {
|
|
5770
|
-
const [
|
|
5771
|
-
const
|
|
5772
|
-
const [
|
|
5773
|
-
const
|
|
5847
|
+
const [folders, setFolders] = useState17([]);
|
|
5848
|
+
const [canvasContent, setCanvasContent] = useState17(initialCanvasContent);
|
|
5849
|
+
const [compositions, setCompositions] = useState17(initialCompositions);
|
|
5850
|
+
const currentcompositionsRef = useRef15(compositions);
|
|
5774
5851
|
const updateCompositions = useCallback14((updateComps) => {
|
|
5775
5852
|
setCompositions((comps) => {
|
|
5776
5853
|
const updated = updateComps(comps);
|
|
@@ -5813,7 +5890,6 @@ var CompositionManagerProvider = ({
|
|
|
5813
5890
|
getCompositions: () => currentcompositionsRef.current
|
|
5814
5891
|
};
|
|
5815
5892
|
}, []);
|
|
5816
|
-
const composition = compositions.find((c2) => canvasContent?.type === "composition" ? c2.id === canvasContent.compositionId : null);
|
|
5817
5893
|
const updateCompositionDefaultProps = useCallback14((id, newDefaultProps) => {
|
|
5818
5894
|
setCompositions((comps) => {
|
|
5819
5895
|
const updated = comps.map((c2) => {
|
|
@@ -5828,15 +5904,7 @@ var CompositionManagerProvider = ({
|
|
|
5828
5904
|
return updated;
|
|
5829
5905
|
});
|
|
5830
5906
|
}, []);
|
|
5831
|
-
const
|
|
5832
|
-
return {
|
|
5833
|
-
compositions,
|
|
5834
|
-
folders,
|
|
5835
|
-
currentCompositionMetadata,
|
|
5836
|
-
canvasContent
|
|
5837
|
-
};
|
|
5838
|
-
}, [compositions, folders, currentCompositionMetadata, canvasContent]);
|
|
5839
|
-
const setters = useMemo24(() => {
|
|
5907
|
+
const compositionManagerSetters = useMemo25(() => {
|
|
5840
5908
|
return {
|
|
5841
5909
|
registerComposition,
|
|
5842
5910
|
unregisterComposition,
|
|
@@ -5854,22 +5922,19 @@ var CompositionManagerProvider = ({
|
|
|
5854
5922
|
updateCompositionDefaultProps,
|
|
5855
5923
|
onlyRenderComposition
|
|
5856
5924
|
]);
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
})
|
|
5871
|
-
})
|
|
5872
|
-
})
|
|
5925
|
+
const compositionManagerContextValue = useMemo25(() => {
|
|
5926
|
+
return {
|
|
5927
|
+
compositions,
|
|
5928
|
+
folders,
|
|
5929
|
+
currentCompositionMetadata,
|
|
5930
|
+
canvasContent
|
|
5931
|
+
};
|
|
5932
|
+
}, [compositions, folders, currentCompositionMetadata, canvasContent]);
|
|
5933
|
+
return /* @__PURE__ */ jsx26(CompositionManager.Provider, {
|
|
5934
|
+
value: compositionManagerContextValue,
|
|
5935
|
+
children: /* @__PURE__ */ jsx26(CompositionSetters.Provider, {
|
|
5936
|
+
value: compositionManagerSetters,
|
|
5937
|
+
children
|
|
5873
5938
|
})
|
|
5874
5939
|
});
|
|
5875
5940
|
};
|
|
@@ -5963,20 +6028,14 @@ var waitForRoot = (fn) => {
|
|
|
5963
6028
|
};
|
|
5964
6029
|
|
|
5965
6030
|
// src/RemotionRoot.tsx
|
|
5966
|
-
import {
|
|
5967
|
-
useEffect as useEffect18,
|
|
5968
|
-
useLayoutEffect as useLayoutEffect8,
|
|
5969
|
-
useMemo as useMemo26,
|
|
5970
|
-
useRef as useRef15,
|
|
5971
|
-
useState as useState17
|
|
5972
|
-
} from "react";
|
|
6031
|
+
import { useEffect as useEffect18, useMemo as useMemo27, useState as useState18 } from "react";
|
|
5973
6032
|
|
|
5974
6033
|
// src/use-media-enabled.tsx
|
|
5975
|
-
import { createContext as
|
|
5976
|
-
import { jsx as
|
|
5977
|
-
var MediaEnabledContext =
|
|
6034
|
+
import { createContext as createContext19, useContext as useContext31, useMemo as useMemo26 } from "react";
|
|
6035
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6036
|
+
var MediaEnabledContext = createContext19(null);
|
|
5978
6037
|
var useVideoEnabled = () => {
|
|
5979
|
-
const context =
|
|
6038
|
+
const context = useContext31(MediaEnabledContext);
|
|
5980
6039
|
if (!context) {
|
|
5981
6040
|
return window.remotion_videoEnabled;
|
|
5982
6041
|
}
|
|
@@ -5986,7 +6045,7 @@ var useVideoEnabled = () => {
|
|
|
5986
6045
|
return context.videoEnabled;
|
|
5987
6046
|
};
|
|
5988
6047
|
var useAudioEnabled = () => {
|
|
5989
|
-
const context =
|
|
6048
|
+
const context = useContext31(MediaEnabledContext);
|
|
5990
6049
|
if (!context) {
|
|
5991
6050
|
return window.remotion_audioEnabled;
|
|
5992
6051
|
}
|
|
@@ -6000,78 +6059,27 @@ var MediaEnabledProvider = ({
|
|
|
6000
6059
|
videoEnabled,
|
|
6001
6060
|
audioEnabled
|
|
6002
6061
|
}) => {
|
|
6003
|
-
const value =
|
|
6004
|
-
return /* @__PURE__ */
|
|
6062
|
+
const value = useMemo26(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
|
|
6063
|
+
return /* @__PURE__ */ jsx27(MediaEnabledContext.Provider, {
|
|
6005
6064
|
value,
|
|
6006
6065
|
children
|
|
6007
6066
|
});
|
|
6008
6067
|
};
|
|
6009
6068
|
|
|
6010
6069
|
// src/RemotionRoot.tsx
|
|
6011
|
-
import { jsx as
|
|
6070
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6012
6071
|
var RemotionRoot = ({
|
|
6013
6072
|
children,
|
|
6014
6073
|
numberOfAudioTags,
|
|
6015
6074
|
logLevel,
|
|
6016
|
-
onlyRenderComposition,
|
|
6017
|
-
currentCompositionMetadata,
|
|
6018
6075
|
audioLatencyHint,
|
|
6019
6076
|
videoEnabled,
|
|
6020
|
-
audioEnabled
|
|
6077
|
+
audioEnabled,
|
|
6078
|
+
frameState
|
|
6021
6079
|
}) => {
|
|
6022
|
-
const [
|
|
6023
|
-
const [
|
|
6024
|
-
const
|
|
6025
|
-
const imperativePlaying = useRef15(false);
|
|
6026
|
-
const [fastRefreshes, setFastRefreshes] = useState17(0);
|
|
6027
|
-
const [manualRefreshes, setManualRefreshes] = useState17(0);
|
|
6028
|
-
const [playbackRate, setPlaybackRate] = useState17(1);
|
|
6029
|
-
const audioAndVideoTags = useRef15([]);
|
|
6030
|
-
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
6031
|
-
if (typeof window !== "undefined") {
|
|
6032
|
-
useLayoutEffect8(() => {
|
|
6033
|
-
window.remotion_setFrame = (f, composition, attempt) => {
|
|
6034
|
-
window.remotion_attempt = attempt;
|
|
6035
|
-
const id = delayRender2(`Setting the current frame to ${f}`);
|
|
6036
|
-
let asyncUpdate = true;
|
|
6037
|
-
setFrame((s) => {
|
|
6038
|
-
const currentFrame = s[composition] ?? window.remotion_initialFrame;
|
|
6039
|
-
if (currentFrame === f) {
|
|
6040
|
-
asyncUpdate = false;
|
|
6041
|
-
return s;
|
|
6042
|
-
}
|
|
6043
|
-
return {
|
|
6044
|
-
...s,
|
|
6045
|
-
[composition]: f
|
|
6046
|
-
};
|
|
6047
|
-
});
|
|
6048
|
-
if (asyncUpdate) {
|
|
6049
|
-
requestAnimationFrame(() => continueRender2(id));
|
|
6050
|
-
} else {
|
|
6051
|
-
continueRender2(id);
|
|
6052
|
-
}
|
|
6053
|
-
};
|
|
6054
|
-
window.remotion_isPlayer = false;
|
|
6055
|
-
}, [continueRender2, delayRender2]);
|
|
6056
|
-
}
|
|
6057
|
-
const timelineContextValue = useMemo26(() => {
|
|
6058
|
-
return {
|
|
6059
|
-
frame,
|
|
6060
|
-
playing,
|
|
6061
|
-
imperativePlaying,
|
|
6062
|
-
rootId: remotionRootId,
|
|
6063
|
-
playbackRate,
|
|
6064
|
-
setPlaybackRate,
|
|
6065
|
-
audioAndVideoTags
|
|
6066
|
-
};
|
|
6067
|
-
}, [frame, playbackRate, playing, remotionRootId]);
|
|
6068
|
-
const setTimelineContextValue = useMemo26(() => {
|
|
6069
|
-
return {
|
|
6070
|
-
setFrame,
|
|
6071
|
-
setPlaying
|
|
6072
|
-
};
|
|
6073
|
-
}, []);
|
|
6074
|
-
const nonceContext = useMemo26(() => {
|
|
6080
|
+
const [fastRefreshes, setFastRefreshes] = useState18(0);
|
|
6081
|
+
const [manualRefreshes, setManualRefreshes] = useState18(0);
|
|
6082
|
+
const nonceContext = useMemo27(() => {
|
|
6075
6083
|
let counter = 0;
|
|
6076
6084
|
return {
|
|
6077
6085
|
getNonce: () => counter++,
|
|
@@ -6079,7 +6087,7 @@ var RemotionRoot = ({
|
|
|
6079
6087
|
manualRefreshes
|
|
6080
6088
|
};
|
|
6081
6089
|
}, [fastRefreshes, manualRefreshes]);
|
|
6082
|
-
const setNonceContext =
|
|
6090
|
+
const setNonceContext = useMemo27(() => {
|
|
6083
6091
|
return {
|
|
6084
6092
|
increaseManualRefreshes: () => {
|
|
6085
6093
|
setManualRefreshes((i) => i + 1);
|
|
@@ -6097,32 +6105,33 @@ var RemotionRoot = ({
|
|
|
6097
6105
|
}
|
|
6098
6106
|
}
|
|
6099
6107
|
}, []);
|
|
6100
|
-
const logging =
|
|
6108
|
+
const logging = useMemo27(() => {
|
|
6101
6109
|
return { logLevel, mountTime: Date.now() };
|
|
6102
6110
|
}, [logLevel]);
|
|
6103
|
-
return /* @__PURE__ */
|
|
6111
|
+
return /* @__PURE__ */ jsx28(LogLevelContext.Provider, {
|
|
6104
6112
|
value: logging,
|
|
6105
|
-
children: /* @__PURE__ */
|
|
6113
|
+
children: /* @__PURE__ */ jsx28(NonceContext.Provider, {
|
|
6106
6114
|
value: nonceContext,
|
|
6107
|
-
children: /* @__PURE__ */
|
|
6115
|
+
children: /* @__PURE__ */ jsx28(SetNonceContext.Provider, {
|
|
6108
6116
|
value: setNonceContext,
|
|
6109
|
-
children: /* @__PURE__ */
|
|
6110
|
-
|
|
6111
|
-
children: /* @__PURE__ */
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6117
|
+
children: /* @__PURE__ */ jsx28(TimelineContextProvider, {
|
|
6118
|
+
frameState,
|
|
6119
|
+
children: /* @__PURE__ */ jsx28(MediaEnabledProvider, {
|
|
6120
|
+
videoEnabled,
|
|
6121
|
+
audioEnabled,
|
|
6122
|
+
children: /* @__PURE__ */ jsx28(EditorPropsProvider, {
|
|
6123
|
+
children: /* @__PURE__ */ jsx28(PrefetchProvider, {
|
|
6124
|
+
children: /* @__PURE__ */ jsx28(SequenceManagerProvider, {
|
|
6125
|
+
children: /* @__PURE__ */ jsx28(RenderAssetManagerProvider, {
|
|
6126
|
+
children: /* @__PURE__ */ jsx28(ResolveCompositionConfig, {
|
|
6127
|
+
children: /* @__PURE__ */ jsx28(SharedAudioContextProvider, {
|
|
6128
|
+
numberOfAudioTags,
|
|
6129
|
+
audioLatencyHint,
|
|
6130
|
+
children: /* @__PURE__ */ jsx28(DurationsContextProvider, {
|
|
6131
|
+
children: /* @__PURE__ */ jsx28(BufferingProvider, {
|
|
6132
|
+
children
|
|
6133
|
+
})
|
|
6134
|
+
})
|
|
6126
6135
|
})
|
|
6127
6136
|
})
|
|
6128
6137
|
})
|
|
@@ -6164,9 +6173,9 @@ var setupEnvVariables = () => {
|
|
|
6164
6173
|
};
|
|
6165
6174
|
|
|
6166
6175
|
// src/use-current-scale.ts
|
|
6167
|
-
import
|
|
6168
|
-
var CurrentScaleContext =
|
|
6169
|
-
var PreviewSizeContext =
|
|
6176
|
+
import React27, { createContext as createContext20 } from "react";
|
|
6177
|
+
var CurrentScaleContext = React27.createContext(null);
|
|
6178
|
+
var PreviewSizeContext = createContext20({
|
|
6170
6179
|
setSize: () => {
|
|
6171
6180
|
return;
|
|
6172
6181
|
},
|
|
@@ -6190,8 +6199,8 @@ var calculateScale = ({
|
|
|
6190
6199
|
return Number(previewSize);
|
|
6191
6200
|
};
|
|
6192
6201
|
var useCurrentScale = (options) => {
|
|
6193
|
-
const hasContext =
|
|
6194
|
-
const zoomContext =
|
|
6202
|
+
const hasContext = React27.useContext(CurrentScaleContext);
|
|
6203
|
+
const zoomContext = React27.useContext(PreviewSizeContext);
|
|
6195
6204
|
const config = useUnsafeVideoConfig();
|
|
6196
6205
|
const env = useRemotionEnvironment();
|
|
6197
6206
|
if (hasContext === null || config === null || zoomContext === null) {
|
|
@@ -6226,11 +6235,11 @@ import { useCallback as useCallback16 } from "react";
|
|
|
6226
6235
|
// src/video/OffthreadVideoForRendering.tsx
|
|
6227
6236
|
import {
|
|
6228
6237
|
useCallback as useCallback15,
|
|
6229
|
-
useContext as
|
|
6238
|
+
useContext as useContext32,
|
|
6230
6239
|
useEffect as useEffect19,
|
|
6231
6240
|
useLayoutEffect as useLayoutEffect9,
|
|
6232
|
-
useMemo as
|
|
6233
|
-
useState as
|
|
6241
|
+
useMemo as useMemo28,
|
|
6242
|
+
useState as useState19
|
|
6234
6243
|
} from "react";
|
|
6235
6244
|
|
|
6236
6245
|
// src/video/offthread-video-source.ts
|
|
@@ -6244,7 +6253,7 @@ var getOffthreadVideoSource = ({
|
|
|
6244
6253
|
};
|
|
6245
6254
|
|
|
6246
6255
|
// src/video/OffthreadVideoForRendering.tsx
|
|
6247
|
-
import { jsx as
|
|
6256
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6248
6257
|
var OffthreadVideoForRendering = ({
|
|
6249
6258
|
onError,
|
|
6250
6259
|
volume: volumeProp,
|
|
@@ -6268,13 +6277,13 @@ var OffthreadVideoForRendering = ({
|
|
|
6268
6277
|
const frame = useCurrentFrame();
|
|
6269
6278
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior);
|
|
6270
6279
|
const videoConfig = useUnsafeVideoConfig();
|
|
6271
|
-
const sequenceContext =
|
|
6280
|
+
const sequenceContext = useContext32(SequenceContext);
|
|
6272
6281
|
const mediaStartsAt = useMediaStartsAt();
|
|
6273
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
6282
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext32(RenderAssetManager);
|
|
6274
6283
|
if (!src) {
|
|
6275
6284
|
throw new TypeError("No `src` was passed to <OffthreadVideo>.");
|
|
6276
6285
|
}
|
|
6277
|
-
const id =
|
|
6286
|
+
const id = useMemo28(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
6278
6287
|
src,
|
|
6279
6288
|
sequenceContext?.cumulatedFrom,
|
|
6280
6289
|
sequenceContext?.relativeFrom,
|
|
@@ -6329,14 +6338,14 @@ var OffthreadVideoForRendering = ({
|
|
|
6329
6338
|
sequenceContext?.relativeFrom,
|
|
6330
6339
|
audioStreamIndex
|
|
6331
6340
|
]);
|
|
6332
|
-
const currentTime =
|
|
6341
|
+
const currentTime = useMemo28(() => {
|
|
6333
6342
|
return getExpectedMediaFrameUncorrected({
|
|
6334
6343
|
frame,
|
|
6335
6344
|
playbackRate: playbackRate || 1,
|
|
6336
6345
|
startFrom: -mediaStartsAt
|
|
6337
6346
|
}) / videoConfig.fps;
|
|
6338
6347
|
}, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
|
|
6339
|
-
const actualSrc =
|
|
6348
|
+
const actualSrc = useMemo28(() => {
|
|
6340
6349
|
return getOffthreadVideoSource({
|
|
6341
6350
|
src,
|
|
6342
6351
|
currentTime,
|
|
@@ -6344,7 +6353,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6344
6353
|
toneMapped
|
|
6345
6354
|
});
|
|
6346
6355
|
}, [toneMapped, currentTime, src, transparent]);
|
|
6347
|
-
const [imageSrc, setImageSrc] =
|
|
6356
|
+
const [imageSrc, setImageSrc] = useState19(null);
|
|
6348
6357
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
6349
6358
|
useLayoutEffect9(() => {
|
|
6350
6359
|
if (!window.remotion_videoEnabled) {
|
|
@@ -6424,7 +6433,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6424
6433
|
cancelRender("Failed to load image with src " + imageSrc);
|
|
6425
6434
|
}
|
|
6426
6435
|
}, [imageSrc, onError]);
|
|
6427
|
-
const className =
|
|
6436
|
+
const className = useMemo28(() => {
|
|
6428
6437
|
return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
|
|
6429
6438
|
}, [props2.className]);
|
|
6430
6439
|
const onImageFrame = useCallback15((img) => {
|
|
@@ -6436,7 +6445,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6436
6445
|
return null;
|
|
6437
6446
|
}
|
|
6438
6447
|
continueRender2(imageSrc.handle);
|
|
6439
|
-
return /* @__PURE__ */
|
|
6448
|
+
return /* @__PURE__ */ jsx29(Img, {
|
|
6440
6449
|
src: imageSrc.src,
|
|
6441
6450
|
delayRenderRetries,
|
|
6442
6451
|
delayRenderTimeoutInMilliseconds,
|
|
@@ -6450,12 +6459,12 @@ var OffthreadVideoForRendering = ({
|
|
|
6450
6459
|
// src/video/VideoForPreview.tsx
|
|
6451
6460
|
import {
|
|
6452
6461
|
forwardRef as forwardRef9,
|
|
6453
|
-
useContext as
|
|
6462
|
+
useContext as useContext33,
|
|
6454
6463
|
useEffect as useEffect21,
|
|
6455
6464
|
useImperativeHandle as useImperativeHandle9,
|
|
6456
|
-
useMemo as
|
|
6465
|
+
useMemo as useMemo29,
|
|
6457
6466
|
useRef as useRef16,
|
|
6458
|
-
useState as
|
|
6467
|
+
useState as useState20
|
|
6459
6468
|
} from "react";
|
|
6460
6469
|
|
|
6461
6470
|
// src/video/emit-video-frame.ts
|
|
@@ -6488,14 +6497,14 @@ var useEmitVideoFrame = ({
|
|
|
6488
6497
|
};
|
|
6489
6498
|
|
|
6490
6499
|
// src/video/VideoForPreview.tsx
|
|
6491
|
-
import { jsx as
|
|
6500
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6492
6501
|
var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
6493
|
-
const context =
|
|
6502
|
+
const context = useContext33(SharedAudioContext);
|
|
6494
6503
|
if (!context) {
|
|
6495
6504
|
throw new Error("SharedAudioContext not found");
|
|
6496
6505
|
}
|
|
6497
6506
|
const videoRef = useRef16(null);
|
|
6498
|
-
const sharedSource =
|
|
6507
|
+
const sharedSource = useMemo29(() => {
|
|
6499
6508
|
if (!context.audioContext) {
|
|
6500
6509
|
return null;
|
|
6501
6510
|
}
|
|
@@ -6538,11 +6547,11 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6538
6547
|
}
|
|
6539
6548
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
6540
6549
|
const { fps, durationInFrames } = useVideoConfig();
|
|
6541
|
-
const parentSequence =
|
|
6542
|
-
const { hidden } =
|
|
6550
|
+
const parentSequence = useContext33(SequenceContext);
|
|
6551
|
+
const { hidden } = useContext33(SequenceVisibilityToggleContext);
|
|
6543
6552
|
const logLevel = useLogLevel();
|
|
6544
6553
|
const mountTime = useMountTime();
|
|
6545
|
-
const [timelineId] =
|
|
6554
|
+
const [timelineId] = useState20(() => String(Math.random()));
|
|
6546
6555
|
const isSequenceHidden = hidden[timelineId] ?? false;
|
|
6547
6556
|
if (typeof acceptableTimeShift !== "undefined") {
|
|
6548
6557
|
throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
|
|
@@ -6608,7 +6617,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6608
6617
|
useImperativeHandle9(ref, () => {
|
|
6609
6618
|
return videoRef.current;
|
|
6610
6619
|
}, []);
|
|
6611
|
-
|
|
6620
|
+
useState20(() => playbackLogging({
|
|
6612
6621
|
logLevel,
|
|
6613
6622
|
message: `Mounting video with source = ${actualSrc}, v=${VERSION}, user agent=${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
|
|
6614
6623
|
tag: "video",
|
|
@@ -6673,7 +6682,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6673
6682
|
current.preload = "auto";
|
|
6674
6683
|
}
|
|
6675
6684
|
}, []);
|
|
6676
|
-
const actualStyle =
|
|
6685
|
+
const actualStyle = useMemo29(() => {
|
|
6677
6686
|
return {
|
|
6678
6687
|
...style,
|
|
6679
6688
|
opacity: isSequenceHidden ? 0 : style?.opacity ?? 1
|
|
@@ -6683,7 +6692,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6683
6692
|
crossOrigin,
|
|
6684
6693
|
requestsVideoFrame: Boolean(onVideoFrame)
|
|
6685
6694
|
});
|
|
6686
|
-
return /* @__PURE__ */
|
|
6695
|
+
return /* @__PURE__ */ jsx30("video", {
|
|
6687
6696
|
ref: videoRef,
|
|
6688
6697
|
muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
|
|
6689
6698
|
playsInline: true,
|
|
@@ -6698,7 +6707,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6698
6707
|
var VideoForPreview = forwardRef9(VideoForDevelopmentRefForwardingFunction);
|
|
6699
6708
|
|
|
6700
6709
|
// src/video/OffthreadVideo.tsx
|
|
6701
|
-
import { jsx as
|
|
6710
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
6702
6711
|
var InnerOffthreadVideo = (props2) => {
|
|
6703
6712
|
const {
|
|
6704
6713
|
startFrom,
|
|
@@ -6726,13 +6735,13 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
6726
6735
|
trimAfter
|
|
6727
6736
|
});
|
|
6728
6737
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
6729
|
-
return /* @__PURE__ */
|
|
6738
|
+
return /* @__PURE__ */ jsx31(Sequence, {
|
|
6730
6739
|
layout: "none",
|
|
6731
6740
|
from: 0 - (trimBeforeValue ?? 0),
|
|
6732
6741
|
showInTimeline: false,
|
|
6733
6742
|
durationInFrames: trimAfterValue,
|
|
6734
6743
|
name,
|
|
6735
|
-
children: /* @__PURE__ */
|
|
6744
|
+
children: /* @__PURE__ */ jsx31(InnerOffthreadVideo, {
|
|
6736
6745
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6737
6746
|
...otherProps,
|
|
6738
6747
|
trimAfter: undefined,
|
|
@@ -6747,7 +6756,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
6747
6756
|
}
|
|
6748
6757
|
validateMediaProps(props2, "Video");
|
|
6749
6758
|
if (environment.isRendering) {
|
|
6750
|
-
return /* @__PURE__ */
|
|
6759
|
+
return /* @__PURE__ */ jsx31(OffthreadVideoForRendering, {
|
|
6751
6760
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6752
6761
|
...otherProps,
|
|
6753
6762
|
trimAfter: undefined,
|
|
@@ -6769,7 +6778,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
6769
6778
|
delayRenderTimeoutInMilliseconds,
|
|
6770
6779
|
...propsForPreview
|
|
6771
6780
|
} = otherProps;
|
|
6772
|
-
return /* @__PURE__ */
|
|
6781
|
+
return /* @__PURE__ */ jsx31(VideoForPreview, {
|
|
6773
6782
|
_remotionInternalStack: stack ?? null,
|
|
6774
6783
|
onDuration,
|
|
6775
6784
|
onlyWarnForMediaSeekingError: true,
|
|
@@ -6818,7 +6827,7 @@ var OffthreadVideo = ({
|
|
|
6818
6827
|
if (imageFormat) {
|
|
6819
6828
|
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
6820
6829
|
}
|
|
6821
|
-
return /* @__PURE__ */
|
|
6830
|
+
return /* @__PURE__ */ jsx31(InnerOffthreadVideo, {
|
|
6822
6831
|
acceptableTimeShiftInSeconds,
|
|
6823
6832
|
allowAmplificationDuringRender: allowAmplificationDuringRender ?? true,
|
|
6824
6833
|
audioStreamIndex: audioStreamIndex ?? 0,
|
|
@@ -6891,22 +6900,22 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
6891
6900
|
};
|
|
6892
6901
|
|
|
6893
6902
|
// src/wrap-remotion-context.tsx
|
|
6894
|
-
import
|
|
6895
|
-
import { jsx as
|
|
6903
|
+
import React31, { useMemo as useMemo30 } from "react";
|
|
6904
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6896
6905
|
function useRemotionContexts() {
|
|
6897
|
-
const compositionManagerCtx =
|
|
6898
|
-
const timelineContext =
|
|
6899
|
-
const setTimelineContext =
|
|
6900
|
-
const sequenceContext =
|
|
6901
|
-
const nonceContext =
|
|
6902
|
-
const canUseRemotionHooksContext =
|
|
6903
|
-
const preloadContext =
|
|
6904
|
-
const resolveCompositionContext =
|
|
6905
|
-
const renderAssetManagerContext =
|
|
6906
|
-
const sequenceManagerContext =
|
|
6907
|
-
const bufferManagerContext =
|
|
6908
|
-
const logLevelContext =
|
|
6909
|
-
return
|
|
6906
|
+
const compositionManagerCtx = React31.useContext(CompositionManager);
|
|
6907
|
+
const timelineContext = React31.useContext(TimelineContext);
|
|
6908
|
+
const setTimelineContext = React31.useContext(SetTimelineContext);
|
|
6909
|
+
const sequenceContext = React31.useContext(SequenceContext);
|
|
6910
|
+
const nonceContext = React31.useContext(NonceContext);
|
|
6911
|
+
const canUseRemotionHooksContext = React31.useContext(CanUseRemotionHooks);
|
|
6912
|
+
const preloadContext = React31.useContext(PreloadContext);
|
|
6913
|
+
const resolveCompositionContext = React31.useContext(ResolveCompositionContext);
|
|
6914
|
+
const renderAssetManagerContext = React31.useContext(RenderAssetManager);
|
|
6915
|
+
const sequenceManagerContext = React31.useContext(SequenceManager);
|
|
6916
|
+
const bufferManagerContext = React31.useContext(BufferingContextReact);
|
|
6917
|
+
const logLevelContext = React31.useContext(LogLevelContext);
|
|
6918
|
+
return useMemo30(() => ({
|
|
6910
6919
|
compositionManagerCtx,
|
|
6911
6920
|
timelineContext,
|
|
6912
6921
|
setTimelineContext,
|
|
@@ -6936,29 +6945,29 @@ function useRemotionContexts() {
|
|
|
6936
6945
|
}
|
|
6937
6946
|
var RemotionContextProvider = (props2) => {
|
|
6938
6947
|
const { children, contexts } = props2;
|
|
6939
|
-
return /* @__PURE__ */
|
|
6948
|
+
return /* @__PURE__ */ jsx32(LogLevelContext.Provider, {
|
|
6940
6949
|
value: contexts.logLevelContext,
|
|
6941
|
-
children: /* @__PURE__ */
|
|
6950
|
+
children: /* @__PURE__ */ jsx32(CanUseRemotionHooks.Provider, {
|
|
6942
6951
|
value: contexts.canUseRemotionHooksContext,
|
|
6943
|
-
children: /* @__PURE__ */
|
|
6952
|
+
children: /* @__PURE__ */ jsx32(NonceContext.Provider, {
|
|
6944
6953
|
value: contexts.nonceContext,
|
|
6945
|
-
children: /* @__PURE__ */
|
|
6954
|
+
children: /* @__PURE__ */ jsx32(PreloadContext.Provider, {
|
|
6946
6955
|
value: contexts.preloadContext,
|
|
6947
|
-
children: /* @__PURE__ */
|
|
6956
|
+
children: /* @__PURE__ */ jsx32(CompositionManager.Provider, {
|
|
6948
6957
|
value: contexts.compositionManagerCtx,
|
|
6949
|
-
children: /* @__PURE__ */
|
|
6958
|
+
children: /* @__PURE__ */ jsx32(SequenceManager.Provider, {
|
|
6950
6959
|
value: contexts.sequenceManagerContext,
|
|
6951
|
-
children: /* @__PURE__ */
|
|
6960
|
+
children: /* @__PURE__ */ jsx32(RenderAssetManager.Provider, {
|
|
6952
6961
|
value: contexts.renderAssetManagerContext,
|
|
6953
|
-
children: /* @__PURE__ */
|
|
6962
|
+
children: /* @__PURE__ */ jsx32(ResolveCompositionContext.Provider, {
|
|
6954
6963
|
value: contexts.resolveCompositionContext,
|
|
6955
|
-
children: /* @__PURE__ */
|
|
6964
|
+
children: /* @__PURE__ */ jsx32(TimelineContext.Provider, {
|
|
6956
6965
|
value: contexts.timelineContext,
|
|
6957
|
-
children: /* @__PURE__ */
|
|
6966
|
+
children: /* @__PURE__ */ jsx32(SetTimelineContext.Provider, {
|
|
6958
6967
|
value: contexts.setTimelineContext,
|
|
6959
|
-
children: /* @__PURE__ */
|
|
6968
|
+
children: /* @__PURE__ */ jsx32(SequenceContext.Provider, {
|
|
6960
6969
|
value: contexts.sequenceContext,
|
|
6961
|
-
children: /* @__PURE__ */
|
|
6970
|
+
children: /* @__PURE__ */ jsx32(BufferingContextReact.Provider, {
|
|
6962
6971
|
value: contexts.bufferManagerContext,
|
|
6963
6972
|
children
|
|
6964
6973
|
})
|
|
@@ -6993,6 +7002,7 @@ var Internals = {
|
|
|
6993
7002
|
SequenceManager,
|
|
6994
7003
|
SequenceVisibilityToggleContext,
|
|
6995
7004
|
RemotionRoot,
|
|
7005
|
+
CompositionManagerProvider,
|
|
6996
7006
|
useVideo,
|
|
6997
7007
|
getRoot,
|
|
6998
7008
|
useMediaVolumeState,
|
|
@@ -7017,6 +7027,7 @@ var Internals = {
|
|
|
7017
7027
|
compositionsRef,
|
|
7018
7028
|
portalNode,
|
|
7019
7029
|
waitForRoot,
|
|
7030
|
+
SetTimelineContext,
|
|
7020
7031
|
CanUseRemotionHooksProvider,
|
|
7021
7032
|
CanUseRemotionHooks,
|
|
7022
7033
|
PrefetchProvider,
|
|
@@ -7065,7 +7076,10 @@ var Internals = {
|
|
|
7065
7076
|
setInputPropsOverride,
|
|
7066
7077
|
useVideoEnabled,
|
|
7067
7078
|
useAudioEnabled,
|
|
7068
|
-
useIsPlayerBuffering
|
|
7079
|
+
useIsPlayerBuffering,
|
|
7080
|
+
TimelinePosition: exports_timeline_position_state,
|
|
7081
|
+
DelayRenderContextType,
|
|
7082
|
+
TimelineContext
|
|
7069
7083
|
};
|
|
7070
7084
|
// src/interpolate-colors.ts
|
|
7071
7085
|
var NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
@@ -7431,14 +7445,14 @@ var validateFrame = ({
|
|
|
7431
7445
|
}
|
|
7432
7446
|
};
|
|
7433
7447
|
// src/series/index.tsx
|
|
7434
|
-
import { Children, forwardRef as forwardRef10, useMemo as
|
|
7448
|
+
import { Children, forwardRef as forwardRef10, useMemo as useMemo31 } from "react";
|
|
7435
7449
|
|
|
7436
7450
|
// src/series/flatten-children.tsx
|
|
7437
|
-
import
|
|
7451
|
+
import React32 from "react";
|
|
7438
7452
|
var flattenChildren = (children) => {
|
|
7439
|
-
const childrenArray =
|
|
7453
|
+
const childrenArray = React32.Children.toArray(children);
|
|
7440
7454
|
return childrenArray.reduce((flatChildren, child) => {
|
|
7441
|
-
if (child.type ===
|
|
7455
|
+
if (child.type === React32.Fragment) {
|
|
7442
7456
|
return flatChildren.concat(flattenChildren(child.props.children));
|
|
7443
7457
|
}
|
|
7444
7458
|
flatChildren.push(child);
|
|
@@ -7447,39 +7461,39 @@ var flattenChildren = (children) => {
|
|
|
7447
7461
|
};
|
|
7448
7462
|
|
|
7449
7463
|
// src/series/is-inside-series.tsx
|
|
7450
|
-
import
|
|
7451
|
-
import { jsx as
|
|
7452
|
-
var IsInsideSeriesContext =
|
|
7464
|
+
import React33, { createContext as createContext21 } from "react";
|
|
7465
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
7466
|
+
var IsInsideSeriesContext = createContext21(false);
|
|
7453
7467
|
var IsInsideSeriesContainer = ({ children }) => {
|
|
7454
|
-
return /* @__PURE__ */
|
|
7468
|
+
return /* @__PURE__ */ jsx33(IsInsideSeriesContext.Provider, {
|
|
7455
7469
|
value: true,
|
|
7456
7470
|
children
|
|
7457
7471
|
});
|
|
7458
7472
|
};
|
|
7459
7473
|
var IsNotInsideSeriesProvider = ({ children }) => {
|
|
7460
|
-
return /* @__PURE__ */
|
|
7474
|
+
return /* @__PURE__ */ jsx33(IsInsideSeriesContext.Provider, {
|
|
7461
7475
|
value: false,
|
|
7462
7476
|
children
|
|
7463
7477
|
});
|
|
7464
7478
|
};
|
|
7465
7479
|
var useRequireToBeInsideSeries = () => {
|
|
7466
|
-
const isInsideSeries =
|
|
7480
|
+
const isInsideSeries = React33.useContext(IsInsideSeriesContext);
|
|
7467
7481
|
if (!isInsideSeries) {
|
|
7468
7482
|
throw new Error("This component must be inside a <Series /> component.");
|
|
7469
7483
|
}
|
|
7470
7484
|
};
|
|
7471
7485
|
|
|
7472
7486
|
// src/series/index.tsx
|
|
7473
|
-
import { jsx as
|
|
7487
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
7474
7488
|
var SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
|
|
7475
7489
|
useRequireToBeInsideSeries();
|
|
7476
|
-
return /* @__PURE__ */
|
|
7490
|
+
return /* @__PURE__ */ jsx34(IsNotInsideSeriesProvider, {
|
|
7477
7491
|
children
|
|
7478
7492
|
});
|
|
7479
7493
|
};
|
|
7480
7494
|
var SeriesSequence = forwardRef10(SeriesSequenceRefForwardingFunction);
|
|
7481
7495
|
var Series = (props2) => {
|
|
7482
|
-
const childrenValue =
|
|
7496
|
+
const childrenValue = useMemo31(() => {
|
|
7483
7497
|
let startFrame = 0;
|
|
7484
7498
|
const flattenedChildren = flattenChildren(props2.children);
|
|
7485
7499
|
return Children.map(flattenedChildren, (child, i) => {
|
|
@@ -7523,7 +7537,7 @@ var Series = (props2) => {
|
|
|
7523
7537
|
}
|
|
7524
7538
|
const currentStartFrame = startFrame + offset;
|
|
7525
7539
|
startFrame += durationInFramesProp + offset;
|
|
7526
|
-
return /* @__PURE__ */
|
|
7540
|
+
return /* @__PURE__ */ jsx34(Sequence, {
|
|
7527
7541
|
name: name || "<Series.Sequence>",
|
|
7528
7542
|
from: currentStartFrame,
|
|
7529
7543
|
durationInFrames: durationInFramesProp,
|
|
@@ -7534,14 +7548,14 @@ var Series = (props2) => {
|
|
|
7534
7548
|
});
|
|
7535
7549
|
}, [props2.children]);
|
|
7536
7550
|
if (ENABLE_V5_BREAKING_CHANGES) {
|
|
7537
|
-
return /* @__PURE__ */
|
|
7538
|
-
children: /* @__PURE__ */
|
|
7551
|
+
return /* @__PURE__ */ jsx34(IsInsideSeriesContainer, {
|
|
7552
|
+
children: /* @__PURE__ */ jsx34(Sequence, {
|
|
7539
7553
|
...props2,
|
|
7540
7554
|
children: childrenValue
|
|
7541
7555
|
})
|
|
7542
7556
|
});
|
|
7543
7557
|
}
|
|
7544
|
-
return /* @__PURE__ */
|
|
7558
|
+
return /* @__PURE__ */ jsx34(IsInsideSeriesContainer, {
|
|
7545
7559
|
children: childrenValue
|
|
7546
7560
|
});
|
|
7547
7561
|
};
|
|
@@ -7878,26 +7892,26 @@ var staticFile = (path) => {
|
|
|
7878
7892
|
return preparsed;
|
|
7879
7893
|
};
|
|
7880
7894
|
// src/Still.tsx
|
|
7881
|
-
import
|
|
7895
|
+
import React35 from "react";
|
|
7882
7896
|
var Still = (props2) => {
|
|
7883
7897
|
const newProps = {
|
|
7884
7898
|
...props2,
|
|
7885
7899
|
durationInFrames: 1,
|
|
7886
7900
|
fps: 1
|
|
7887
7901
|
};
|
|
7888
|
-
return
|
|
7902
|
+
return React35.createElement(Composition, newProps);
|
|
7889
7903
|
};
|
|
7890
7904
|
// src/video/Video.tsx
|
|
7891
|
-
import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as
|
|
7905
|
+
import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext35 } from "react";
|
|
7892
7906
|
|
|
7893
7907
|
// src/video/VideoForRendering.tsx
|
|
7894
7908
|
import {
|
|
7895
7909
|
forwardRef as forwardRef11,
|
|
7896
|
-
useContext as
|
|
7910
|
+
useContext as useContext34,
|
|
7897
7911
|
useEffect as useEffect22,
|
|
7898
7912
|
useImperativeHandle as useImperativeHandle10,
|
|
7899
7913
|
useLayoutEffect as useLayoutEffect10,
|
|
7900
|
-
useMemo as
|
|
7914
|
+
useMemo as useMemo32,
|
|
7901
7915
|
useRef as useRef17
|
|
7902
7916
|
} from "react";
|
|
7903
7917
|
|
|
@@ -8026,7 +8040,7 @@ var seekToTimeMultipleUntilRight = ({
|
|
|
8026
8040
|
};
|
|
8027
8041
|
|
|
8028
8042
|
// src/video/VideoForRendering.tsx
|
|
8029
|
-
import { jsx as
|
|
8043
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
8030
8044
|
var VideoForRenderingForwardFunction = ({
|
|
8031
8045
|
onError,
|
|
8032
8046
|
volume: volumeProp,
|
|
@@ -8047,14 +8061,14 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8047
8061
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
8048
8062
|
const videoConfig = useUnsafeVideoConfig();
|
|
8049
8063
|
const videoRef = useRef17(null);
|
|
8050
|
-
const sequenceContext =
|
|
8064
|
+
const sequenceContext = useContext34(SequenceContext);
|
|
8051
8065
|
const mediaStartsAt = useMediaStartsAt();
|
|
8052
8066
|
const environment = useRemotionEnvironment();
|
|
8053
8067
|
const logLevel = useLogLevel();
|
|
8054
8068
|
const mountTime = useMountTime();
|
|
8055
8069
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
8056
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
8057
|
-
const id =
|
|
8070
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext34(RenderAssetManager);
|
|
8071
|
+
const id = useMemo32(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
8058
8072
|
props2.src,
|
|
8059
8073
|
sequenceContext?.cumulatedFrom,
|
|
8060
8074
|
sequenceContext?.relativeFrom,
|
|
@@ -8230,7 +8244,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8230
8244
|
delayRender2
|
|
8231
8245
|
]);
|
|
8232
8246
|
}
|
|
8233
|
-
return /* @__PURE__ */
|
|
8247
|
+
return /* @__PURE__ */ jsx35("video", {
|
|
8234
8248
|
ref: videoRef,
|
|
8235
8249
|
disableRemotePlayback: true,
|
|
8236
8250
|
...props2
|
|
@@ -8239,7 +8253,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8239
8253
|
var VideoForRendering = forwardRef11(VideoForRenderingForwardFunction);
|
|
8240
8254
|
|
|
8241
8255
|
// src/video/Video.tsx
|
|
8242
|
-
import { jsx as
|
|
8256
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
8243
8257
|
var VideoForwardingFunction = (props2, ref) => {
|
|
8244
8258
|
const {
|
|
8245
8259
|
startFrom,
|
|
@@ -8257,7 +8271,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8257
8271
|
const { loop, ...propsOtherThanLoop } = props2;
|
|
8258
8272
|
const { fps } = useVideoConfig();
|
|
8259
8273
|
const environment = useRemotionEnvironment();
|
|
8260
|
-
const { durations, setDurations } =
|
|
8274
|
+
const { durations, setDurations } = useContext35(DurationsContext);
|
|
8261
8275
|
if (typeof ref === "string") {
|
|
8262
8276
|
throw new Error("string refs are not supported");
|
|
8263
8277
|
}
|
|
@@ -8279,14 +8293,14 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8279
8293
|
});
|
|
8280
8294
|
if (loop && durationFetched !== undefined) {
|
|
8281
8295
|
if (!Number.isFinite(durationFetched)) {
|
|
8282
|
-
return /* @__PURE__ */
|
|
8296
|
+
return /* @__PURE__ */ jsx36(Html5Video, {
|
|
8283
8297
|
...propsOtherThanLoop,
|
|
8284
8298
|
ref,
|
|
8285
8299
|
_remotionInternalNativeLoopPassed: true
|
|
8286
8300
|
});
|
|
8287
8301
|
}
|
|
8288
8302
|
const mediaDuration = durationFetched * fps;
|
|
8289
|
-
return /* @__PURE__ */
|
|
8303
|
+
return /* @__PURE__ */ jsx36(Loop, {
|
|
8290
8304
|
durationInFrames: calculateMediaDuration({
|
|
8291
8305
|
trimAfter: trimAfterValue,
|
|
8292
8306
|
mediaDurationInFrames: mediaDuration,
|
|
@@ -8295,7 +8309,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8295
8309
|
}),
|
|
8296
8310
|
layout: "none",
|
|
8297
8311
|
name,
|
|
8298
|
-
children: /* @__PURE__ */
|
|
8312
|
+
children: /* @__PURE__ */ jsx36(Html5Video, {
|
|
8299
8313
|
...propsOtherThanLoop,
|
|
8300
8314
|
ref,
|
|
8301
8315
|
_remotionInternalNativeLoopPassed: true
|
|
@@ -8303,13 +8317,13 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8303
8317
|
});
|
|
8304
8318
|
}
|
|
8305
8319
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
8306
|
-
return /* @__PURE__ */
|
|
8320
|
+
return /* @__PURE__ */ jsx36(Sequence, {
|
|
8307
8321
|
layout: "none",
|
|
8308
8322
|
from: 0 - (trimBeforeValue ?? 0),
|
|
8309
8323
|
showInTimeline: false,
|
|
8310
8324
|
durationInFrames: trimAfterValue,
|
|
8311
8325
|
name,
|
|
8312
|
-
children: /* @__PURE__ */
|
|
8326
|
+
children: /* @__PURE__ */ jsx36(Html5Video, {
|
|
8313
8327
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
8314
8328
|
...otherProps,
|
|
8315
8329
|
ref
|
|
@@ -8318,14 +8332,14 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8318
8332
|
}
|
|
8319
8333
|
validateMediaProps({ playbackRate: props2.playbackRate, volume: props2.volume }, "Html5Video");
|
|
8320
8334
|
if (environment.isRendering) {
|
|
8321
|
-
return /* @__PURE__ */
|
|
8335
|
+
return /* @__PURE__ */ jsx36(VideoForRendering, {
|
|
8322
8336
|
onDuration,
|
|
8323
8337
|
onVideoFrame: onVideoFrame ?? null,
|
|
8324
8338
|
...otherProps,
|
|
8325
8339
|
ref
|
|
8326
8340
|
});
|
|
8327
8341
|
}
|
|
8328
|
-
return /* @__PURE__ */
|
|
8342
|
+
return /* @__PURE__ */ jsx36(VideoForPreview, {
|
|
8329
8343
|
onlyWarnForMediaSeekingError: false,
|
|
8330
8344
|
...otherProps,
|
|
8331
8345
|
ref,
|