remotion 4.0.344 → 4.0.345
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/Composition.js +5 -4
- package/dist/cjs/IFrame.js +7 -6
- package/dist/cjs/Img.js +8 -5
- package/dist/cjs/RemotionRoot.js +6 -5
- package/dist/cjs/animated-image/AnimatedImage.js +25 -10
- package/dist/cjs/audio/AudioForRendering.js +8 -5
- package/dist/cjs/get-remotion-environment.d.ts +3 -0
- package/dist/cjs/get-remotion-environment.js +7 -1
- package/dist/cjs/internals.d.ts +1 -0
- package/dist/cjs/internals.js +1 -0
- package/dist/cjs/use-remotion-environment.js +2 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/OffthreadVideoForRendering.js +8 -5
- package/dist/cjs/video/VideoForRendering.js +23 -13
- package/dist/cjs/video/use-audio-channel-index.d.ts +4 -0
- package/dist/cjs/video/use-audio-channel-index.js +13 -0
- package/dist/esm/index.mjs +286 -241
- package/dist/esm/no-react.mjs +4 -0
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/esm/index.mjs
CHANGED
|
@@ -33,9 +33,10 @@ var Clipper = () => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// src/enable-sequence-stack-traces.ts
|
|
36
|
-
import
|
|
36
|
+
import React2 from "react";
|
|
37
37
|
|
|
38
38
|
// src/get-remotion-environment.ts
|
|
39
|
+
import React from "react";
|
|
39
40
|
function getNodeEnvString() {
|
|
40
41
|
return ["NOD", "E_EN", "V"].join("");
|
|
41
42
|
}
|
|
@@ -51,12 +52,14 @@ var getRemotionEnvironment = () => {
|
|
|
51
52
|
isStudio,
|
|
52
53
|
isRendering,
|
|
53
54
|
isPlayer,
|
|
54
|
-
isReadOnlyStudio
|
|
55
|
+
isReadOnlyStudio,
|
|
56
|
+
isClientSideRendering: false
|
|
55
57
|
};
|
|
56
58
|
};
|
|
59
|
+
var RemotionEnvironmentContext = React.createContext(null);
|
|
57
60
|
|
|
58
61
|
// src/enable-sequence-stack-traces.ts
|
|
59
|
-
var originalCreateElement =
|
|
62
|
+
var originalCreateElement = React2.createElement;
|
|
60
63
|
var componentsToAddStacksTo = [];
|
|
61
64
|
var enableSequenceStackTraces = () => {
|
|
62
65
|
if (!getRemotionEnvironment().isStudio) {
|
|
@@ -75,7 +78,7 @@ var enableSequenceStackTraces = () => {
|
|
|
75
78
|
return Reflect.apply(target, thisArg, argArray);
|
|
76
79
|
}
|
|
77
80
|
});
|
|
78
|
-
|
|
81
|
+
React2.createElement = proxy;
|
|
79
82
|
};
|
|
80
83
|
var addSequenceStackTraces = (component) => {
|
|
81
84
|
componentsToAddStacksTo.push(component);
|
|
@@ -104,7 +107,7 @@ function truthy(value) {
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
// src/version.ts
|
|
107
|
-
var VERSION = "4.0.
|
|
110
|
+
var VERSION = "4.0.345";
|
|
108
111
|
|
|
109
112
|
// src/multiple-versions-warning.ts
|
|
110
113
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -143,7 +146,7 @@ var Null = () => {
|
|
|
143
146
|
// src/Sequence.tsx
|
|
144
147
|
import {
|
|
145
148
|
forwardRef as forwardRef2,
|
|
146
|
-
useContext as
|
|
149
|
+
useContext as useContext11,
|
|
147
150
|
useEffect as useEffect3,
|
|
148
151
|
useMemo as useMemo9,
|
|
149
152
|
useState as useState5
|
|
@@ -250,9 +253,9 @@ import { createContext as createContext3 } from "react";
|
|
|
250
253
|
var SequenceContext = createContext3(null);
|
|
251
254
|
|
|
252
255
|
// src/SequenceManager.tsx
|
|
253
|
-
import
|
|
256
|
+
import React4, { useCallback, useMemo as useMemo2, useState } from "react";
|
|
254
257
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
255
|
-
var SequenceManager =
|
|
258
|
+
var SequenceManager = React4.createContext({
|
|
256
259
|
registerSequence: () => {
|
|
257
260
|
throw new Error("SequenceManagerContext not initialized");
|
|
258
261
|
},
|
|
@@ -261,7 +264,7 @@ var SequenceManager = React3.createContext({
|
|
|
261
264
|
},
|
|
262
265
|
sequences: []
|
|
263
266
|
});
|
|
264
|
-
var SequenceVisibilityToggleContext =
|
|
267
|
+
var SequenceVisibilityToggleContext = React4.createContext({
|
|
265
268
|
hidden: {},
|
|
266
269
|
setHidden: () => {
|
|
267
270
|
throw new Error("SequenceVisibilityToggle not initialized");
|
|
@@ -336,17 +339,18 @@ __export(exports_timeline_position_state, {
|
|
|
336
339
|
TimelineContext: () => TimelineContext,
|
|
337
340
|
SetTimelineContext: () => SetTimelineContext
|
|
338
341
|
});
|
|
339
|
-
import { createContext as createContext8, useContext as
|
|
342
|
+
import { createContext as createContext8, useContext as useContext6, useMemo as useMemo6 } from "react";
|
|
340
343
|
|
|
341
344
|
// src/use-remotion-environment.ts
|
|
342
|
-
import { useState as useState3 } from "react";
|
|
345
|
+
import { useContext as useContext3, useState as useState3 } from "react";
|
|
343
346
|
var useRemotionEnvironment = () => {
|
|
347
|
+
const context = useContext3(RemotionEnvironmentContext);
|
|
344
348
|
const [env] = useState3(() => getRemotionEnvironment());
|
|
345
|
-
return env;
|
|
349
|
+
return context ?? env;
|
|
346
350
|
};
|
|
347
351
|
|
|
348
352
|
// src/use-video.ts
|
|
349
|
-
import { useContext as
|
|
353
|
+
import { useContext as useContext5, useMemo as useMemo5 } from "react";
|
|
350
354
|
|
|
351
355
|
// src/CompositionManagerContext.tsx
|
|
352
356
|
import { createContext as createContext5 } from "react";
|
|
@@ -383,7 +387,7 @@ import {
|
|
|
383
387
|
createContext as createContext7,
|
|
384
388
|
createRef,
|
|
385
389
|
useCallback as useCallback3,
|
|
386
|
-
useContext as
|
|
390
|
+
useContext as useContext4,
|
|
387
391
|
useEffect as useEffect2,
|
|
388
392
|
useImperativeHandle as useImperativeHandle2,
|
|
389
393
|
useMemo as useMemo4,
|
|
@@ -391,7 +395,7 @@ import {
|
|
|
391
395
|
} from "react";
|
|
392
396
|
|
|
393
397
|
// src/EditorProps.tsx
|
|
394
|
-
import
|
|
398
|
+
import React5, {
|
|
395
399
|
createContext as createContext6,
|
|
396
400
|
useCallback as useCallback2,
|
|
397
401
|
useImperativeHandle,
|
|
@@ -407,10 +411,10 @@ var EditorPropsContext = createContext6({
|
|
|
407
411
|
throw new Error("Not implemented");
|
|
408
412
|
}
|
|
409
413
|
});
|
|
410
|
-
var editorPropsProviderRef =
|
|
411
|
-
var timeValueRef =
|
|
414
|
+
var editorPropsProviderRef = React5.createRef();
|
|
415
|
+
var timeValueRef = React5.createRef();
|
|
412
416
|
var EditorPropsProvider = ({ children }) => {
|
|
413
|
-
const [props, setProps] =
|
|
417
|
+
const [props, setProps] = React5.useState({});
|
|
414
418
|
const updateProps = useCallback2(({
|
|
415
419
|
defaultProps,
|
|
416
420
|
id,
|
|
@@ -770,14 +774,14 @@ var needsResolution = (composition) => {
|
|
|
770
774
|
var PROPS_UPDATED_EXTERNALLY = "remotion.propsUpdatedExternally";
|
|
771
775
|
var ResolveCompositionConfig = ({ children }) => {
|
|
772
776
|
const [currentRenderModalComposition, setCurrentRenderModalComposition] = useState4(null);
|
|
773
|
-
const { compositions, canvasContent, currentCompositionMetadata } =
|
|
774
|
-
const { fastRefreshes, manualRefreshes } =
|
|
777
|
+
const { compositions, canvasContent, currentCompositionMetadata } = useContext4(CompositionManager);
|
|
778
|
+
const { fastRefreshes, manualRefreshes } = useContext4(NonceContext);
|
|
775
779
|
if (manualRefreshes) {}
|
|
776
780
|
const selectedComposition = useMemo4(() => {
|
|
777
781
|
return compositions.find((c) => canvasContent && canvasContent.type === "composition" && canvasContent.compositionId === c.id);
|
|
778
782
|
}, [canvasContent, compositions]);
|
|
779
783
|
const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
|
|
780
|
-
const { props: allEditorProps } =
|
|
784
|
+
const { props: allEditorProps } = useContext4(EditorPropsContext);
|
|
781
785
|
const env = useRemotionEnvironment();
|
|
782
786
|
const inputProps = useMemo4(() => {
|
|
783
787
|
return typeof window === "undefined" || env.isPlayer ? {} : getInputProps() ?? {};
|
|
@@ -1021,9 +1025,9 @@ var ResolveCompositionConfig = ({ children }) => {
|
|
|
1021
1025
|
});
|
|
1022
1026
|
};
|
|
1023
1027
|
var useResolvedVideoConfig = (preferredCompositionId) => {
|
|
1024
|
-
const context =
|
|
1025
|
-
const { props: allEditorProps } =
|
|
1026
|
-
const { compositions, canvasContent, currentCompositionMetadata } =
|
|
1028
|
+
const context = useContext4(ResolveCompositionContext);
|
|
1029
|
+
const { props: allEditorProps } = useContext4(EditorPropsContext);
|
|
1030
|
+
const { compositions, canvasContent, currentCompositionMetadata } = useContext4(CompositionManager);
|
|
1027
1031
|
const currentComposition = canvasContent?.type === "composition" ? canvasContent.compositionId : null;
|
|
1028
1032
|
const compositionId = preferredCompositionId ?? currentComposition;
|
|
1029
1033
|
const composition = compositions.find((c) => c.id === compositionId);
|
|
@@ -1089,7 +1093,7 @@ var useResolvedVideoConfig = (preferredCompositionId) => {
|
|
|
1089
1093
|
|
|
1090
1094
|
// src/use-video.ts
|
|
1091
1095
|
var useVideo = () => {
|
|
1092
|
-
const { canvasContent, compositions, currentCompositionMetadata } =
|
|
1096
|
+
const { canvasContent, compositions, currentCompositionMetadata } = useContext5(CompositionManager);
|
|
1093
1097
|
const selected = compositions.find((c) => {
|
|
1094
1098
|
return canvasContent?.type === "composition" && c.id === canvasContent.compositionId;
|
|
1095
1099
|
});
|
|
@@ -1163,7 +1167,7 @@ var getFrameForComposition = (composition) => {
|
|
|
1163
1167
|
};
|
|
1164
1168
|
var useTimelinePosition = () => {
|
|
1165
1169
|
const videoConfig = useVideo();
|
|
1166
|
-
const state =
|
|
1170
|
+
const state = useContext6(TimelineContext);
|
|
1167
1171
|
const env = useRemotionEnvironment();
|
|
1168
1172
|
if (!videoConfig) {
|
|
1169
1173
|
return typeof window === "undefined" ? 0 : window.remotion_initialFrame ?? 0;
|
|
@@ -1172,17 +1176,17 @@ var useTimelinePosition = () => {
|
|
|
1172
1176
|
return Math.min(videoConfig.durationInFrames - 1, unclamped);
|
|
1173
1177
|
};
|
|
1174
1178
|
var useTimelineSetFrame = () => {
|
|
1175
|
-
const { setFrame } =
|
|
1179
|
+
const { setFrame } = useContext6(SetTimelineContext);
|
|
1176
1180
|
return setFrame;
|
|
1177
1181
|
};
|
|
1178
1182
|
var usePlayingState = () => {
|
|
1179
|
-
const { playing, imperativePlaying } =
|
|
1180
|
-
const { setPlaying } =
|
|
1183
|
+
const { playing, imperativePlaying } = useContext6(TimelineContext);
|
|
1184
|
+
const { setPlaying } = useContext6(SetTimelineContext);
|
|
1181
1185
|
return useMemo6(() => [playing, setPlaying, imperativePlaying], [imperativePlaying, playing, setPlaying]);
|
|
1182
1186
|
};
|
|
1183
1187
|
|
|
1184
1188
|
// src/use-video-config.ts
|
|
1185
|
-
import { useContext as
|
|
1189
|
+
import { useContext as useContext8 } from "react";
|
|
1186
1190
|
|
|
1187
1191
|
// src/CanUseRemotionHooks.tsx
|
|
1188
1192
|
import { createContext as createContext9 } from "react";
|
|
@@ -1196,9 +1200,9 @@ var CanUseRemotionHooksProvider = ({ children }) => {
|
|
|
1196
1200
|
};
|
|
1197
1201
|
|
|
1198
1202
|
// src/use-unsafe-video-config.ts
|
|
1199
|
-
import { useContext as
|
|
1203
|
+
import { useContext as useContext7, useMemo as useMemo7 } from "react";
|
|
1200
1204
|
var useUnsafeVideoConfig = () => {
|
|
1201
|
-
const context =
|
|
1205
|
+
const context = useContext7(SequenceContext);
|
|
1202
1206
|
const ctxWidth = context?.width ?? null;
|
|
1203
1207
|
const ctxHeight = context?.height ?? null;
|
|
1204
1208
|
const ctxDuration = context?.durationInFrames ?? null;
|
|
@@ -1239,7 +1243,7 @@ var useUnsafeVideoConfig = () => {
|
|
|
1239
1243
|
// src/use-video-config.ts
|
|
1240
1244
|
var useVideoConfig = () => {
|
|
1241
1245
|
const videoConfig = useUnsafeVideoConfig();
|
|
1242
|
-
const context =
|
|
1246
|
+
const context = useContext8(CanUseRemotionHooks);
|
|
1243
1247
|
const isPlayer = useIsPlayer();
|
|
1244
1248
|
if (!videoConfig) {
|
|
1245
1249
|
if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
|
|
@@ -1258,12 +1262,12 @@ var useVideoConfig = () => {
|
|
|
1258
1262
|
};
|
|
1259
1263
|
|
|
1260
1264
|
// src/freeze.tsx
|
|
1261
|
-
import { useContext as
|
|
1265
|
+
import { useContext as useContext10, useMemo as useMemo8 } from "react";
|
|
1262
1266
|
|
|
1263
1267
|
// src/use-current-frame.ts
|
|
1264
|
-
import { useContext as
|
|
1268
|
+
import { useContext as useContext9 } from "react";
|
|
1265
1269
|
var useCurrentFrame = () => {
|
|
1266
|
-
const canUseRemotionHooks =
|
|
1270
|
+
const canUseRemotionHooks = useContext9(CanUseRemotionHooks);
|
|
1267
1271
|
const env = useRemotionEnvironment();
|
|
1268
1272
|
if (!canUseRemotionHooks) {
|
|
1269
1273
|
if (env.isPlayer) {
|
|
@@ -1272,7 +1276,7 @@ var useCurrentFrame = () => {
|
|
|
1272
1276
|
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`);
|
|
1273
1277
|
}
|
|
1274
1278
|
const frame = useTimelinePosition();
|
|
1275
|
-
const context =
|
|
1279
|
+
const context = useContext9(SequenceContext);
|
|
1276
1280
|
const contextOffset = context ? context.cumulatedFrom + context.relativeFrom : 0;
|
|
1277
1281
|
return frame - contextOffset;
|
|
1278
1282
|
};
|
|
@@ -1306,8 +1310,8 @@ var Freeze = ({
|
|
|
1306
1310
|
return active(frame);
|
|
1307
1311
|
}
|
|
1308
1312
|
}, [active, frame]);
|
|
1309
|
-
const timelineContext =
|
|
1310
|
-
const sequenceContext =
|
|
1313
|
+
const timelineContext = useContext10(TimelineContext);
|
|
1314
|
+
const sequenceContext = useContext10(SequenceContext);
|
|
1311
1315
|
const relativeFrom = sequenceContext?.relativeFrom ?? 0;
|
|
1312
1316
|
const timelineValue = useMemo8(() => {
|
|
1313
1317
|
if (!isActive) {
|
|
@@ -1348,8 +1352,8 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1348
1352
|
}, ref) => {
|
|
1349
1353
|
const { layout = "absolute-fill" } = other;
|
|
1350
1354
|
const [id] = useState5(() => String(Math.random()));
|
|
1351
|
-
const parentSequence =
|
|
1352
|
-
const { rootId } =
|
|
1355
|
+
const parentSequence = useContext11(SequenceContext);
|
|
1356
|
+
const { rootId } = useContext11(TimelineContext);
|
|
1353
1357
|
const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
|
|
1354
1358
|
const nonce = useNonce();
|
|
1355
1359
|
if (layout !== "absolute-fill" && layout !== "none") {
|
|
@@ -1374,8 +1378,8 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1374
1378
|
const videoConfig = useVideoConfig();
|
|
1375
1379
|
const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
|
|
1376
1380
|
const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
|
|
1377
|
-
const { registerSequence, unregisterSequence } =
|
|
1378
|
-
const { hidden } =
|
|
1381
|
+
const { registerSequence, unregisterSequence } = useContext11(SequenceManager);
|
|
1382
|
+
const { hidden } = useContext11(SequenceVisibilityToggleContext);
|
|
1379
1383
|
const premounting = useMemo9(() => {
|
|
1380
1384
|
return parentSequence?.premounting || Boolean(other._remotionInternalIsPremounting);
|
|
1381
1385
|
}, [other._remotionInternalIsPremounting, parentSequence?.premounting]);
|
|
@@ -1598,6 +1602,9 @@ function cancelRender(err) {
|
|
|
1598
1602
|
throw error;
|
|
1599
1603
|
}
|
|
1600
1604
|
|
|
1605
|
+
// src/use-delay-render.ts
|
|
1606
|
+
import { useCallback as useCallback4 } from "react";
|
|
1607
|
+
|
|
1601
1608
|
// src/log.ts
|
|
1602
1609
|
var logLevels = ["trace", "verbose", "info", "warn", "error"];
|
|
1603
1610
|
var getNumberForLogLevel = (level) => {
|
|
@@ -1717,8 +1724,20 @@ var continueRender = (handle) => {
|
|
|
1717
1724
|
continueRenderInternal(handle, getRemotionEnvironment());
|
|
1718
1725
|
};
|
|
1719
1726
|
|
|
1727
|
+
// src/use-delay-render.ts
|
|
1728
|
+
var useDelayRender = () => {
|
|
1729
|
+
const environment = useRemotionEnvironment();
|
|
1730
|
+
const delayRender2 = useCallback4((label, options) => {
|
|
1731
|
+
return delayRenderInternal(environment, label, options);
|
|
1732
|
+
}, [environment]);
|
|
1733
|
+
const continueRender2 = useCallback4((handle) => {
|
|
1734
|
+
continueRenderInternal(handle, environment);
|
|
1735
|
+
}, [environment]);
|
|
1736
|
+
return { delayRender: delayRender2, continueRender: continueRender2 };
|
|
1737
|
+
};
|
|
1738
|
+
|
|
1720
1739
|
// src/animated-image/canvas.tsx
|
|
1721
|
-
import
|
|
1740
|
+
import React9, { useCallback as useCallback5, useImperativeHandle as useImperativeHandle3, useRef as useRef2 } from "react";
|
|
1722
1741
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1723
1742
|
var calcArgs = (fit, frameSize, canvasSize) => {
|
|
1724
1743
|
switch (fit) {
|
|
@@ -1770,7 +1789,7 @@ var calcArgs = (fit, frameSize, canvasSize) => {
|
|
|
1770
1789
|
};
|
|
1771
1790
|
var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref) => {
|
|
1772
1791
|
const canvasRef = useRef2(null);
|
|
1773
|
-
const draw =
|
|
1792
|
+
const draw = useCallback5((imageData) => {
|
|
1774
1793
|
const canvas = canvasRef.current;
|
|
1775
1794
|
const canvasWidth = width ?? imageData.displayWidth;
|
|
1776
1795
|
const canvasHeight = height ?? imageData.displayHeight;
|
|
@@ -1815,7 +1834,7 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref
|
|
|
1815
1834
|
style
|
|
1816
1835
|
});
|
|
1817
1836
|
};
|
|
1818
|
-
var Canvas =
|
|
1837
|
+
var Canvas = React9.forwardRef(CanvasRefForwardingFunction);
|
|
1819
1838
|
|
|
1820
1839
|
// src/animated-image/decode-image.ts
|
|
1821
1840
|
var CACHE_SIZE = 5;
|
|
@@ -1989,7 +2008,8 @@ var AnimatedImage = forwardRef3(({
|
|
|
1989
2008
|
}, []);
|
|
1990
2009
|
const resolvedSrc = resolveAnimatedImageSource(src);
|
|
1991
2010
|
const [imageDecoder, setImageDecoder] = useState6(null);
|
|
1992
|
-
const
|
|
2011
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
2012
|
+
const [decodeHandle] = useState6(() => delayRender2(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
|
|
1993
2013
|
const frame = useCurrentFrame();
|
|
1994
2014
|
const { fps } = useVideoConfig();
|
|
1995
2015
|
const currentTime = frame / playbackRate / fps;
|
|
@@ -2013,15 +2033,15 @@ var AnimatedImage = forwardRef3(({
|
|
|
2013
2033
|
initialLoopBehavior
|
|
2014
2034
|
}).then((d) => {
|
|
2015
2035
|
setImageDecoder(d);
|
|
2016
|
-
|
|
2036
|
+
continueRender2(decodeHandle);
|
|
2017
2037
|
}).catch((err) => {
|
|
2018
2038
|
if (err.name === "AbortError") {
|
|
2019
|
-
|
|
2039
|
+
continueRender2(decodeHandle);
|
|
2020
2040
|
return;
|
|
2021
2041
|
}
|
|
2022
2042
|
if (onError) {
|
|
2023
2043
|
onError?.(err);
|
|
2024
|
-
|
|
2044
|
+
continueRender2(decodeHandle);
|
|
2025
2045
|
} else {
|
|
2026
2046
|
cancelRender(err);
|
|
2027
2047
|
}
|
|
@@ -2029,12 +2049,18 @@ var AnimatedImage = forwardRef3(({
|
|
|
2029
2049
|
return () => {
|
|
2030
2050
|
controller.abort();
|
|
2031
2051
|
};
|
|
2032
|
-
}, [
|
|
2052
|
+
}, [
|
|
2053
|
+
resolvedSrc,
|
|
2054
|
+
decodeHandle,
|
|
2055
|
+
onError,
|
|
2056
|
+
initialLoopBehavior,
|
|
2057
|
+
continueRender2
|
|
2058
|
+
]);
|
|
2033
2059
|
useLayoutEffect(() => {
|
|
2034
2060
|
if (!imageDecoder) {
|
|
2035
2061
|
return;
|
|
2036
2062
|
}
|
|
2037
|
-
const delay =
|
|
2063
|
+
const delay = delayRender2(`Rendering frame at ${currentTime} of <AnimatedImage src="${src}"/>`);
|
|
2038
2064
|
imageDecoder.getFrame(currentTime, loopBehavior).then((videoFrame) => {
|
|
2039
2065
|
if (mountState.current.isMounted) {
|
|
2040
2066
|
if (videoFrame === null) {
|
|
@@ -2043,16 +2069,24 @@ var AnimatedImage = forwardRef3(({
|
|
|
2043
2069
|
ref.current?.draw(videoFrame.frame);
|
|
2044
2070
|
}
|
|
2045
2071
|
}
|
|
2046
|
-
|
|
2072
|
+
continueRender2(delay);
|
|
2047
2073
|
}).catch((err) => {
|
|
2048
2074
|
if (onError) {
|
|
2049
2075
|
onError(err);
|
|
2050
|
-
|
|
2076
|
+
continueRender2(delay);
|
|
2051
2077
|
} else {
|
|
2052
2078
|
cancelRender(err);
|
|
2053
2079
|
}
|
|
2054
2080
|
});
|
|
2055
|
-
}, [
|
|
2081
|
+
}, [
|
|
2082
|
+
currentTime,
|
|
2083
|
+
imageDecoder,
|
|
2084
|
+
loopBehavior,
|
|
2085
|
+
onError,
|
|
2086
|
+
src,
|
|
2087
|
+
continueRender2,
|
|
2088
|
+
delayRender2
|
|
2089
|
+
]);
|
|
2056
2090
|
return /* @__PURE__ */ jsx10(Canvas, {
|
|
2057
2091
|
ref,
|
|
2058
2092
|
width,
|
|
@@ -2062,12 +2096,12 @@ var AnimatedImage = forwardRef3(({
|
|
|
2062
2096
|
});
|
|
2063
2097
|
});
|
|
2064
2098
|
// src/Artifact.tsx
|
|
2065
|
-
import { useContext as
|
|
2099
|
+
import { useContext as useContext12, useEffect as useEffect5, useState as useState8 } from "react";
|
|
2066
2100
|
|
|
2067
2101
|
// src/RenderAssetManager.tsx
|
|
2068
2102
|
import {
|
|
2069
2103
|
createContext as createContext10,
|
|
2070
|
-
useCallback as
|
|
2104
|
+
useCallback as useCallback6,
|
|
2071
2105
|
useLayoutEffect as useLayoutEffect2,
|
|
2072
2106
|
useMemo as useMemo10,
|
|
2073
2107
|
useState as useState7
|
|
@@ -2117,13 +2151,13 @@ var RenderAssetManager = createContext10({
|
|
|
2117
2151
|
});
|
|
2118
2152
|
var RenderAssetManagerProvider = ({ children }) => {
|
|
2119
2153
|
const [renderAssets, setRenderAssets] = useState7([]);
|
|
2120
|
-
const registerRenderAsset =
|
|
2154
|
+
const registerRenderAsset = useCallback6((renderAsset) => {
|
|
2121
2155
|
validateRenderAsset(renderAsset);
|
|
2122
2156
|
setRenderAssets((assets) => {
|
|
2123
2157
|
return [...assets, renderAsset];
|
|
2124
2158
|
});
|
|
2125
2159
|
}, []);
|
|
2126
|
-
const unregisterRenderAsset =
|
|
2160
|
+
const unregisterRenderAsset = useCallback6((id) => {
|
|
2127
2161
|
setRenderAssets((assts) => {
|
|
2128
2162
|
return assts.filter((a) => a.id !== id);
|
|
2129
2163
|
});
|
|
@@ -2152,7 +2186,7 @@ var RenderAssetManagerProvider = ({ children }) => {
|
|
|
2152
2186
|
// src/Artifact.tsx
|
|
2153
2187
|
var ArtifactThumbnail = Symbol("Thumbnail");
|
|
2154
2188
|
var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
2155
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
2189
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext12(RenderAssetManager);
|
|
2156
2190
|
const env = useRemotionEnvironment();
|
|
2157
2191
|
const frame = useCurrentFrame();
|
|
2158
2192
|
const [id] = useState8(() => {
|
|
@@ -2209,7 +2243,7 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
|
2209
2243
|
};
|
|
2210
2244
|
Artifact.Thumbnail = ArtifactThumbnail;
|
|
2211
2245
|
// src/audio/Audio.tsx
|
|
2212
|
-
import { forwardRef as forwardRef6, useCallback as
|
|
2246
|
+
import { forwardRef as forwardRef6, useCallback as useCallback11, useContext as useContext25 } from "react";
|
|
2213
2247
|
|
|
2214
2248
|
// src/absolute-src.ts
|
|
2215
2249
|
var getAbsoluteSrc = (relativeSrc) => {
|
|
@@ -2241,11 +2275,11 @@ var calculateLoopDuration = ({
|
|
|
2241
2275
|
};
|
|
2242
2276
|
|
|
2243
2277
|
// src/loop/index.tsx
|
|
2244
|
-
import
|
|
2278
|
+
import React10, { createContext as createContext11, useMemo as useMemo11 } from "react";
|
|
2245
2279
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2246
2280
|
var LoopContext = createContext11(null);
|
|
2247
2281
|
var useLoop = () => {
|
|
2248
|
-
return
|
|
2282
|
+
return React10.useContext(LoopContext);
|
|
2249
2283
|
};
|
|
2250
2284
|
var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) => {
|
|
2251
2285
|
const currentFrame = useCurrentFrame();
|
|
@@ -2299,7 +2333,7 @@ var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) =>
|
|
|
2299
2333
|
Loop.useLoop = useLoop;
|
|
2300
2334
|
|
|
2301
2335
|
// src/prefetch.ts
|
|
2302
|
-
import { useContext as
|
|
2336
|
+
import { useContext as useContext13 } from "react";
|
|
2303
2337
|
|
|
2304
2338
|
// src/playback-logging.ts
|
|
2305
2339
|
var playbackLogging = ({
|
|
@@ -2355,7 +2389,7 @@ var getSrcWithoutHash = (src) => {
|
|
|
2355
2389
|
return src.slice(0, hashIndex);
|
|
2356
2390
|
};
|
|
2357
2391
|
var usePreload = (src) => {
|
|
2358
|
-
const preloads2 =
|
|
2392
|
+
const preloads2 = useContext13(PreloadContext);
|
|
2359
2393
|
const hashFragmentIndex = removeAndGetHashFragment(src);
|
|
2360
2394
|
const withoutHashFragment = getSrcWithoutHash(src);
|
|
2361
2395
|
if (!preloads2[withoutHashFragment]) {
|
|
@@ -2669,7 +2703,7 @@ var DurationsContextProvider = ({ children }) => {
|
|
|
2669
2703
|
// src/audio/AudioForPreview.tsx
|
|
2670
2704
|
import {
|
|
2671
2705
|
forwardRef as forwardRef4,
|
|
2672
|
-
useContext as
|
|
2706
|
+
useContext as useContext23,
|
|
2673
2707
|
useEffect as useEffect13,
|
|
2674
2708
|
useImperativeHandle as useImperativeHandle5,
|
|
2675
2709
|
useMemo as useMemo20,
|
|
@@ -2693,20 +2727,20 @@ var getCrossOriginValue = ({
|
|
|
2693
2727
|
|
|
2694
2728
|
// src/log-level-context.tsx
|
|
2695
2729
|
import { createContext as createContext14 } from "react";
|
|
2696
|
-
import * as
|
|
2730
|
+
import * as React13 from "react";
|
|
2697
2731
|
var LogLevelContext = createContext14({
|
|
2698
2732
|
logLevel: "info",
|
|
2699
2733
|
mountTime: 0
|
|
2700
2734
|
});
|
|
2701
2735
|
var useLogLevel = () => {
|
|
2702
|
-
const { logLevel } =
|
|
2736
|
+
const { logLevel } = React13.useContext(LogLevelContext);
|
|
2703
2737
|
if (logLevel === null) {
|
|
2704
2738
|
throw new Error("useLogLevel must be used within a LogLevelProvider");
|
|
2705
2739
|
}
|
|
2706
2740
|
return logLevel;
|
|
2707
2741
|
};
|
|
2708
2742
|
var useMountTime = () => {
|
|
2709
|
-
const { mountTime } =
|
|
2743
|
+
const { mountTime } = React13.useContext(LogLevelContext);
|
|
2710
2744
|
if (mountTime === null) {
|
|
2711
2745
|
throw new Error("useMountTime must be used within a LogLevelProvider");
|
|
2712
2746
|
}
|
|
@@ -2748,14 +2782,14 @@ var random = (seed, dummy) => {
|
|
|
2748
2782
|
};
|
|
2749
2783
|
|
|
2750
2784
|
// src/use-amplification.ts
|
|
2751
|
-
import { useContext as
|
|
2785
|
+
import { useContext as useContext16, useLayoutEffect as useLayoutEffect3, useRef as useRef6 } from "react";
|
|
2752
2786
|
|
|
2753
2787
|
// src/audio/shared-audio-tags.tsx
|
|
2754
|
-
import
|
|
2788
|
+
import React14, {
|
|
2755
2789
|
createContext as createContext15,
|
|
2756
2790
|
createRef as createRef2,
|
|
2757
|
-
useCallback as
|
|
2758
|
-
useContext as
|
|
2791
|
+
useCallback as useCallback7,
|
|
2792
|
+
useContext as useContext15,
|
|
2759
2793
|
useEffect as useEffect7,
|
|
2760
2794
|
useMemo as useMemo14,
|
|
2761
2795
|
useRef as useRef4,
|
|
@@ -2922,7 +2956,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
2922
2956
|
});
|
|
2923
2957
|
}, [audioContext, numberOfAudioTags]);
|
|
2924
2958
|
const takenAudios = useRef4(new Array(numberOfAudioTags).fill(false));
|
|
2925
|
-
const rerenderAudios =
|
|
2959
|
+
const rerenderAudios = useCallback7(() => {
|
|
2926
2960
|
refs.forEach(({ ref, id }) => {
|
|
2927
2961
|
const data = audios.current?.find((a) => a.id === id);
|
|
2928
2962
|
const { current } = ref;
|
|
@@ -2943,7 +2977,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
2943
2977
|
});
|
|
2944
2978
|
});
|
|
2945
2979
|
}, [refs]);
|
|
2946
|
-
const registerAudio =
|
|
2980
|
+
const registerAudio = useCallback7((options) => {
|
|
2947
2981
|
const { aud, audioId, premounting } = options;
|
|
2948
2982
|
const found = audios.current?.find((a) => a.audioId === audioId);
|
|
2949
2983
|
if (found) {
|
|
@@ -2969,7 +3003,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
2969
3003
|
rerenderAudios();
|
|
2970
3004
|
return newElem;
|
|
2971
3005
|
}, [numberOfAudioTags, refs, rerenderAudios]);
|
|
2972
|
-
const unregisterAudio =
|
|
3006
|
+
const unregisterAudio = useCallback7((id) => {
|
|
2973
3007
|
const cloned = [...takenAudios.current];
|
|
2974
3008
|
const index = refs.findIndex((r) => r.id === id);
|
|
2975
3009
|
if (index === -1) {
|
|
@@ -2980,7 +3014,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
2980
3014
|
audios.current = audios.current?.filter((a) => a.id !== id);
|
|
2981
3015
|
rerenderAudios();
|
|
2982
3016
|
}, [refs, rerenderAudios]);
|
|
2983
|
-
const updateAudio =
|
|
3017
|
+
const updateAudio = useCallback7(({
|
|
2984
3018
|
aud,
|
|
2985
3019
|
audioId,
|
|
2986
3020
|
id,
|
|
@@ -3009,7 +3043,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
3009
3043
|
}, [rerenderAudios]);
|
|
3010
3044
|
const mountTime = useMountTime();
|
|
3011
3045
|
const env = useRemotionEnvironment();
|
|
3012
|
-
const playAllAudios =
|
|
3046
|
+
const playAllAudios = useCallback7(() => {
|
|
3013
3047
|
refs.forEach((ref) => {
|
|
3014
3048
|
const audio = audios.current.find((a) => a.el === ref.ref);
|
|
3015
3049
|
if (audio?.premounting) {
|
|
@@ -3044,7 +3078,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, component, audi
|
|
|
3044
3078
|
updateAudio,
|
|
3045
3079
|
audioContext
|
|
3046
3080
|
]);
|
|
3047
|
-
const resetAudio =
|
|
3081
|
+
const resetAudio = useCallback7(() => {
|
|
3048
3082
|
takenAudios.current = new Array(numberOfAudioTags).fill(false);
|
|
3049
3083
|
audios.current = [];
|
|
3050
3084
|
rerenderAudios();
|
|
@@ -3073,12 +3107,12 @@ var useSharedAudio = ({
|
|
|
3073
3107
|
audioId,
|
|
3074
3108
|
premounting
|
|
3075
3109
|
}) => {
|
|
3076
|
-
const ctx =
|
|
3110
|
+
const ctx = useContext15(SharedAudioContext);
|
|
3077
3111
|
const [elem] = useState10(() => {
|
|
3078
3112
|
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
3079
3113
|
return ctx.registerAudio({ aud, audioId, premounting });
|
|
3080
3114
|
}
|
|
3081
|
-
const el =
|
|
3115
|
+
const el = React14.createRef();
|
|
3082
3116
|
const mediaElementSourceNode = ctx?.audioContext ? makeSharedElementSourceNode({
|
|
3083
3117
|
audioContext: ctx.audioContext,
|
|
3084
3118
|
ref: el
|
|
@@ -3092,7 +3126,7 @@ var useSharedAudio = ({
|
|
|
3092
3126
|
premounting
|
|
3093
3127
|
};
|
|
3094
3128
|
});
|
|
3095
|
-
const effectToUse =
|
|
3129
|
+
const effectToUse = React14.useInsertionEffect ?? React14.useLayoutEffect;
|
|
3096
3130
|
if (typeof document !== "undefined") {
|
|
3097
3131
|
effectToUse(() => {
|
|
3098
3132
|
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
@@ -3248,7 +3282,7 @@ var useVolume = ({
|
|
|
3248
3282
|
const audioStuffRef = useRef6(null);
|
|
3249
3283
|
const currentVolumeRef = useRef6(volume);
|
|
3250
3284
|
currentVolumeRef.current = volume;
|
|
3251
|
-
const sharedAudioContext =
|
|
3285
|
+
const sharedAudioContext = useContext16(SharedAudioContext);
|
|
3252
3286
|
if (!sharedAudioContext) {
|
|
3253
3287
|
throw new Error("useAmplification must be used within a SharedAudioContext");
|
|
3254
3288
|
}
|
|
@@ -3304,12 +3338,12 @@ var useVolume = ({
|
|
|
3304
3338
|
};
|
|
3305
3339
|
|
|
3306
3340
|
// src/use-media-in-timeline.ts
|
|
3307
|
-
import { useContext as
|
|
3341
|
+
import { useContext as useContext18, useEffect as useEffect8, useMemo as useMemo15, useState as useState11 } from "react";
|
|
3308
3342
|
|
|
3309
3343
|
// src/audio/use-audio-frame.ts
|
|
3310
|
-
import { useContext as
|
|
3344
|
+
import { useContext as useContext17 } from "react";
|
|
3311
3345
|
var useMediaStartsAt = () => {
|
|
3312
|
-
const parentSequence =
|
|
3346
|
+
const parentSequence = useContext17(SequenceContext);
|
|
3313
3347
|
const startsAt = Math.min(0, parentSequence?.relativeFrom ?? 0);
|
|
3314
3348
|
return startsAt;
|
|
3315
3349
|
};
|
|
@@ -3384,12 +3418,12 @@ var useMediaInTimeline = ({
|
|
|
3384
3418
|
isPostmounting
|
|
3385
3419
|
}) => {
|
|
3386
3420
|
const videoConfig = useVideoConfig();
|
|
3387
|
-
const { rootId, audioAndVideoTags } =
|
|
3388
|
-
const parentSequence =
|
|
3421
|
+
const { rootId, audioAndVideoTags } = useContext18(TimelineContext);
|
|
3422
|
+
const parentSequence = useContext18(SequenceContext);
|
|
3389
3423
|
const actualFrom = parentSequence ? parentSequence.relativeFrom + parentSequence.cumulatedFrom : 0;
|
|
3390
|
-
const { imperativePlaying } =
|
|
3424
|
+
const { imperativePlaying } = useContext18(TimelineContext);
|
|
3391
3425
|
const startsAt = useMediaStartsAt();
|
|
3392
|
-
const { registerSequence, unregisterSequence } =
|
|
3426
|
+
const { registerSequence, unregisterSequence } = useContext18(SequenceManager);
|
|
3393
3427
|
const [initialVolume] = useState11(() => volume);
|
|
3394
3428
|
const logLevel = useLogLevel();
|
|
3395
3429
|
const mountTime = useMountTime();
|
|
@@ -3516,23 +3550,23 @@ var useMediaInTimeline = ({
|
|
|
3516
3550
|
|
|
3517
3551
|
// src/use-media-playback.ts
|
|
3518
3552
|
import {
|
|
3519
|
-
useCallback as
|
|
3520
|
-
useContext as
|
|
3553
|
+
useCallback as useCallback10,
|
|
3554
|
+
useContext as useContext21,
|
|
3521
3555
|
useEffect as useEffect12,
|
|
3522
3556
|
useLayoutEffect as useLayoutEffect5,
|
|
3523
3557
|
useRef as useRef10
|
|
3524
3558
|
} from "react";
|
|
3525
3559
|
|
|
3526
3560
|
// src/buffer-until-first-frame.ts
|
|
3527
|
-
import { useCallback as
|
|
3561
|
+
import { useCallback as useCallback9, useMemo as useMemo18, useRef as useRef8 } from "react";
|
|
3528
3562
|
|
|
3529
3563
|
// src/use-buffer-state.ts
|
|
3530
|
-
import { useContext as
|
|
3564
|
+
import { useContext as useContext20, useMemo as useMemo17 } from "react";
|
|
3531
3565
|
|
|
3532
3566
|
// src/buffering.tsx
|
|
3533
|
-
import
|
|
3534
|
-
useCallback as
|
|
3535
|
-
useContext as
|
|
3567
|
+
import React15, {
|
|
3568
|
+
useCallback as useCallback8,
|
|
3569
|
+
useContext as useContext19,
|
|
3536
3570
|
useEffect as useEffect9,
|
|
3537
3571
|
useLayoutEffect as useLayoutEffect4,
|
|
3538
3572
|
useMemo as useMemo16,
|
|
@@ -3545,7 +3579,7 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3545
3579
|
const [onBufferingCallbacks, setOnBufferingCallbacks] = useState12([]);
|
|
3546
3580
|
const [onResumeCallbacks, setOnResumeCallbacks] = useState12([]);
|
|
3547
3581
|
const buffering = useRef7(false);
|
|
3548
|
-
const addBlock =
|
|
3582
|
+
const addBlock = useCallback8((block) => {
|
|
3549
3583
|
setBlocks((b) => [...b, block]);
|
|
3550
3584
|
return {
|
|
3551
3585
|
unblock: () => {
|
|
@@ -3559,7 +3593,7 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3559
3593
|
}
|
|
3560
3594
|
};
|
|
3561
3595
|
}, []);
|
|
3562
|
-
const listenForBuffering =
|
|
3596
|
+
const listenForBuffering = useCallback8((callback) => {
|
|
3563
3597
|
setOnBufferingCallbacks((c) => [...c, callback]);
|
|
3564
3598
|
return {
|
|
3565
3599
|
remove: () => {
|
|
@@ -3567,7 +3601,7 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3567
3601
|
}
|
|
3568
3602
|
};
|
|
3569
3603
|
}, []);
|
|
3570
|
-
const listenForResume =
|
|
3604
|
+
const listenForResume = useCallback8((callback) => {
|
|
3571
3605
|
setOnResumeCallbacks((c) => [...c, callback]);
|
|
3572
3606
|
return {
|
|
3573
3607
|
remove: () => {
|
|
@@ -3603,9 +3637,9 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3603
3637
|
return { addBlock, listenForBuffering, listenForResume, buffering };
|
|
3604
3638
|
}, [addBlock, buffering, listenForBuffering, listenForResume]);
|
|
3605
3639
|
};
|
|
3606
|
-
var BufferingContextReact =
|
|
3640
|
+
var BufferingContextReact = React15.createContext(null);
|
|
3607
3641
|
var BufferingProvider = ({ children }) => {
|
|
3608
|
-
const { logLevel, mountTime } =
|
|
3642
|
+
const { logLevel, mountTime } = useContext19(LogLevelContext);
|
|
3609
3643
|
const bufferManager = useBufferManager(logLevel ?? "info", mountTime);
|
|
3610
3644
|
return /* @__PURE__ */ jsx16(BufferingContextReact.Provider, {
|
|
3611
3645
|
value: bufferManager,
|
|
@@ -3637,7 +3671,7 @@ var useIsPlayerBuffering = (bufferManager) => {
|
|
|
3637
3671
|
|
|
3638
3672
|
// src/use-buffer-state.ts
|
|
3639
3673
|
var useBufferState = () => {
|
|
3640
|
-
const buffer =
|
|
3674
|
+
const buffer = useContext20(BufferingContextReact);
|
|
3641
3675
|
const addBlock = buffer ? buffer.addBlock : null;
|
|
3642
3676
|
return useMemo17(() => ({
|
|
3643
3677
|
delayPlayback: () => {
|
|
@@ -3667,7 +3701,7 @@ var useBufferUntilFirstFrame = ({
|
|
|
3667
3701
|
}) => {
|
|
3668
3702
|
const bufferingRef = useRef8(false);
|
|
3669
3703
|
const { delayPlayback } = useBufferState();
|
|
3670
|
-
const bufferUntilFirstFrame =
|
|
3704
|
+
const bufferUntilFirstFrame = useCallback9((requestedTime) => {
|
|
3671
3705
|
if (mediaType !== "video") {
|
|
3672
3706
|
return;
|
|
3673
3707
|
}
|
|
@@ -3747,9 +3781,9 @@ var useBufferUntilFirstFrame = ({
|
|
|
3747
3781
|
};
|
|
3748
3782
|
|
|
3749
3783
|
// src/media-tag-current-time-timestamp.ts
|
|
3750
|
-
import
|
|
3784
|
+
import React16 from "react";
|
|
3751
3785
|
var useCurrentTimeOfMediaTagWithUpdateTimeStamp = (mediaRef) => {
|
|
3752
|
-
const lastUpdate =
|
|
3786
|
+
const lastUpdate = React16.useRef({
|
|
3753
3787
|
time: mediaRef.current?.currentTime ?? 0,
|
|
3754
3788
|
lastUpdate: performance.now()
|
|
3755
3789
|
});
|
|
@@ -4159,11 +4193,11 @@ var useMediaPlayback = ({
|
|
|
4159
4193
|
isPostmounting,
|
|
4160
4194
|
onAutoPlayError
|
|
4161
4195
|
}) => {
|
|
4162
|
-
const { playbackRate: globalPlaybackRate } =
|
|
4196
|
+
const { playbackRate: globalPlaybackRate } = useContext21(TimelineContext);
|
|
4163
4197
|
const frame = useCurrentFrame();
|
|
4164
4198
|
const absoluteFrame = useTimelinePosition();
|
|
4165
4199
|
const [playing] = usePlayingState();
|
|
4166
|
-
const buffering =
|
|
4200
|
+
const buffering = useContext21(BufferingContextReact);
|
|
4167
4201
|
const { fps } = useVideoConfig();
|
|
4168
4202
|
const mediaStartsAt = useMediaStartsAt();
|
|
4169
4203
|
const lastSeekDueToShift = useRef10(null);
|
|
@@ -4174,7 +4208,7 @@ var useMediaPlayback = ({
|
|
|
4174
4208
|
throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
|
|
4175
4209
|
}
|
|
4176
4210
|
const isVariableFpsVideoMap = useRef10({});
|
|
4177
|
-
const onVariableFpsVideoDetected =
|
|
4211
|
+
const onVariableFpsVideoDetected = useCallback10(() => {
|
|
4178
4212
|
if (!src) {
|
|
4179
4213
|
return;
|
|
4180
4214
|
}
|
|
@@ -4389,7 +4423,7 @@ var useMediaPlayback = ({
|
|
|
4389
4423
|
};
|
|
4390
4424
|
|
|
4391
4425
|
// src/volume-position-state.ts
|
|
4392
|
-
import { createContext as createContext16, useContext as
|
|
4426
|
+
import { createContext as createContext16, useContext as useContext22, useMemo as useMemo19 } from "react";
|
|
4393
4427
|
var MediaVolumeContext = createContext16({
|
|
4394
4428
|
mediaMuted: false,
|
|
4395
4429
|
mediaVolume: 1
|
|
@@ -4403,15 +4437,15 @@ var SetMediaVolumeContext = createContext16({
|
|
|
4403
4437
|
}
|
|
4404
4438
|
});
|
|
4405
4439
|
var useMediaVolumeState = () => {
|
|
4406
|
-
const { mediaVolume } =
|
|
4407
|
-
const { setMediaVolume } =
|
|
4440
|
+
const { mediaVolume } = useContext22(MediaVolumeContext);
|
|
4441
|
+
const { setMediaVolume } = useContext22(SetMediaVolumeContext);
|
|
4408
4442
|
return useMemo19(() => {
|
|
4409
4443
|
return [mediaVolume, setMediaVolume];
|
|
4410
4444
|
}, [mediaVolume, setMediaVolume]);
|
|
4411
4445
|
};
|
|
4412
4446
|
var useMediaMutedState = () => {
|
|
4413
|
-
const { mediaMuted } =
|
|
4414
|
-
const { setMediaMuted } =
|
|
4447
|
+
const { mediaMuted } = useContext22(MediaVolumeContext);
|
|
4448
|
+
const { setMediaMuted } = useContext22(SetMediaVolumeContext);
|
|
4415
4449
|
return useMemo19(() => {
|
|
4416
4450
|
return [mediaMuted, setMediaMuted];
|
|
4417
4451
|
}, [mediaMuted, setMediaMuted]);
|
|
@@ -4459,12 +4493,12 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4459
4493
|
const [mediaVolume] = useMediaVolumeState();
|
|
4460
4494
|
const [mediaMuted] = useMediaMutedState();
|
|
4461
4495
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
4462
|
-
const { hidden } =
|
|
4496
|
+
const { hidden } = useContext23(SequenceVisibilityToggleContext);
|
|
4463
4497
|
if (!src) {
|
|
4464
4498
|
throw new TypeError("No 'src' was passed to <Audio>.");
|
|
4465
4499
|
}
|
|
4466
4500
|
const preloadedSrc = usePreload(src);
|
|
4467
|
-
const sequenceContext =
|
|
4501
|
+
const sequenceContext = useContext23(SequenceContext);
|
|
4468
4502
|
const [timelineId] = useState14(() => String(Math.random()));
|
|
4469
4503
|
const isSequenceHidden = hidden[timelineId] ?? false;
|
|
4470
4504
|
const userPreferredVolume = evaluateVolume({
|
|
@@ -4502,7 +4536,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4502
4536
|
props.muted,
|
|
4503
4537
|
props.loop
|
|
4504
4538
|
]);
|
|
4505
|
-
const context =
|
|
4539
|
+
const context = useContext23(SharedAudioContext);
|
|
4506
4540
|
if (!context) {
|
|
4507
4541
|
throw new Error("SharedAudioContext not found");
|
|
4508
4542
|
}
|
|
@@ -4584,7 +4618,7 @@ var AudioForPreview = forwardRef4(AudioForDevelopmentForwardRefFunction);
|
|
|
4584
4618
|
// src/audio/AudioForRendering.tsx
|
|
4585
4619
|
import {
|
|
4586
4620
|
forwardRef as forwardRef5,
|
|
4587
|
-
useContext as
|
|
4621
|
+
useContext as useContext24,
|
|
4588
4622
|
useEffect as useEffect14,
|
|
4589
4623
|
useImperativeHandle as useImperativeHandle6,
|
|
4590
4624
|
useLayoutEffect as useLayoutEffect6,
|
|
@@ -4615,8 +4649,9 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4615
4649
|
const absoluteFrame = useTimelinePosition();
|
|
4616
4650
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
4617
4651
|
const frame = useCurrentFrame();
|
|
4618
|
-
const sequenceContext =
|
|
4619
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
4652
|
+
const sequenceContext = useContext24(SequenceContext);
|
|
4653
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext24(RenderAssetManager);
|
|
4654
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
4620
4655
|
const id = useMemo21(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
|
|
4621
4656
|
props.src,
|
|
4622
4657
|
sequenceContext?.relativeFrom,
|
|
@@ -4682,7 +4717,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4682
4717
|
if (!needsToRenderAudioTag) {
|
|
4683
4718
|
return;
|
|
4684
4719
|
}
|
|
4685
|
-
const newHandle =
|
|
4720
|
+
const newHandle = delayRender2("Loading <Audio> duration with src=" + src, {
|
|
4686
4721
|
retries: delayRenderRetries ?? undefined,
|
|
4687
4722
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
4688
4723
|
});
|
|
@@ -4691,24 +4726,26 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4691
4726
|
if (current?.duration) {
|
|
4692
4727
|
onDuration(current.src, current.duration);
|
|
4693
4728
|
}
|
|
4694
|
-
|
|
4729
|
+
continueRender2(newHandle);
|
|
4695
4730
|
};
|
|
4696
4731
|
if (current?.duration) {
|
|
4697
4732
|
onDuration(current.src, current.duration);
|
|
4698
|
-
|
|
4733
|
+
continueRender2(newHandle);
|
|
4699
4734
|
} else {
|
|
4700
4735
|
current?.addEventListener("loadedmetadata", didLoad, { once: true });
|
|
4701
4736
|
}
|
|
4702
4737
|
return () => {
|
|
4703
4738
|
current?.removeEventListener("loadedmetadata", didLoad);
|
|
4704
|
-
|
|
4739
|
+
continueRender2(newHandle);
|
|
4705
4740
|
};
|
|
4706
4741
|
}, [
|
|
4707
4742
|
src,
|
|
4708
4743
|
onDuration,
|
|
4709
4744
|
needsToRenderAudioTag,
|
|
4710
4745
|
delayRenderRetries,
|
|
4711
|
-
delayRenderTimeoutInMilliseconds
|
|
4746
|
+
delayRenderTimeoutInMilliseconds,
|
|
4747
|
+
continueRender2,
|
|
4748
|
+
delayRender2
|
|
4712
4749
|
]);
|
|
4713
4750
|
if (!needsToRenderAudioTag) {
|
|
4714
4751
|
return null;
|
|
@@ -4724,7 +4761,7 @@ var AudioForRendering = forwardRef5(AudioForRenderingRefForwardingFunction);
|
|
|
4724
4761
|
// src/audio/Audio.tsx
|
|
4725
4762
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
4726
4763
|
var AudioRefForwardingFunction = (props, ref) => {
|
|
4727
|
-
const audioContext =
|
|
4764
|
+
const audioContext = useContext25(SharedAudioContext);
|
|
4728
4765
|
const {
|
|
4729
4766
|
startFrom,
|
|
4730
4767
|
endAt,
|
|
@@ -4740,12 +4777,12 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4740
4777
|
const { loop, ...propsOtherThanLoop } = props;
|
|
4741
4778
|
const { fps } = useVideoConfig();
|
|
4742
4779
|
const environment = useRemotionEnvironment();
|
|
4743
|
-
const { durations, setDurations } =
|
|
4780
|
+
const { durations, setDurations } = useContext25(DurationsContext);
|
|
4744
4781
|
if (typeof props.src !== "string") {
|
|
4745
4782
|
throw new TypeError(`The \`<Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
4746
4783
|
}
|
|
4747
4784
|
const preloadedSrc = usePreload(props.src);
|
|
4748
|
-
const onError =
|
|
4785
|
+
const onError = useCallback11((e) => {
|
|
4749
4786
|
console.log(e.currentTarget.error);
|
|
4750
4787
|
const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
|
|
4751
4788
|
if (loop) {
|
|
@@ -4759,7 +4796,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4759
4796
|
console.warn(errMessage);
|
|
4760
4797
|
}
|
|
4761
4798
|
}, [loop, onRemotionError, preloadedSrc]);
|
|
4762
|
-
const onDuration =
|
|
4799
|
+
const onDuration = useCallback11((src, durationInSeconds) => {
|
|
4763
4800
|
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
4764
4801
|
}, [setDurations]);
|
|
4765
4802
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props.src)];
|
|
@@ -4835,11 +4872,11 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4835
4872
|
var Audio = forwardRef6(AudioRefForwardingFunction);
|
|
4836
4873
|
addSequenceStackTraces(Audio);
|
|
4837
4874
|
// src/Composition.tsx
|
|
4838
|
-
import { Suspense, useContext as
|
|
4875
|
+
import { Suspense, useContext as useContext27, useEffect as useEffect16 } from "react";
|
|
4839
4876
|
import { createPortal } from "react-dom";
|
|
4840
4877
|
|
|
4841
4878
|
// src/Folder.tsx
|
|
4842
|
-
import { createContext as createContext17, useContext as
|
|
4879
|
+
import { createContext as createContext17, useContext as useContext26, useEffect as useEffect15, useMemo as useMemo22 } from "react";
|
|
4843
4880
|
|
|
4844
4881
|
// src/validation/validate-folder-name.ts
|
|
4845
4882
|
var getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
|
|
@@ -4864,8 +4901,8 @@ var FolderContext = createContext17({
|
|
|
4864
4901
|
parentName: null
|
|
4865
4902
|
});
|
|
4866
4903
|
var Folder = ({ name, children }) => {
|
|
4867
|
-
const parent =
|
|
4868
|
-
const { registerFolder, unregisterFolder } =
|
|
4904
|
+
const parent = useContext26(FolderContext);
|
|
4905
|
+
const { registerFolder, unregisterFolder } = useContext26(CompositionSetters);
|
|
4869
4906
|
validateFolderName(name);
|
|
4870
4907
|
const parentNameArr = [parent.parentName, parent.folderName].filter(truthy);
|
|
4871
4908
|
const parentName = parentNameArr.length === 0 ? null : parentNameArr.join("/");
|
|
@@ -4976,7 +5013,7 @@ var portalNode = () => {
|
|
|
4976
5013
|
};
|
|
4977
5014
|
|
|
4978
5015
|
// src/use-lazy-component.ts
|
|
4979
|
-
import
|
|
5016
|
+
import React20, { useMemo as useMemo23 } from "react";
|
|
4980
5017
|
var useLazyComponent = ({
|
|
4981
5018
|
compProps,
|
|
4982
5019
|
componentName,
|
|
@@ -4990,13 +5027,13 @@ var useLazyComponent = ({
|
|
|
4990
5027
|
if (typeof compProps.component === "undefined") {
|
|
4991
5028
|
throw new Error(`A value of \`undefined\` was passed to the \`component\` prop. Check the value you are passing to the <${componentName}/> component.`);
|
|
4992
5029
|
}
|
|
4993
|
-
return
|
|
5030
|
+
return React20.lazy(() => Promise.resolve({ default: compProps.component }));
|
|
4994
5031
|
}
|
|
4995
5032
|
if ("lazyComponent" in compProps && typeof compProps.lazyComponent !== "undefined") {
|
|
4996
5033
|
if (typeof compProps.lazyComponent === "undefined") {
|
|
4997
5034
|
throw new Error(`A value of \`undefined\` was passed to the \`lazyComponent\` prop. Check the value you are passing to the <${componentName}/> component.`);
|
|
4998
5035
|
}
|
|
4999
|
-
return
|
|
5036
|
+
return React20.lazy(compProps.lazyComponent);
|
|
5000
5037
|
}
|
|
5001
5038
|
throw new Error("You must pass either 'component' or 'lazyComponent'");
|
|
5002
5039
|
}, [compProps.component, compProps.lazyComponent]);
|
|
@@ -5029,10 +5066,11 @@ var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
|
5029
5066
|
// src/Composition.tsx
|
|
5030
5067
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5031
5068
|
var Fallback = () => {
|
|
5069
|
+
const { continueRender: continueRender2, delayRender: delayRender2 } = useDelayRender();
|
|
5032
5070
|
useEffect16(() => {
|
|
5033
|
-
const fallback =
|
|
5034
|
-
return () =>
|
|
5035
|
-
}, []);
|
|
5071
|
+
const fallback = delayRender2("Waiting for Root component to unsuspend");
|
|
5072
|
+
return () => continueRender2(fallback);
|
|
5073
|
+
}, [continueRender2, delayRender2]);
|
|
5036
5074
|
return null;
|
|
5037
5075
|
};
|
|
5038
5076
|
var InnerComposition = ({
|
|
@@ -5045,7 +5083,7 @@ var InnerComposition = ({
|
|
|
5045
5083
|
schema,
|
|
5046
5084
|
...compProps
|
|
5047
5085
|
}) => {
|
|
5048
|
-
const compManager =
|
|
5086
|
+
const compManager = useContext27(CompositionSetters);
|
|
5049
5087
|
const { registerComposition, unregisterComposition } = compManager;
|
|
5050
5088
|
const video = useVideo();
|
|
5051
5089
|
const lazy = useLazyComponent({
|
|
@@ -5056,14 +5094,14 @@ var InnerComposition = ({
|
|
|
5056
5094
|
const nonce = useNonce();
|
|
5057
5095
|
const isPlayer = useIsPlayer();
|
|
5058
5096
|
const environment = useRemotionEnvironment();
|
|
5059
|
-
const canUseComposition =
|
|
5097
|
+
const canUseComposition = useContext27(CanUseRemotionHooks);
|
|
5060
5098
|
if (canUseComposition) {
|
|
5061
5099
|
if (isPlayer) {
|
|
5062
5100
|
throw new Error("<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help.");
|
|
5063
5101
|
}
|
|
5064
5102
|
throw new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");
|
|
5065
5103
|
}
|
|
5066
|
-
const { folderName, parentName } =
|
|
5104
|
+
const { folderName, parentName } = useContext27(FolderContext);
|
|
5067
5105
|
useEffect16(() => {
|
|
5068
5106
|
if (!id) {
|
|
5069
5107
|
throw new Error("No id for composition passed.");
|
|
@@ -5142,7 +5180,7 @@ var InnerComposition = ({
|
|
|
5142
5180
|
return null;
|
|
5143
5181
|
};
|
|
5144
5182
|
var Composition = (props2) => {
|
|
5145
|
-
const { onlyRenderComposition } =
|
|
5183
|
+
const { onlyRenderComposition } = useContext27(CompositionSetters);
|
|
5146
5184
|
if (onlyRenderComposition && onlyRenderComposition !== props2.id) {
|
|
5147
5185
|
return null;
|
|
5148
5186
|
}
|
|
@@ -5364,7 +5402,7 @@ var getStaticFiles = () => {
|
|
|
5364
5402
|
return window.remotion_staticFiles;
|
|
5365
5403
|
};
|
|
5366
5404
|
// src/IFrame.tsx
|
|
5367
|
-
import { forwardRef as forwardRef7, useCallback as
|
|
5405
|
+
import { forwardRef as forwardRef7, useCallback as useCallback12, useState as useState15 } from "react";
|
|
5368
5406
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5369
5407
|
var IFrameRefForwarding = ({
|
|
5370
5408
|
onLoad,
|
|
@@ -5373,22 +5411,23 @@ var IFrameRefForwarding = ({
|
|
|
5373
5411
|
delayRenderTimeoutInMilliseconds,
|
|
5374
5412
|
...props2
|
|
5375
5413
|
}, ref) => {
|
|
5376
|
-
const
|
|
5414
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
5415
|
+
const [handle] = useState15(() => delayRender2(`Loading <IFrame> with source ${props2.src}`, {
|
|
5377
5416
|
retries: delayRenderRetries ?? undefined,
|
|
5378
5417
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
5379
5418
|
}));
|
|
5380
|
-
const didLoad =
|
|
5381
|
-
|
|
5419
|
+
const didLoad = useCallback12((e) => {
|
|
5420
|
+
continueRender2(handle);
|
|
5382
5421
|
onLoad?.(e);
|
|
5383
|
-
}, [handle, onLoad]);
|
|
5384
|
-
const didGetError =
|
|
5385
|
-
|
|
5422
|
+
}, [handle, onLoad, continueRender2]);
|
|
5423
|
+
const didGetError = useCallback12((e) => {
|
|
5424
|
+
continueRender2(handle);
|
|
5386
5425
|
if (onError) {
|
|
5387
5426
|
onError(e);
|
|
5388
5427
|
} else {
|
|
5389
5428
|
console.error("Error loading iframe:", e, "Handle the event using the onError() prop to make this message disappear.");
|
|
5390
5429
|
}
|
|
5391
|
-
}, [handle, onError]);
|
|
5430
|
+
}, [handle, onError, continueRender2]);
|
|
5392
5431
|
return /* @__PURE__ */ jsx23("iframe", {
|
|
5393
5432
|
...props2,
|
|
5394
5433
|
ref,
|
|
@@ -5400,8 +5439,8 @@ var IFrame = forwardRef7(IFrameRefForwarding);
|
|
|
5400
5439
|
// src/Img.tsx
|
|
5401
5440
|
import {
|
|
5402
5441
|
forwardRef as forwardRef8,
|
|
5403
|
-
useCallback as
|
|
5404
|
-
useContext as
|
|
5442
|
+
useCallback as useCallback13,
|
|
5443
|
+
useContext as useContext28,
|
|
5405
5444
|
useImperativeHandle as useImperativeHandle7,
|
|
5406
5445
|
useLayoutEffect as useLayoutEffect7,
|
|
5407
5446
|
useRef as useRef13
|
|
@@ -5424,7 +5463,7 @@ var ImgRefForwarding = ({
|
|
|
5424
5463
|
const imageRef = useRef13(null);
|
|
5425
5464
|
const errors = useRef13({});
|
|
5426
5465
|
const { delayPlayback } = useBufferState();
|
|
5427
|
-
const sequenceContext =
|
|
5466
|
+
const sequenceContext = useContext28(SequenceContext);
|
|
5428
5467
|
if (!src) {
|
|
5429
5468
|
throw new Error('No "src" prop was passed to <Img>.');
|
|
5430
5469
|
}
|
|
@@ -5436,7 +5475,7 @@ var ImgRefForwarding = ({
|
|
|
5436
5475
|
return imageRef.current;
|
|
5437
5476
|
}, []);
|
|
5438
5477
|
const actualSrc = usePreload(src);
|
|
5439
|
-
const retryIn =
|
|
5478
|
+
const retryIn = useCallback13((timeout) => {
|
|
5440
5479
|
if (!imageRef.current) {
|
|
5441
5480
|
return;
|
|
5442
5481
|
}
|
|
@@ -5453,7 +5492,7 @@ var ImgRefForwarding = ({
|
|
|
5453
5492
|
imageRef.current.setAttribute("src", newSrc);
|
|
5454
5493
|
}, timeout);
|
|
5455
5494
|
}, []);
|
|
5456
|
-
const didGetError =
|
|
5495
|
+
const didGetError = useCallback13((e) => {
|
|
5457
5496
|
if (!errors.current) {
|
|
5458
5497
|
return;
|
|
5459
5498
|
}
|
|
@@ -5470,6 +5509,7 @@ var ImgRefForwarding = ({
|
|
|
5470
5509
|
}
|
|
5471
5510
|
cancelRender("Error loading image with src: " + imageRef.current?.src);
|
|
5472
5511
|
}, [maxRetries, onError, retryIn]);
|
|
5512
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
5473
5513
|
if (typeof window !== "undefined") {
|
|
5474
5514
|
const isPremounting = Boolean(sequenceContext?.premounting);
|
|
5475
5515
|
const isPostmounting = Boolean(sequenceContext?.postmounting);
|
|
@@ -5484,7 +5524,7 @@ var ImgRefForwarding = ({
|
|
|
5484
5524
|
if (!current) {
|
|
5485
5525
|
return;
|
|
5486
5526
|
}
|
|
5487
|
-
const newHandle =
|
|
5527
|
+
const newHandle = delayRender2("Loading <Img> with src=" + actualSrc, {
|
|
5488
5528
|
retries: delayRenderRetries ?? undefined,
|
|
5489
5529
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
5490
5530
|
});
|
|
@@ -5494,7 +5534,7 @@ var ImgRefForwarding = ({
|
|
|
5494
5534
|
let unmounted = false;
|
|
5495
5535
|
const onComplete = () => {
|
|
5496
5536
|
if (unmounted) {
|
|
5497
|
-
|
|
5537
|
+
continueRender2(newHandle);
|
|
5498
5538
|
return;
|
|
5499
5539
|
}
|
|
5500
5540
|
if ((errors.current[imageRef.current?.src] ?? 0) > 0) {
|
|
@@ -5505,7 +5545,7 @@ var ImgRefForwarding = ({
|
|
|
5505
5545
|
onImageFrame?.(current);
|
|
5506
5546
|
}
|
|
5507
5547
|
unblock();
|
|
5508
|
-
|
|
5548
|
+
continueRender2(newHandle);
|
|
5509
5549
|
};
|
|
5510
5550
|
if (!imageRef.current) {
|
|
5511
5551
|
onComplete();
|
|
@@ -5528,7 +5568,7 @@ var ImgRefForwarding = ({
|
|
|
5528
5568
|
unmounted = true;
|
|
5529
5569
|
current.removeEventListener("load", onComplete);
|
|
5530
5570
|
unblock();
|
|
5531
|
-
|
|
5571
|
+
continueRender2(newHandle);
|
|
5532
5572
|
};
|
|
5533
5573
|
}, [
|
|
5534
5574
|
actualSrc,
|
|
@@ -5538,7 +5578,9 @@ var ImgRefForwarding = ({
|
|
|
5538
5578
|
pauseWhenLoading,
|
|
5539
5579
|
isPremounting,
|
|
5540
5580
|
isPostmounting,
|
|
5541
|
-
onImageFrame
|
|
5581
|
+
onImageFrame,
|
|
5582
|
+
continueRender2,
|
|
5583
|
+
delayRender2
|
|
5542
5584
|
]);
|
|
5543
5585
|
}
|
|
5544
5586
|
const crossOriginValue = getCrossOriginValue({
|
|
@@ -5557,15 +5599,15 @@ var Img = forwardRef8(ImgRefForwarding);
|
|
|
5557
5599
|
import { createRef as createRef3 } from "react";
|
|
5558
5600
|
|
|
5559
5601
|
// src/CompositionManager.tsx
|
|
5560
|
-
import
|
|
5561
|
-
useCallback as
|
|
5602
|
+
import React24, {
|
|
5603
|
+
useCallback as useCallback14,
|
|
5562
5604
|
useImperativeHandle as useImperativeHandle8,
|
|
5563
5605
|
useMemo as useMemo24,
|
|
5564
5606
|
useRef as useRef14,
|
|
5565
5607
|
useState as useState16
|
|
5566
5608
|
} from "react";
|
|
5567
5609
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
5568
|
-
var compositionsRef =
|
|
5610
|
+
var compositionsRef = React24.createRef();
|
|
5569
5611
|
var CompositionManagerProvider = ({
|
|
5570
5612
|
children,
|
|
5571
5613
|
numberOfAudioTags,
|
|
@@ -5577,14 +5619,14 @@ var CompositionManagerProvider = ({
|
|
|
5577
5619
|
const currentcompositionsRef = useRef14(compositions);
|
|
5578
5620
|
const [folders, setFolders] = useState16([]);
|
|
5579
5621
|
const [canvasContent, setCanvasContent] = useState16(null);
|
|
5580
|
-
const updateCompositions =
|
|
5622
|
+
const updateCompositions = useCallback14((updateComps) => {
|
|
5581
5623
|
setCompositions((comps) => {
|
|
5582
5624
|
const updated = updateComps(comps);
|
|
5583
5625
|
currentcompositionsRef.current = updated;
|
|
5584
5626
|
return updated;
|
|
5585
5627
|
});
|
|
5586
5628
|
}, []);
|
|
5587
|
-
const registerComposition =
|
|
5629
|
+
const registerComposition = useCallback14((comp) => {
|
|
5588
5630
|
updateCompositions((comps) => {
|
|
5589
5631
|
if (comps.find((c2) => c2.id === comp.id)) {
|
|
5590
5632
|
throw new Error(`Multiple composition with id ${comp.id} are registered.`);
|
|
@@ -5593,12 +5635,12 @@ var CompositionManagerProvider = ({
|
|
|
5593
5635
|
return value;
|
|
5594
5636
|
});
|
|
5595
5637
|
}, [updateCompositions]);
|
|
5596
|
-
const unregisterComposition =
|
|
5638
|
+
const unregisterComposition = useCallback14((id) => {
|
|
5597
5639
|
setCompositions((comps) => {
|
|
5598
5640
|
return comps.filter((c2) => c2.id !== id);
|
|
5599
5641
|
});
|
|
5600
5642
|
}, []);
|
|
5601
|
-
const registerFolder =
|
|
5643
|
+
const registerFolder = useCallback14((name, parent) => {
|
|
5602
5644
|
setFolders((prevFolders) => {
|
|
5603
5645
|
return [
|
|
5604
5646
|
...prevFolders,
|
|
@@ -5609,7 +5651,7 @@ var CompositionManagerProvider = ({
|
|
|
5609
5651
|
];
|
|
5610
5652
|
});
|
|
5611
5653
|
}, []);
|
|
5612
|
-
const unregisterFolder =
|
|
5654
|
+
const unregisterFolder = useCallback14((name, parent) => {
|
|
5613
5655
|
setFolders((prevFolders) => {
|
|
5614
5656
|
return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
|
|
5615
5657
|
});
|
|
@@ -5620,7 +5662,7 @@ var CompositionManagerProvider = ({
|
|
|
5620
5662
|
};
|
|
5621
5663
|
}, []);
|
|
5622
5664
|
const composition = compositions.find((c2) => canvasContent?.type === "composition" ? c2.id === canvasContent.compositionId : null);
|
|
5623
|
-
const updateCompositionDefaultProps =
|
|
5665
|
+
const updateCompositionDefaultProps = useCallback14((id, newDefaultProps) => {
|
|
5624
5666
|
setCompositions((comps) => {
|
|
5625
5667
|
const updated = comps.map((c2) => {
|
|
5626
5668
|
if (c2.id === id) {
|
|
@@ -5793,11 +5835,12 @@ var RemotionRoot = ({
|
|
|
5793
5835
|
const [manualRefreshes, setManualRefreshes] = useState17(0);
|
|
5794
5836
|
const [playbackRate, setPlaybackRate] = useState17(1);
|
|
5795
5837
|
const audioAndVideoTags = useRef15([]);
|
|
5838
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
5796
5839
|
if (typeof window !== "undefined") {
|
|
5797
5840
|
useLayoutEffect8(() => {
|
|
5798
5841
|
window.remotion_setFrame = (f, composition, attempt) => {
|
|
5799
5842
|
window.remotion_attempt = attempt;
|
|
5800
|
-
const id =
|
|
5843
|
+
const id = delayRender2(`Setting the current frame to ${f}`);
|
|
5801
5844
|
let asyncUpdate = true;
|
|
5802
5845
|
setFrame((s) => {
|
|
5803
5846
|
const currentFrame = s[composition] ?? window.remotion_initialFrame;
|
|
@@ -5811,13 +5854,13 @@ var RemotionRoot = ({
|
|
|
5811
5854
|
};
|
|
5812
5855
|
});
|
|
5813
5856
|
if (asyncUpdate) {
|
|
5814
|
-
requestAnimationFrame(() =>
|
|
5857
|
+
requestAnimationFrame(() => continueRender2(id));
|
|
5815
5858
|
} else {
|
|
5816
|
-
|
|
5859
|
+
continueRender2(id);
|
|
5817
5860
|
}
|
|
5818
5861
|
};
|
|
5819
5862
|
window.remotion_isPlayer = false;
|
|
5820
|
-
}, []);
|
|
5863
|
+
}, [continueRender2, delayRender2]);
|
|
5821
5864
|
}
|
|
5822
5865
|
const timelineContextValue = useMemo25(() => {
|
|
5823
5866
|
return {
|
|
@@ -5925,8 +5968,8 @@ var setupEnvVariables = () => {
|
|
|
5925
5968
|
};
|
|
5926
5969
|
|
|
5927
5970
|
// src/use-current-scale.ts
|
|
5928
|
-
import
|
|
5929
|
-
var CurrentScaleContext =
|
|
5971
|
+
import React26, { createContext as createContext18 } from "react";
|
|
5972
|
+
var CurrentScaleContext = React26.createContext(null);
|
|
5930
5973
|
var PreviewSizeContext = createContext18({
|
|
5931
5974
|
setSize: () => {
|
|
5932
5975
|
return;
|
|
@@ -5951,8 +5994,8 @@ var calculateScale = ({
|
|
|
5951
5994
|
return Number(previewSize);
|
|
5952
5995
|
};
|
|
5953
5996
|
var useCurrentScale = (options) => {
|
|
5954
|
-
const hasContext =
|
|
5955
|
-
const zoomContext =
|
|
5997
|
+
const hasContext = React26.useContext(CurrentScaleContext);
|
|
5998
|
+
const zoomContext = React26.useContext(PreviewSizeContext);
|
|
5956
5999
|
const config = useUnsafeVideoConfig();
|
|
5957
6000
|
const env = useRemotionEnvironment();
|
|
5958
6001
|
if (hasContext === null || config === null || zoomContext === null) {
|
|
@@ -5984,7 +6027,7 @@ var useCurrentScale = (options) => {
|
|
|
5984
6027
|
// src/video/VideoForPreview.tsx
|
|
5985
6028
|
import {
|
|
5986
6029
|
forwardRef as forwardRef9,
|
|
5987
|
-
useContext as
|
|
6030
|
+
useContext as useContext29,
|
|
5988
6031
|
useEffect as useEffect19,
|
|
5989
6032
|
useImperativeHandle as useImperativeHandle9,
|
|
5990
6033
|
useMemo as useMemo26,
|
|
@@ -6024,7 +6067,7 @@ var useEmitVideoFrame = ({
|
|
|
6024
6067
|
// src/video/VideoForPreview.tsx
|
|
6025
6068
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6026
6069
|
var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
6027
|
-
const context =
|
|
6070
|
+
const context = useContext29(SharedAudioContext);
|
|
6028
6071
|
if (!context) {
|
|
6029
6072
|
throw new Error("SharedAudioContext not found");
|
|
6030
6073
|
}
|
|
@@ -6072,8 +6115,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6072
6115
|
}
|
|
6073
6116
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
6074
6117
|
const { fps, durationInFrames } = useVideoConfig();
|
|
6075
|
-
const parentSequence =
|
|
6076
|
-
const { hidden } =
|
|
6118
|
+
const parentSequence = useContext29(SequenceContext);
|
|
6119
|
+
const { hidden } = useContext29(SequenceVisibilityToggleContext);
|
|
6077
6120
|
const logLevel = useLogLevel();
|
|
6078
6121
|
const mountTime = useMountTime();
|
|
6079
6122
|
const [timelineId] = useState18(() => String(Math.random()));
|
|
@@ -6263,21 +6306,21 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
6263
6306
|
};
|
|
6264
6307
|
|
|
6265
6308
|
// src/wrap-remotion-context.tsx
|
|
6266
|
-
import
|
|
6309
|
+
import React28, { useMemo as useMemo27 } from "react";
|
|
6267
6310
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6268
6311
|
function useRemotionContexts() {
|
|
6269
|
-
const compositionManagerCtx =
|
|
6270
|
-
const timelineContext =
|
|
6271
|
-
const setTimelineContext =
|
|
6272
|
-
const sequenceContext =
|
|
6273
|
-
const nonceContext =
|
|
6274
|
-
const canUseRemotionHooksContext =
|
|
6275
|
-
const preloadContext =
|
|
6276
|
-
const resolveCompositionContext =
|
|
6277
|
-
const renderAssetManagerContext =
|
|
6278
|
-
const sequenceManagerContext =
|
|
6279
|
-
const bufferManagerContext =
|
|
6280
|
-
const logLevelContext =
|
|
6312
|
+
const compositionManagerCtx = React28.useContext(CompositionManager);
|
|
6313
|
+
const timelineContext = React28.useContext(TimelineContext);
|
|
6314
|
+
const setTimelineContext = React28.useContext(SetTimelineContext);
|
|
6315
|
+
const sequenceContext = React28.useContext(SequenceContext);
|
|
6316
|
+
const nonceContext = React28.useContext(NonceContext);
|
|
6317
|
+
const canUseRemotionHooksContext = React28.useContext(CanUseRemotionHooks);
|
|
6318
|
+
const preloadContext = React28.useContext(PreloadContext);
|
|
6319
|
+
const resolveCompositionContext = React28.useContext(ResolveCompositionContext);
|
|
6320
|
+
const renderAssetManagerContext = React28.useContext(RenderAssetManager);
|
|
6321
|
+
const sequenceManagerContext = React28.useContext(SequenceManager);
|
|
6322
|
+
const bufferManagerContext = React28.useContext(BufferingContextReact);
|
|
6323
|
+
const logLevelContext = React28.useContext(LogLevelContext);
|
|
6281
6324
|
return useMemo27(() => ({
|
|
6282
6325
|
compositionManagerCtx,
|
|
6283
6326
|
timelineContext,
|
|
@@ -6424,7 +6467,8 @@ var Internals = {
|
|
|
6424
6467
|
useLogLevel,
|
|
6425
6468
|
playbackLogging,
|
|
6426
6469
|
timeValueRef,
|
|
6427
|
-
compositionSelectorRef
|
|
6470
|
+
compositionSelectorRef,
|
|
6471
|
+
RemotionEnvironmentContext
|
|
6428
6472
|
};
|
|
6429
6473
|
// src/interpolate-colors.ts
|
|
6430
6474
|
var NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
@@ -6803,11 +6847,11 @@ var getOffthreadVideoSource = ({
|
|
|
6803
6847
|
import { Children, forwardRef as forwardRef10, useMemo as useMemo28 } from "react";
|
|
6804
6848
|
|
|
6805
6849
|
// src/series/flatten-children.tsx
|
|
6806
|
-
import
|
|
6850
|
+
import React29 from "react";
|
|
6807
6851
|
var flattenChildren = (children) => {
|
|
6808
|
-
const childrenArray =
|
|
6852
|
+
const childrenArray = React29.Children.toArray(children);
|
|
6809
6853
|
return childrenArray.reduce((flatChildren, child) => {
|
|
6810
|
-
if (child.type ===
|
|
6854
|
+
if (child.type === React29.Fragment) {
|
|
6811
6855
|
return flatChildren.concat(flattenChildren(child.props.children));
|
|
6812
6856
|
}
|
|
6813
6857
|
flatChildren.push(child);
|
|
@@ -6816,7 +6860,7 @@ var flattenChildren = (children) => {
|
|
|
6816
6860
|
};
|
|
6817
6861
|
|
|
6818
6862
|
// src/series/is-inside-series.tsx
|
|
6819
|
-
import
|
|
6863
|
+
import React30, { createContext as createContext19 } from "react";
|
|
6820
6864
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6821
6865
|
var IsInsideSeriesContext = createContext19(false);
|
|
6822
6866
|
var IsInsideSeriesContainer = ({ children }) => {
|
|
@@ -6832,7 +6876,7 @@ var IsNotInsideSeriesProvider = ({ children }) => {
|
|
|
6832
6876
|
});
|
|
6833
6877
|
};
|
|
6834
6878
|
var useRequireToBeInsideSeries = () => {
|
|
6835
|
-
const isInsideSeries =
|
|
6879
|
+
const isInsideSeries = React30.useContext(IsInsideSeriesContext);
|
|
6836
6880
|
if (!isInsideSeries) {
|
|
6837
6881
|
throw new Error("This component must be inside a <Series /> component.");
|
|
6838
6882
|
}
|
|
@@ -7247,26 +7291,14 @@ var staticFile = (path) => {
|
|
|
7247
7291
|
return preparsed;
|
|
7248
7292
|
};
|
|
7249
7293
|
// src/Still.tsx
|
|
7250
|
-
import
|
|
7294
|
+
import React32 from "react";
|
|
7251
7295
|
var Still = (props2) => {
|
|
7252
7296
|
const newProps = {
|
|
7253
7297
|
...props2,
|
|
7254
7298
|
durationInFrames: 1,
|
|
7255
7299
|
fps: 1
|
|
7256
7300
|
};
|
|
7257
|
-
return
|
|
7258
|
-
};
|
|
7259
|
-
// src/use-delay-render.ts
|
|
7260
|
-
import { useCallback as useCallback14 } from "react";
|
|
7261
|
-
var useDelayRender = () => {
|
|
7262
|
-
const environment = useRemotionEnvironment();
|
|
7263
|
-
const delayRender2 = useCallback14((label2, options) => {
|
|
7264
|
-
return delayRenderInternal(environment, label2, options);
|
|
7265
|
-
}, [environment]);
|
|
7266
|
-
const continueRender2 = useCallback14((handle) => {
|
|
7267
|
-
continueRenderInternal(handle, environment);
|
|
7268
|
-
}, [environment]);
|
|
7269
|
-
return { delayRender: delayRender2, continueRender: continueRender2 };
|
|
7301
|
+
return React32.createElement(Composition, newProps);
|
|
7270
7302
|
};
|
|
7271
7303
|
// src/video/OffthreadVideo.tsx
|
|
7272
7304
|
import { useCallback as useCallback16 } from "react";
|
|
@@ -7274,7 +7306,7 @@ import { useCallback as useCallback16 } from "react";
|
|
|
7274
7306
|
// src/video/OffthreadVideoForRendering.tsx
|
|
7275
7307
|
import {
|
|
7276
7308
|
useCallback as useCallback15,
|
|
7277
|
-
useContext as
|
|
7309
|
+
useContext as useContext30,
|
|
7278
7310
|
useEffect as useEffect20,
|
|
7279
7311
|
useLayoutEffect as useLayoutEffect9,
|
|
7280
7312
|
useMemo as useMemo29,
|
|
@@ -7304,9 +7336,9 @@ var OffthreadVideoForRendering = ({
|
|
|
7304
7336
|
const frame = useCurrentFrame();
|
|
7305
7337
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
7306
7338
|
const videoConfig = useUnsafeVideoConfig();
|
|
7307
|
-
const sequenceContext =
|
|
7339
|
+
const sequenceContext = useContext30(SequenceContext);
|
|
7308
7340
|
const mediaStartsAt = useMediaStartsAt();
|
|
7309
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
7341
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext30(RenderAssetManager);
|
|
7310
7342
|
if (!src) {
|
|
7311
7343
|
throw new TypeError("No `src` was passed to <OffthreadVideo>.");
|
|
7312
7344
|
}
|
|
@@ -7380,6 +7412,7 @@ var OffthreadVideoForRendering = ({
|
|
|
7380
7412
|
});
|
|
7381
7413
|
}, [toneMapped, currentTime, src, transparent]);
|
|
7382
7414
|
const [imageSrc, setImageSrc] = useState19(null);
|
|
7415
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
7383
7416
|
useLayoutEffect9(() => {
|
|
7384
7417
|
if (!window.remotion_videoEnabled) {
|
|
7385
7418
|
return;
|
|
@@ -7387,7 +7420,7 @@ var OffthreadVideoForRendering = ({
|
|
|
7387
7420
|
const cleanup = [];
|
|
7388
7421
|
setImageSrc(null);
|
|
7389
7422
|
const controller = new AbortController;
|
|
7390
|
-
const newHandle =
|
|
7423
|
+
const newHandle = delayRender2(`Fetching ${actualSrc} from server`, {
|
|
7391
7424
|
retries: delayRenderRetries ?? undefined,
|
|
7392
7425
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
7393
7426
|
});
|
|
@@ -7416,11 +7449,11 @@ var OffthreadVideoForRendering = ({
|
|
|
7416
7449
|
});
|
|
7417
7450
|
} catch (err) {
|
|
7418
7451
|
if (err.message.includes("aborted")) {
|
|
7419
|
-
|
|
7452
|
+
continueRender2(newHandle);
|
|
7420
7453
|
return;
|
|
7421
7454
|
}
|
|
7422
7455
|
if (controller.signal.aborted) {
|
|
7423
|
-
|
|
7456
|
+
continueRender2(newHandle);
|
|
7424
7457
|
return;
|
|
7425
7458
|
}
|
|
7426
7459
|
if (err.message.includes("Failed to fetch")) {
|
|
@@ -7447,7 +7480,9 @@ var OffthreadVideoForRendering = ({
|
|
|
7447
7480
|
actualSrc,
|
|
7448
7481
|
delayRenderRetries,
|
|
7449
7482
|
delayRenderTimeoutInMilliseconds,
|
|
7450
|
-
onError
|
|
7483
|
+
onError,
|
|
7484
|
+
continueRender2,
|
|
7485
|
+
delayRender2
|
|
7451
7486
|
]);
|
|
7452
7487
|
const onErr = useCallback15(() => {
|
|
7453
7488
|
if (onError) {
|
|
@@ -7467,7 +7502,7 @@ var OffthreadVideoForRendering = ({
|
|
|
7467
7502
|
if (!imageSrc || !window.remotion_videoEnabled) {
|
|
7468
7503
|
return null;
|
|
7469
7504
|
}
|
|
7470
|
-
|
|
7505
|
+
continueRender2(imageSrc.handle);
|
|
7471
7506
|
return /* @__PURE__ */ jsx31(Img, {
|
|
7472
7507
|
src: imageSrc.src,
|
|
7473
7508
|
className,
|
|
@@ -7553,12 +7588,12 @@ var OffthreadVideo = (props2) => {
|
|
|
7553
7588
|
});
|
|
7554
7589
|
};
|
|
7555
7590
|
// src/video/Video.tsx
|
|
7556
|
-
import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as
|
|
7591
|
+
import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext32 } from "react";
|
|
7557
7592
|
|
|
7558
7593
|
// src/video/VideoForRendering.tsx
|
|
7559
7594
|
import {
|
|
7560
7595
|
forwardRef as forwardRef11,
|
|
7561
|
-
useContext as
|
|
7596
|
+
useContext as useContext31,
|
|
7562
7597
|
useEffect as useEffect21,
|
|
7563
7598
|
useImperativeHandle as useImperativeHandle10,
|
|
7564
7599
|
useLayoutEffect as useLayoutEffect10,
|
|
@@ -7712,12 +7747,13 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7712
7747
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
7713
7748
|
const videoConfig = useUnsafeVideoConfig();
|
|
7714
7749
|
const videoRef = useRef17(null);
|
|
7715
|
-
const sequenceContext =
|
|
7750
|
+
const sequenceContext = useContext31(SequenceContext);
|
|
7716
7751
|
const mediaStartsAt = useMediaStartsAt();
|
|
7717
7752
|
const environment = useRemotionEnvironment();
|
|
7718
7753
|
const logLevel = useLogLevel();
|
|
7719
7754
|
const mountTime = useMountTime();
|
|
7720
|
-
const {
|
|
7755
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
7756
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext31(RenderAssetManager);
|
|
7721
7757
|
const id = useMemo30(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
7722
7758
|
props2.src,
|
|
7723
7759
|
sequenceContext?.cumulatedFrom,
|
|
@@ -7789,21 +7825,21 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7789
7825
|
startFrom: -mediaStartsAt,
|
|
7790
7826
|
fps: videoConfig.fps
|
|
7791
7827
|
});
|
|
7792
|
-
const handle =
|
|
7828
|
+
const handle = delayRender2(`Rendering <Video /> with src="${props2.src}" at time ${currentTime}`, {
|
|
7793
7829
|
retries: delayRenderRetries ?? undefined,
|
|
7794
7830
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
7795
7831
|
});
|
|
7796
7832
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
7797
|
-
|
|
7833
|
+
continueRender2(handle);
|
|
7798
7834
|
return;
|
|
7799
7835
|
}
|
|
7800
7836
|
if (isApproximatelyTheSame(current.currentTime, currentTime)) {
|
|
7801
7837
|
if (current.readyState >= 2) {
|
|
7802
|
-
|
|
7838
|
+
continueRender2(handle);
|
|
7803
7839
|
return;
|
|
7804
7840
|
}
|
|
7805
7841
|
const loadedDataHandler = () => {
|
|
7806
|
-
|
|
7842
|
+
continueRender2(handle);
|
|
7807
7843
|
};
|
|
7808
7844
|
current.addEventListener("loadeddata", loadedDataHandler, { once: true });
|
|
7809
7845
|
return () => {
|
|
@@ -7811,7 +7847,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7811
7847
|
};
|
|
7812
7848
|
}
|
|
7813
7849
|
const endedHandler = () => {
|
|
7814
|
-
|
|
7850
|
+
continueRender2(handle);
|
|
7815
7851
|
};
|
|
7816
7852
|
const seek2 = seekToTimeMultipleUntilRight({
|
|
7817
7853
|
element: current,
|
|
@@ -7821,7 +7857,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7821
7857
|
mountTime
|
|
7822
7858
|
});
|
|
7823
7859
|
seek2.prom.then(() => {
|
|
7824
|
-
|
|
7860
|
+
continueRender2(handle);
|
|
7825
7861
|
});
|
|
7826
7862
|
current.addEventListener("ended", endedHandler, { once: true });
|
|
7827
7863
|
const errorHandler = () => {
|
|
@@ -7840,7 +7876,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7840
7876
|
seek2.cancel();
|
|
7841
7877
|
current.removeEventListener("ended", endedHandler);
|
|
7842
7878
|
current.removeEventListener("error", errorHandler);
|
|
7843
|
-
|
|
7879
|
+
continueRender2(handle);
|
|
7844
7880
|
};
|
|
7845
7881
|
}, [
|
|
7846
7882
|
volumePropsFrame,
|
|
@@ -7853,7 +7889,9 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7853
7889
|
delayRenderRetries,
|
|
7854
7890
|
delayRenderTimeoutInMilliseconds,
|
|
7855
7891
|
logLevel,
|
|
7856
|
-
mountTime
|
|
7892
|
+
mountTime,
|
|
7893
|
+
continueRender2,
|
|
7894
|
+
delayRender2
|
|
7857
7895
|
]);
|
|
7858
7896
|
const { src } = props2;
|
|
7859
7897
|
if (environment.isRendering) {
|
|
@@ -7861,7 +7899,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7861
7899
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
7862
7900
|
return;
|
|
7863
7901
|
}
|
|
7864
|
-
const newHandle =
|
|
7902
|
+
const newHandle = delayRender2("Loading <Video> duration with src=" + src, {
|
|
7865
7903
|
retries: delayRenderRetries ?? undefined,
|
|
7866
7904
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
7867
7905
|
});
|
|
@@ -7870,19 +7908,26 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7870
7908
|
if (current?.duration) {
|
|
7871
7909
|
onDuration(src, current.duration);
|
|
7872
7910
|
}
|
|
7873
|
-
|
|
7911
|
+
continueRender2(newHandle);
|
|
7874
7912
|
};
|
|
7875
7913
|
if (current?.duration) {
|
|
7876
7914
|
onDuration(src, current.duration);
|
|
7877
|
-
|
|
7915
|
+
continueRender2(newHandle);
|
|
7878
7916
|
} else {
|
|
7879
7917
|
current?.addEventListener("loadedmetadata", didLoad, { once: true });
|
|
7880
7918
|
}
|
|
7881
7919
|
return () => {
|
|
7882
7920
|
current?.removeEventListener("loadedmetadata", didLoad);
|
|
7883
|
-
|
|
7921
|
+
continueRender2(newHandle);
|
|
7884
7922
|
};
|
|
7885
|
-
}, [
|
|
7923
|
+
}, [
|
|
7924
|
+
src,
|
|
7925
|
+
onDuration,
|
|
7926
|
+
delayRenderRetries,
|
|
7927
|
+
delayRenderTimeoutInMilliseconds,
|
|
7928
|
+
continueRender2,
|
|
7929
|
+
delayRender2
|
|
7930
|
+
]);
|
|
7886
7931
|
}
|
|
7887
7932
|
return /* @__PURE__ */ jsx33("video", {
|
|
7888
7933
|
ref: videoRef,
|
|
@@ -7911,7 +7956,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
7911
7956
|
const { loop, ...propsOtherThanLoop } = props2;
|
|
7912
7957
|
const { fps } = useVideoConfig();
|
|
7913
7958
|
const environment = useRemotionEnvironment();
|
|
7914
|
-
const { durations, setDurations } =
|
|
7959
|
+
const { durations, setDurations } = useContext32(DurationsContext);
|
|
7915
7960
|
if (typeof ref === "string") {
|
|
7916
7961
|
throw new Error("string refs are not supported");
|
|
7917
7962
|
}
|