remotion 4.0.519 → 4.0.521
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/THIRD_PARTY_LICENSES.md +28 -0
- package/dist/cjs/AbsoluteFill.d.ts +3 -15
- package/dist/cjs/Composition.js +5 -5
- package/dist/cjs/CompositionManager.d.ts +2 -3
- package/dist/cjs/CompositionManagerContext.d.ts +1 -2
- package/dist/cjs/CompositionManagerProvider.js +119 -5
- package/dist/cjs/Folder.d.ts +1 -2
- package/dist/cjs/Folder.js +6 -5
- package/dist/cjs/Img.d.ts +1 -0
- package/dist/cjs/Img.js +1 -0
- package/dist/cjs/Interactive.d.ts +3 -15
- package/dist/cjs/RemotionRoot.js +1 -8
- package/dist/cjs/Sequence.js +47 -60
- package/dist/cjs/SequenceManager.d.ts +1 -0
- package/dist/cjs/SequenceManager.js +85 -3
- package/dist/cjs/TimelineContext.d.ts +14 -8
- package/dist/cjs/TimelineContext.js +40 -23
- package/dist/cjs/animated-image/AnimatedImage.d.ts +1 -0
- package/dist/cjs/animated-image/AnimatedImage.js +1 -0
- package/dist/cjs/audio/AudioForPreview.js +6 -2
- package/dist/cjs/audio/shared-audio-tags.d.ts +1 -0
- package/dist/cjs/audio/shared-audio-tags.js +10 -1
- package/dist/cjs/audio/wait-until-actually-resumed.d.ts +1 -1
- package/dist/cjs/audio/wait-until-actually-resumed.js +16 -14
- package/dist/cjs/buffering.d.ts +3 -19
- package/dist/cjs/buffering.js +16 -77
- package/dist/cjs/canvas-image/CanvasImage.d.ts +1 -0
- package/dist/cjs/canvas-image/CanvasImage.js +1 -0
- package/dist/cjs/freeze.js +1 -4
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/interactivity-schema.d.ts +11 -16
- package/dist/cjs/interactivity-schema.js +3 -15
- package/dist/cjs/internals.d.ts +18 -45
- package/dist/cjs/internals.js +12 -4
- package/dist/cjs/runtime-value-store.d.ts +7 -7
- package/dist/cjs/runtime-value-store.js +1 -1
- package/dist/cjs/sequence-order-marker.d.ts +57 -0
- package/dist/cjs/sequence-order-marker.js +44 -0
- package/dist/cjs/timeline-position-state.d.ts +2 -8
- package/dist/cjs/timeline-position-state.js +5 -7
- package/dist/cjs/use-buffer-state.js +1 -3
- package/dist/cjs/use-buffering.d.ts +1 -0
- package/dist/cjs/use-buffering.js +11 -0
- package/dist/cjs/use-media-in-timeline.d.ts +0 -1
- package/dist/cjs/use-media-in-timeline.js +15 -29
- package/dist/cjs/use-media-playback.js +48 -56
- package/dist/cjs/use-media-tag.js +25 -3
- package/dist/cjs/use-playing.d.ts +1 -0
- package/dist/cjs/use-playing.js +14 -0
- package/dist/cjs/use-sequence-registration.d.ts +5 -0
- package/dist/cjs/use-sequence-registration.js +37 -0
- package/dist/cjs/use-sync-external-store.d.ts +28 -0
- package/dist/cjs/use-sync-external-store.js +116 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +5 -1
- package/dist/cjs/wrap-remotion-context.d.ts +1 -12
- package/dist/cjs/wrap-remotion-context.js +1 -8
- package/dist/esm/index.mjs +1145 -919
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ var Clipper = () => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// src/Composition.tsx
|
|
36
|
-
import { Suspense, useCallback as
|
|
36
|
+
import { Suspense, useCallback as useCallback3, useContext as useContext9, useEffect as useEffect2 } from "react";
|
|
37
37
|
import { createPortal } from "react-dom";
|
|
38
38
|
|
|
39
39
|
// src/CanUseRemotionHooks.tsx
|
|
@@ -207,43 +207,45 @@ var getSingleChildComponent = (children) => {
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
// src/Folder.tsx
|
|
210
|
-
import { createContext as
|
|
211
|
-
|
|
212
|
-
// src/
|
|
213
|
-
|
|
214
|
-
var
|
|
215
|
-
|
|
210
|
+
import { createContext as createContext5, useContext as useContext2, useEffect, useMemo } from "react";
|
|
211
|
+
|
|
212
|
+
// src/sequence-order-marker.tsx
|
|
213
|
+
var SEQUENCE_ORDER_MARKER = Symbol.for("remotion.sequence-order-marker");
|
|
214
|
+
var SEQUENCE_MANAGER_ORDER_MARKER = Symbol.for("remotion.sequence-manager-order-marker");
|
|
215
|
+
var COMPOSITION_ORDER_MARKER = Symbol.for("remotion.composition-order-marker");
|
|
216
|
+
var FOLDER_ORDER_MARKER = Symbol.for("remotion.folder-order-marker");
|
|
217
|
+
var COMPOSITION_MANAGER_ORDER_MARKER = Symbol.for("remotion.composition-manager-order-marker");
|
|
218
|
+
var COMMIT_ORDER_EVENT = "remotion:commit-order";
|
|
219
|
+
var getCompositionAndFolderOrderKey = (item) => `${item.type}:${item.id}`;
|
|
220
|
+
var getFolderOrderId = ({
|
|
221
|
+
name,
|
|
222
|
+
parent
|
|
223
|
+
}) => [parent, name].filter(Boolean).join("/");
|
|
224
|
+
var SequenceOrderMarker = ({ children }) => children;
|
|
225
|
+
Object.defineProperty(SequenceOrderMarker, SEQUENCE_ORDER_MARKER, {
|
|
226
|
+
value: true
|
|
216
227
|
});
|
|
217
|
-
var
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
...history.current,
|
|
239
|
-
[fastRefreshNonce, nonceRef.current]
|
|
240
|
-
];
|
|
241
|
-
}
|
|
242
|
-
return history.current;
|
|
243
|
-
}, [history]);
|
|
244
|
-
return useMemo(() => {
|
|
245
|
-
return { get };
|
|
246
|
-
}, [get]);
|
|
228
|
+
var SequenceManagerOrderMarker = ({ children }) => children;
|
|
229
|
+
Object.defineProperty(SequenceManagerOrderMarker, SEQUENCE_MANAGER_ORDER_MARKER, {
|
|
230
|
+
value: true
|
|
231
|
+
});
|
|
232
|
+
var CompositionOrderMarker = ({ children }) => children;
|
|
233
|
+
Object.defineProperty(CompositionOrderMarker, COMPOSITION_ORDER_MARKER, {
|
|
234
|
+
value: true
|
|
235
|
+
});
|
|
236
|
+
var FolderOrderMarker = ({ children }) => children;
|
|
237
|
+
Object.defineProperty(FolderOrderMarker, FOLDER_ORDER_MARKER, {
|
|
238
|
+
value: true
|
|
239
|
+
});
|
|
240
|
+
var CompositionManagerOrderMarker = ({ children }) => children;
|
|
241
|
+
Object.defineProperty(CompositionManagerOrderMarker, COMPOSITION_MANAGER_ORDER_MARKER, { value: true });
|
|
242
|
+
var CommitOrderInternals = {
|
|
243
|
+
compositionManagerMarker: COMPOSITION_MANAGER_ORDER_MARKER,
|
|
244
|
+
compositionMarker: COMPOSITION_ORDER_MARKER,
|
|
245
|
+
folderMarker: FOLDER_ORDER_MARKER,
|
|
246
|
+
sequenceManagerMarker: SEQUENCE_MANAGER_ORDER_MARKER,
|
|
247
|
+
sequenceMarker: SEQUENCE_ORDER_MARKER,
|
|
248
|
+
eventName: COMMIT_ORDER_EVENT
|
|
247
249
|
};
|
|
248
250
|
|
|
249
251
|
// src/truthy.ts
|
|
@@ -251,6 +253,41 @@ function truthy(value) {
|
|
|
251
253
|
return Boolean(value);
|
|
252
254
|
}
|
|
253
255
|
|
|
256
|
+
// src/use-remotion-environment.ts
|
|
257
|
+
import { useContext, useState } from "react";
|
|
258
|
+
|
|
259
|
+
// src/get-remotion-environment.ts
|
|
260
|
+
function getNodeEnvString() {
|
|
261
|
+
return ["NOD", "E_EN", "V"].join("");
|
|
262
|
+
}
|
|
263
|
+
var getEnvString = () => {
|
|
264
|
+
return ["e", "nv"].join("");
|
|
265
|
+
};
|
|
266
|
+
var getRemotionEnvironment = () => {
|
|
267
|
+
const isPlayer = typeof window !== "undefined" && window.remotion_isPlayer;
|
|
268
|
+
const isRendering = typeof window !== "undefined" && typeof window.process !== "undefined" && typeof window.process.env !== "undefined" && (window.process[getEnvString()][getNodeEnvString()] === "test" || window.process[getEnvString()][getNodeEnvString()] === "production" && typeof window !== "undefined" && typeof window.remotion_puppeteerTimeout !== "undefined");
|
|
269
|
+
const isStudio = typeof window !== "undefined" && window.remotion_isStudio;
|
|
270
|
+
const isReadOnlyStudio = typeof window !== "undefined" && window.remotion_isReadOnlyStudio;
|
|
271
|
+
return {
|
|
272
|
+
isStudio,
|
|
273
|
+
isRendering,
|
|
274
|
+
isPlayer,
|
|
275
|
+
isReadOnlyStudio,
|
|
276
|
+
isClientSideRendering: false
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// src/remotion-environment-context.ts
|
|
281
|
+
import React4 from "react";
|
|
282
|
+
var RemotionEnvironmentContext = React4.createContext(null);
|
|
283
|
+
|
|
284
|
+
// src/use-remotion-environment.ts
|
|
285
|
+
var useRemotionEnvironment = () => {
|
|
286
|
+
const context = useContext(RemotionEnvironmentContext);
|
|
287
|
+
const [env] = useState(() => getRemotionEnvironment());
|
|
288
|
+
return context ?? env;
|
|
289
|
+
};
|
|
290
|
+
|
|
254
291
|
// src/validation/validate-folder-name.ts
|
|
255
292
|
var getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
|
|
256
293
|
var isFolderNameValid = (name) => name.match(getRegex());
|
|
@@ -269,7 +306,7 @@ var invalidFolderNameErrorMessage = `Folder name must match ${String(getRegex())
|
|
|
269
306
|
|
|
270
307
|
// src/Folder.tsx
|
|
271
308
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
272
|
-
var FolderContext =
|
|
309
|
+
var FolderContext = createContext5({
|
|
273
310
|
folderName: null,
|
|
274
311
|
parentName: null
|
|
275
312
|
});
|
|
@@ -277,19 +314,19 @@ var Folder = (props) => {
|
|
|
277
314
|
const { name, children } = props;
|
|
278
315
|
const parent = useContext2(FolderContext);
|
|
279
316
|
const { registerFolder, unregisterFolder } = useContext2(CompositionSetters);
|
|
280
|
-
const
|
|
317
|
+
const environment = useRemotionEnvironment();
|
|
281
318
|
const stack = props._remotionInternalStack ?? null;
|
|
282
319
|
validateFolderName(name);
|
|
283
320
|
const parentNameArr = [parent.parentName, parent.folderName].filter(truthy);
|
|
284
321
|
const parentName = parentNameArr.length === 0 ? null : parentNameArr.join("/");
|
|
285
|
-
const value =
|
|
322
|
+
const value = useMemo(() => {
|
|
286
323
|
return {
|
|
287
324
|
folderName: name,
|
|
288
325
|
parentName
|
|
289
326
|
};
|
|
290
327
|
}, [name, parentName]);
|
|
291
328
|
useEffect(() => {
|
|
292
|
-
registerFolder(name, parentName,
|
|
329
|
+
registerFolder(name, parentName, stack);
|
|
293
330
|
return () => {
|
|
294
331
|
unregisterFolder(name, parentName);
|
|
295
332
|
};
|
|
@@ -299,34 +336,16 @@ var Folder = (props) => {
|
|
|
299
336
|
parentName,
|
|
300
337
|
registerFolder,
|
|
301
338
|
unregisterFolder,
|
|
302
|
-
nonce,
|
|
303
339
|
stack
|
|
304
340
|
]);
|
|
305
|
-
|
|
341
|
+
const folder = /* @__PURE__ */ jsx2(FolderContext.Provider, {
|
|
306
342
|
value,
|
|
307
343
|
children
|
|
308
344
|
});
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return ["NOD", "E_EN", "V"].join("");
|
|
314
|
-
}
|
|
315
|
-
var getEnvString = () => {
|
|
316
|
-
return ["e", "nv"].join("");
|
|
317
|
-
};
|
|
318
|
-
var getRemotionEnvironment = () => {
|
|
319
|
-
const isPlayer = typeof window !== "undefined" && window.remotion_isPlayer;
|
|
320
|
-
const isRendering = typeof window !== "undefined" && typeof window.process !== "undefined" && typeof window.process.env !== "undefined" && (window.process[getEnvString()][getNodeEnvString()] === "test" || window.process[getEnvString()][getNodeEnvString()] === "production" && typeof window !== "undefined" && typeof window.remotion_puppeteerTimeout !== "undefined");
|
|
321
|
-
const isStudio = typeof window !== "undefined" && window.remotion_isStudio;
|
|
322
|
-
const isReadOnlyStudio = typeof window !== "undefined" && window.remotion_isReadOnlyStudio;
|
|
323
|
-
return {
|
|
324
|
-
isStudio,
|
|
325
|
-
isRendering,
|
|
326
|
-
isPlayer,
|
|
327
|
-
isReadOnlyStudio,
|
|
328
|
-
isClientSideRendering: false
|
|
329
|
-
};
|
|
345
|
+
return environment.isStudio ? /* @__PURE__ */ jsx2(FolderOrderMarker, {
|
|
346
|
+
folderId: getFolderOrderId({ name, parent: parentName }),
|
|
347
|
+
children: folder
|
|
348
|
+
}) : folder;
|
|
330
349
|
};
|
|
331
350
|
|
|
332
351
|
// src/input-props-serialization.ts
|
|
@@ -405,9 +424,9 @@ var serializeThenDeserializeInStudio = (props) => {
|
|
|
405
424
|
};
|
|
406
425
|
|
|
407
426
|
// src/is-player.tsx
|
|
408
|
-
import { createContext as
|
|
427
|
+
import { createContext as createContext6, useContext as useContext3 } from "react";
|
|
409
428
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
410
|
-
var IsPlayerContext =
|
|
429
|
+
var IsPlayerContext = createContext6(false);
|
|
411
430
|
var IsPlayerContextProvider = ({
|
|
412
431
|
children
|
|
413
432
|
}) => {
|
|
@@ -421,7 +440,7 @@ var useIsPlayer = () => {
|
|
|
421
440
|
};
|
|
422
441
|
|
|
423
442
|
// src/AbsoluteFillElement.tsx
|
|
424
|
-
import { forwardRef, useMemo as
|
|
443
|
+
import { forwardRef, useMemo as useMemo2 } from "react";
|
|
425
444
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
426
445
|
var hasTailwindClassName = ({
|
|
427
446
|
className,
|
|
@@ -445,7 +464,7 @@ var hasTailwindClassName = ({
|
|
|
445
464
|
};
|
|
446
465
|
var AbsoluteFillElementRefForwarding = (props, ref) => {
|
|
447
466
|
const { style, ...other } = props;
|
|
448
|
-
const actualStyle =
|
|
467
|
+
const actualStyle = useMemo2(() => {
|
|
449
468
|
return {
|
|
450
469
|
position: "absolute",
|
|
451
470
|
top: hasTailwindClassName({
|
|
@@ -517,7 +536,7 @@ var AbsoluteFillElementRefForwarding = (props, ref) => {
|
|
|
517
536
|
var AbsoluteFillElement = forwardRef(AbsoluteFillElementRefForwarding);
|
|
518
537
|
|
|
519
538
|
// src/use-current-scale.ts
|
|
520
|
-
import React7, { createContext as
|
|
539
|
+
import React7, { createContext as createContext10 } from "react";
|
|
521
540
|
|
|
522
541
|
// src/portal-node.ts
|
|
523
542
|
var _portalNode = null;
|
|
@@ -563,32 +582,18 @@ var portalNode = () => {
|
|
|
563
582
|
return _portalNode;
|
|
564
583
|
};
|
|
565
584
|
|
|
566
|
-
// src/use-remotion-environment.ts
|
|
567
|
-
import { useContext as useContext4, useState } from "react";
|
|
568
|
-
|
|
569
|
-
// src/remotion-environment-context.ts
|
|
570
|
-
import React5 from "react";
|
|
571
|
-
var RemotionEnvironmentContext = React5.createContext(null);
|
|
572
|
-
|
|
573
|
-
// src/use-remotion-environment.ts
|
|
574
|
-
var useRemotionEnvironment = () => {
|
|
575
|
-
const context = useContext4(RemotionEnvironmentContext);
|
|
576
|
-
const [env] = useState(() => getRemotionEnvironment());
|
|
577
|
-
return context ?? env;
|
|
578
|
-
};
|
|
579
|
-
|
|
580
585
|
// src/use-unsafe-video-config.ts
|
|
581
|
-
import { useContext as
|
|
586
|
+
import { useContext as useContext6, useMemo as useMemo6 } from "react";
|
|
582
587
|
|
|
583
588
|
// src/SequenceContext.tsx
|
|
584
|
-
import { createContext as
|
|
585
|
-
var SequenceContext =
|
|
589
|
+
import { createContext as createContext7 } from "react";
|
|
590
|
+
var SequenceContext = createContext7(null);
|
|
586
591
|
|
|
587
592
|
// src/use-video.ts
|
|
588
|
-
import { useContext as
|
|
593
|
+
import { useContext as useContext5, useMemo as useMemo5 } from "react";
|
|
589
594
|
|
|
590
595
|
// src/ResolveCompositionConfig.tsx
|
|
591
|
-
import { createContext as
|
|
596
|
+
import { createContext as createContext9, createRef, useContext as useContext4, useMemo as useMemo4 } from "react";
|
|
592
597
|
|
|
593
598
|
// src/input-props-override.ts
|
|
594
599
|
var getKey = () => {
|
|
@@ -647,9 +652,9 @@ var getInputProps = () => {
|
|
|
647
652
|
};
|
|
648
653
|
|
|
649
654
|
// src/EditorProps.tsx
|
|
650
|
-
import React6, { createContext as
|
|
655
|
+
import React6, { createContext as createContext8, useCallback, useMemo as useMemo3 } from "react";
|
|
651
656
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
652
|
-
var EditorPropsContext =
|
|
657
|
+
var EditorPropsContext = createContext8({
|
|
653
658
|
props: {},
|
|
654
659
|
updateProps: () => {
|
|
655
660
|
throw new Error("Not implemented");
|
|
@@ -658,7 +663,7 @@ var EditorPropsContext = createContext9({
|
|
|
658
663
|
var timeValueRef = React6.createRef();
|
|
659
664
|
var EditorPropsProvider = ({ children }) => {
|
|
660
665
|
const [props, setProps] = React6.useState({});
|
|
661
|
-
const updateProps =
|
|
666
|
+
const updateProps = useCallback(({
|
|
662
667
|
defaultProps,
|
|
663
668
|
id,
|
|
664
669
|
newProps
|
|
@@ -670,7 +675,7 @@ var EditorPropsProvider = ({ children }) => {
|
|
|
670
675
|
};
|
|
671
676
|
});
|
|
672
677
|
}, []);
|
|
673
|
-
const ctx =
|
|
678
|
+
const ctx = useMemo3(() => {
|
|
674
679
|
return { props, updateProps };
|
|
675
680
|
}, [props, updateProps]);
|
|
676
681
|
return /* @__PURE__ */ jsx5(EditorPropsContext.Provider, {
|
|
@@ -738,28 +743,28 @@ function validateFps(fps, location, isGif) {
|
|
|
738
743
|
}
|
|
739
744
|
|
|
740
745
|
// src/ResolveCompositionConfig.tsx
|
|
741
|
-
var ResolveCompositionContext =
|
|
746
|
+
var ResolveCompositionContext = createContext9(null);
|
|
742
747
|
var resolveCompositionsRef = createRef();
|
|
743
748
|
var needsResolution = (composition) => {
|
|
744
749
|
return Boolean(composition.calculateMetadata);
|
|
745
750
|
};
|
|
746
751
|
var useResolvedVideoConfig = (preferredCompositionId) => {
|
|
747
|
-
const context =
|
|
748
|
-
const { props: allEditorProps } =
|
|
752
|
+
const context = useContext4(ResolveCompositionContext);
|
|
753
|
+
const { props: allEditorProps } = useContext4(EditorPropsContext);
|
|
749
754
|
const {
|
|
750
755
|
compositions,
|
|
751
756
|
canvasContent,
|
|
752
757
|
currentCompositionMetadata,
|
|
753
758
|
currentAssetMetadata
|
|
754
|
-
} =
|
|
759
|
+
} = useContext4(CompositionManager);
|
|
755
760
|
const currentComposition = canvasContent?.type === "composition" ? canvasContent.compositionId : null;
|
|
756
761
|
const compositionId = preferredCompositionId ?? currentComposition;
|
|
757
762
|
const composition = compositions.find((c) => c.id === compositionId);
|
|
758
|
-
const selectedEditorProps =
|
|
763
|
+
const selectedEditorProps = useMemo4(() => {
|
|
759
764
|
return composition ? allEditorProps[composition.id] ?? {} : {};
|
|
760
765
|
}, [allEditorProps, composition]);
|
|
761
766
|
const env = useRemotionEnvironment();
|
|
762
|
-
return
|
|
767
|
+
return useMemo4(() => {
|
|
763
768
|
if (preferredCompositionId === null && canvasContent?.type === "asset" && currentAssetMetadata?.asset === canvasContent.asset) {
|
|
764
769
|
return {
|
|
765
770
|
type: "success",
|
|
@@ -844,12 +849,12 @@ var useVideo = () => {
|
|
|
844
849
|
compositions,
|
|
845
850
|
currentCompositionMetadata,
|
|
846
851
|
currentAssetMetadata
|
|
847
|
-
} =
|
|
852
|
+
} = useContext5(CompositionManager);
|
|
848
853
|
const selected = compositions.find((c) => {
|
|
849
854
|
return canvasContent?.type === "composition" && c.id === canvasContent.compositionId;
|
|
850
855
|
});
|
|
851
856
|
const resolved = useResolvedVideoConfig(selected?.id ?? null);
|
|
852
|
-
return
|
|
857
|
+
return useMemo5(() => {
|
|
853
858
|
if (canvasContent?.type === "asset" && currentAssetMetadata?.asset === canvasContent.asset) {
|
|
854
859
|
return {
|
|
855
860
|
...currentAssetMetadata,
|
|
@@ -888,12 +893,12 @@ var useVideo = () => {
|
|
|
888
893
|
|
|
889
894
|
// src/use-unsafe-video-config.ts
|
|
890
895
|
var useUnsafeVideoConfig = () => {
|
|
891
|
-
const context =
|
|
896
|
+
const context = useContext6(SequenceContext);
|
|
892
897
|
const ctxWidth = context?.width ?? null;
|
|
893
898
|
const ctxHeight = context?.height ?? null;
|
|
894
899
|
const ctxDuration = context?.durationInFrames ?? null;
|
|
895
900
|
const video = useVideo();
|
|
896
|
-
return
|
|
901
|
+
return useMemo6(() => {
|
|
897
902
|
if (!video) {
|
|
898
903
|
return null;
|
|
899
904
|
}
|
|
@@ -932,7 +937,7 @@ var useUnsafeVideoConfig = () => {
|
|
|
932
937
|
|
|
933
938
|
// src/use-current-scale.ts
|
|
934
939
|
var CurrentScaleContext = React7.createContext(null);
|
|
935
|
-
var PreviewSizeContext =
|
|
940
|
+
var PreviewSizeContext = createContext10({
|
|
936
941
|
setSize: () => {
|
|
937
942
|
return;
|
|
938
943
|
},
|
|
@@ -1061,7 +1066,7 @@ var Loading = () => {
|
|
|
1061
1066
|
};
|
|
1062
1067
|
|
|
1063
1068
|
// src/use-delay-render.tsx
|
|
1064
|
-
import { createContext as
|
|
1069
|
+
import { createContext as createContext12, useCallback as useCallback2, useContext as useContext8 } from "react";
|
|
1065
1070
|
|
|
1066
1071
|
// src/cancel-render.ts
|
|
1067
1072
|
var getErrorStackWithMessage = (error) => {
|
|
@@ -1275,9 +1280,9 @@ var continueRender = (handle) => {
|
|
|
1275
1280
|
};
|
|
1276
1281
|
|
|
1277
1282
|
// src/log-level-context.tsx
|
|
1278
|
-
import { createContext as
|
|
1283
|
+
import { createContext as createContext11 } from "react";
|
|
1279
1284
|
import * as React8 from "react";
|
|
1280
|
-
var LogLevelContext =
|
|
1285
|
+
var LogLevelContext = createContext11({
|
|
1281
1286
|
logLevel: "info",
|
|
1282
1287
|
mountTime: 0
|
|
1283
1288
|
});
|
|
@@ -1297,12 +1302,12 @@ var useMountTime = () => {
|
|
|
1297
1302
|
};
|
|
1298
1303
|
|
|
1299
1304
|
// src/use-delay-render.tsx
|
|
1300
|
-
var DelayRenderContextType =
|
|
1305
|
+
var DelayRenderContextType = createContext12(null);
|
|
1301
1306
|
var useDelayRender = () => {
|
|
1302
1307
|
const environment = useRemotionEnvironment();
|
|
1303
|
-
const scope =
|
|
1308
|
+
const scope = useContext8(DelayRenderContextType) ?? (typeof window !== "undefined" ? window : undefined);
|
|
1304
1309
|
const logLevel = useLogLevel();
|
|
1305
|
-
const delayRender2 =
|
|
1310
|
+
const delayRender2 = useCallback2((label2, options) => {
|
|
1306
1311
|
if (!scope) {
|
|
1307
1312
|
return Math.random();
|
|
1308
1313
|
}
|
|
@@ -1313,7 +1318,7 @@ var useDelayRender = () => {
|
|
|
1313
1318
|
options: options ?? {}
|
|
1314
1319
|
});
|
|
1315
1320
|
}, [environment, scope]);
|
|
1316
|
-
const continueRender2 =
|
|
1321
|
+
const continueRender2 = useCallback2((handle) => {
|
|
1317
1322
|
if (!scope) {
|
|
1318
1323
|
return;
|
|
1319
1324
|
}
|
|
@@ -1324,24 +1329,24 @@ var useDelayRender = () => {
|
|
|
1324
1329
|
logLevel
|
|
1325
1330
|
});
|
|
1326
1331
|
}, [environment, logLevel, scope]);
|
|
1327
|
-
const cancelRender2 =
|
|
1332
|
+
const cancelRender2 = useCallback2((err) => {
|
|
1328
1333
|
return cancelRenderInternal(scope ?? (typeof window !== "undefined" ? window : undefined), err);
|
|
1329
1334
|
}, [scope]);
|
|
1330
1335
|
return { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 };
|
|
1331
1336
|
};
|
|
1332
1337
|
|
|
1333
1338
|
// src/use-lazy-component.ts
|
|
1334
|
-
import React9, { useMemo as
|
|
1339
|
+
import React9, { useMemo as useMemo7, useRef } from "react";
|
|
1335
1340
|
var useLazyComponent = ({
|
|
1336
1341
|
compProps,
|
|
1337
1342
|
componentName,
|
|
1338
1343
|
noSuspense
|
|
1339
1344
|
}) => {
|
|
1340
|
-
const componentRef =
|
|
1345
|
+
const componentRef = useRef(null);
|
|
1341
1346
|
if ("component" in compProps) {
|
|
1342
1347
|
componentRef.current = compProps.component;
|
|
1343
1348
|
}
|
|
1344
|
-
const lazy =
|
|
1349
|
+
const lazy = useMemo7(() => {
|
|
1345
1350
|
if ("component" in compProps) {
|
|
1346
1351
|
if (typeof document === "undefined" || noSuspense) {
|
|
1347
1352
|
return compProps.component;
|
|
@@ -1409,7 +1414,7 @@ var InnerComposition = ({
|
|
|
1409
1414
|
schema,
|
|
1410
1415
|
...compProps
|
|
1411
1416
|
}) => {
|
|
1412
|
-
const compManager =
|
|
1417
|
+
const compManager = useContext9(CompositionSetters);
|
|
1413
1418
|
const { registerComposition, unregisterComposition } = compManager;
|
|
1414
1419
|
const video = useVideo();
|
|
1415
1420
|
const lazy = useLazyComponent({
|
|
@@ -1417,10 +1422,9 @@ var InnerComposition = ({
|
|
|
1417
1422
|
componentName: "Composition",
|
|
1418
1423
|
noSuspense: false
|
|
1419
1424
|
});
|
|
1420
|
-
const nonce = useNonce();
|
|
1421
1425
|
const isPlayer = useIsPlayer();
|
|
1422
1426
|
const environment = useRemotionEnvironment();
|
|
1423
|
-
const canUseComposition =
|
|
1427
|
+
const canUseComposition = useContext9(CanUseRemotionHooks);
|
|
1424
1428
|
if (typeof window !== "undefined") {
|
|
1425
1429
|
window.remotion_seenCompositionIds = Array.from(new Set([...window.remotion_seenCompositionIds ?? [], id]));
|
|
1426
1430
|
}
|
|
@@ -1430,7 +1434,7 @@ var InnerComposition = ({
|
|
|
1430
1434
|
}
|
|
1431
1435
|
throw new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");
|
|
1432
1436
|
}
|
|
1433
|
-
const { folderName, parentName } =
|
|
1437
|
+
const { folderName, parentName } = useContext9(FolderContext);
|
|
1434
1438
|
const stack = compProps._remotionInternalStack ?? null;
|
|
1435
1439
|
const componentFromProps = "component" in compProps ? resolveComponentIdentity(compProps.component) : null;
|
|
1436
1440
|
useEffect2(() => {
|
|
@@ -1448,7 +1452,7 @@ var InnerComposition = ({
|
|
|
1448
1452
|
folderName,
|
|
1449
1453
|
component: lazy,
|
|
1450
1454
|
defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
|
|
1451
|
-
|
|
1455
|
+
order: null,
|
|
1452
1456
|
parentFolderName: parentName,
|
|
1453
1457
|
componentFromProps,
|
|
1454
1458
|
schema: schema ?? null,
|
|
@@ -1467,7 +1471,6 @@ var InnerComposition = ({
|
|
|
1467
1471
|
folderName,
|
|
1468
1472
|
defaultProps,
|
|
1469
1473
|
width,
|
|
1470
|
-
nonce,
|
|
1471
1474
|
parentName,
|
|
1472
1475
|
componentFromProps,
|
|
1473
1476
|
schema,
|
|
@@ -1477,11 +1480,11 @@ var InnerComposition = ({
|
|
|
1477
1480
|
unregisterComposition
|
|
1478
1481
|
]);
|
|
1479
1482
|
const resolved = useResolvedVideoConfig(id);
|
|
1480
|
-
const { setError, clearError } =
|
|
1481
|
-
const onError =
|
|
1483
|
+
const { setError, clearError } = useContext9(CompositionRenderErrorContext);
|
|
1484
|
+
const onError = useCallback3((error2) => {
|
|
1482
1485
|
setError(error2);
|
|
1483
1486
|
}, [setError]);
|
|
1484
|
-
const onClear =
|
|
1487
|
+
const onClear = useCallback3(() => {
|
|
1485
1488
|
clearError();
|
|
1486
1489
|
}, [clearError]);
|
|
1487
1490
|
if (environment.isStudio && video && video.component === lazy && video.id === id) {
|
|
@@ -1519,17 +1522,22 @@ var InnerComposition = ({
|
|
|
1519
1522
|
return null;
|
|
1520
1523
|
};
|
|
1521
1524
|
var Composition = (props) => {
|
|
1522
|
-
const { onlyRenderComposition } =
|
|
1525
|
+
const { onlyRenderComposition } = useContext9(CompositionSetters);
|
|
1526
|
+
const environment = useRemotionEnvironment();
|
|
1523
1527
|
if (onlyRenderComposition && onlyRenderComposition !== props.id) {
|
|
1524
1528
|
return null;
|
|
1525
1529
|
}
|
|
1526
|
-
|
|
1530
|
+
const composition = /* @__PURE__ */ jsx7(InnerComposition, {
|
|
1527
1531
|
...props
|
|
1528
1532
|
});
|
|
1533
|
+
return environment.isStudio ? /* @__PURE__ */ jsx7(CompositionOrderMarker, {
|
|
1534
|
+
compositionId: props.id,
|
|
1535
|
+
children: composition
|
|
1536
|
+
}) : composition;
|
|
1529
1537
|
};
|
|
1530
1538
|
|
|
1531
1539
|
// src/version.ts
|
|
1532
|
-
var VERSION = "4.0.
|
|
1540
|
+
var VERSION = "4.0.521";
|
|
1533
1541
|
|
|
1534
1542
|
// src/multiple-versions-warning.ts
|
|
1535
1543
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -1569,15 +1577,14 @@ var Null = () => {
|
|
|
1569
1577
|
import {
|
|
1570
1578
|
forwardRef as forwardRef3,
|
|
1571
1579
|
useCallback as useCallback6,
|
|
1572
|
-
useContext as
|
|
1573
|
-
|
|
1574
|
-
useMemo as useMemo15,
|
|
1580
|
+
useContext as useContext20,
|
|
1581
|
+
useMemo as useMemo13,
|
|
1575
1582
|
useRef as useRef6,
|
|
1576
|
-
useState as
|
|
1583
|
+
useState as useState6
|
|
1577
1584
|
} from "react";
|
|
1578
1585
|
|
|
1579
1586
|
// src/freeze.tsx
|
|
1580
|
-
import { useContext as
|
|
1587
|
+
import { useContext as useContext15, useMemo as useMemo9 } from "react";
|
|
1581
1588
|
|
|
1582
1589
|
// src/timeline-position-state.ts
|
|
1583
1590
|
var exports_timeline_position_state = {};
|
|
@@ -1585,46 +1592,88 @@ __export(exports_timeline_position_state, {
|
|
|
1585
1592
|
useTimelineSetFrame: () => useTimelineSetFrame,
|
|
1586
1593
|
useTimelinePosition: () => useTimelinePosition,
|
|
1587
1594
|
useTimelineContext: () => useTimelineContext,
|
|
1588
|
-
|
|
1595
|
+
usePlaying: () => usePlaying,
|
|
1589
1596
|
usePlaybackRate: () => usePlaybackRate,
|
|
1597
|
+
useBuffering: () => useBuffering,
|
|
1590
1598
|
useAbsoluteTimelinePosition: () => useAbsoluteTimelinePosition,
|
|
1591
1599
|
persistCurrentFrame: () => persistCurrentFrame,
|
|
1592
1600
|
getInitialFrameState: () => getInitialFrameState,
|
|
1593
1601
|
getFrameForComposition: () => getFrameForComposition,
|
|
1594
1602
|
clampFrameToCompositionRange: () => clampFrameToCompositionRange
|
|
1595
1603
|
});
|
|
1596
|
-
import { useContext as
|
|
1604
|
+
import { useContext as useContext12 } from "react";
|
|
1597
1605
|
|
|
1598
1606
|
// src/TimelineContext.tsx
|
|
1599
1607
|
import {
|
|
1600
|
-
createContext as
|
|
1608
|
+
createContext as createContext13,
|
|
1609
|
+
useCallback as useCallback4,
|
|
1601
1610
|
useLayoutEffect,
|
|
1602
|
-
useMemo as
|
|
1603
|
-
useRef as
|
|
1611
|
+
useMemo as useMemo8,
|
|
1612
|
+
useRef as useRef2,
|
|
1604
1613
|
useState as useState2
|
|
1605
1614
|
} from "react";
|
|
1615
|
+
|
|
1616
|
+
// src/runtime-value-store.ts
|
|
1617
|
+
var createRuntimeValueStore = (initialSnapshot) => {
|
|
1618
|
+
let snapshot = initialSnapshot;
|
|
1619
|
+
const listeners = new Set;
|
|
1620
|
+
const store = {
|
|
1621
|
+
getSnapshot: () => snapshot,
|
|
1622
|
+
subscribe: (listener) => {
|
|
1623
|
+
listeners.add(listener);
|
|
1624
|
+
return () => {
|
|
1625
|
+
listeners.delete(listener);
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
};
|
|
1629
|
+
return {
|
|
1630
|
+
store,
|
|
1631
|
+
setSnapshot: (newSnapshot) => {
|
|
1632
|
+
if (snapshot === newSnapshot) {
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
snapshot = newSnapshot;
|
|
1636
|
+
for (const listener of listeners) {
|
|
1637
|
+
listener(snapshot);
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
// src/TimelineContext.tsx
|
|
1606
1644
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1607
|
-
var
|
|
1608
|
-
|
|
1609
|
-
|
|
1645
|
+
var missingSetTimelineContext = () => {
|
|
1646
|
+
throw new Error("SetTimelineContext is missing. This is likely caused by a Remotion version mismatch.");
|
|
1647
|
+
};
|
|
1648
|
+
var SetTimelineContext = createContext13({
|
|
1649
|
+
setFrame: missingSetTimelineContext,
|
|
1650
|
+
setPlaying: missingSetTimelineContext,
|
|
1651
|
+
setBuffering: missingSetTimelineContext,
|
|
1652
|
+
subscribePlaying: () => () => {
|
|
1653
|
+
return;
|
|
1610
1654
|
},
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
}
|
|
1655
|
+
subscribeBuffering: () => () => {
|
|
1656
|
+
return;
|
|
1657
|
+
},
|
|
1658
|
+
isPlaying: () => false,
|
|
1659
|
+
isBuffering: missingSetTimelineContext,
|
|
1660
|
+
frameRef: { current: {} },
|
|
1661
|
+
audioAndVideoTags: { current: [] }
|
|
1614
1662
|
});
|
|
1615
|
-
var TimelineContext =
|
|
1616
|
-
var
|
|
1617
|
-
var
|
|
1618
|
-
var AbsoluteTimeContext = createContext14(null);
|
|
1663
|
+
var TimelineContext = createContext13(null);
|
|
1664
|
+
var PlaybackRateContext = createContext13(null);
|
|
1665
|
+
var AbsoluteTimeContext = createContext13(null);
|
|
1619
1666
|
var TimelineContextProvider = ({ children, frameState }) => {
|
|
1620
|
-
const
|
|
1621
|
-
const
|
|
1667
|
+
const playingStore = useMemo8(() => createRuntimeValueStore({ playing: false }), []);
|
|
1668
|
+
const bufferingStore = useMemo8(() => createRuntimeValueStore({ buffering: false }), []);
|
|
1622
1669
|
const [playbackRate, setPlaybackRate] = useState2(1);
|
|
1623
|
-
const audioAndVideoTags =
|
|
1670
|
+
const audioAndVideoTags = useRef2([]);
|
|
1624
1671
|
const [_frame, setFrame] = useState2(() => getInitialFrameState());
|
|
1625
1672
|
const frame = frameState ?? _frame;
|
|
1626
|
-
const frameRef =
|
|
1673
|
+
const frameRef = useRef2(frame);
|
|
1627
1674
|
frameRef.current = frame;
|
|
1675
|
+
const readIsPlaying = useCallback4(() => playingStore.store.getSnapshot().playing, [playingStore]);
|
|
1676
|
+
const readIsBuffering = useCallback4(() => bufferingStore.store.getSnapshot().buffering, [bufferingStore]);
|
|
1628
1677
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
1629
1678
|
if (typeof window !== "undefined") {
|
|
1630
1679
|
useLayoutEffect(() => {
|
|
@@ -1652,51 +1701,113 @@ var TimelineContextProvider = ({ children, frameState }) => {
|
|
|
1652
1701
|
window.remotion_isPlayer = false;
|
|
1653
1702
|
}, [continueRender2, delayRender2]);
|
|
1654
1703
|
}
|
|
1655
|
-
const timelineContextValue =
|
|
1704
|
+
const timelineContextValue = useMemo8(() => {
|
|
1656
1705
|
return {
|
|
1657
1706
|
frame,
|
|
1658
|
-
|
|
1659
|
-
imperativePlaying,
|
|
1707
|
+
isPlaying: readIsPlaying,
|
|
1660
1708
|
audioAndVideoTags
|
|
1661
1709
|
};
|
|
1662
|
-
}, [frame,
|
|
1663
|
-
const
|
|
1664
|
-
return {
|
|
1665
|
-
frameRef,
|
|
1666
|
-
imperativePlaying,
|
|
1667
|
-
audioAndVideoTags
|
|
1668
|
-
};
|
|
1669
|
-
}, []);
|
|
1670
|
-
const playbackRateContextValue = useMemo9(() => {
|
|
1710
|
+
}, [frame, readIsPlaying]);
|
|
1711
|
+
const playbackRateContextValue = useMemo8(() => {
|
|
1671
1712
|
return {
|
|
1672
1713
|
playbackRate,
|
|
1673
1714
|
setPlaybackRate
|
|
1674
1715
|
};
|
|
1675
1716
|
}, [playbackRate]);
|
|
1676
|
-
const setTimelineContextValue =
|
|
1717
|
+
const setTimelineContextValue = useMemo8(() => {
|
|
1677
1718
|
return {
|
|
1678
1719
|
setFrame,
|
|
1679
|
-
setPlaying
|
|
1720
|
+
setPlaying: (updater) => {
|
|
1721
|
+
const current = playingStore.store.getSnapshot().playing;
|
|
1722
|
+
const next = typeof updater === "function" ? updater(current) : updater;
|
|
1723
|
+
if (current !== next) {
|
|
1724
|
+
playingStore.setSnapshot({ playing: next });
|
|
1725
|
+
}
|
|
1726
|
+
},
|
|
1727
|
+
setBuffering: (buffering) => {
|
|
1728
|
+
if (readIsBuffering() !== buffering) {
|
|
1729
|
+
bufferingStore.setSnapshot({ buffering });
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
subscribePlaying: playingStore.store.subscribe,
|
|
1733
|
+
subscribeBuffering: bufferingStore.store.subscribe,
|
|
1734
|
+
isPlaying: readIsPlaying,
|
|
1735
|
+
isBuffering: readIsBuffering,
|
|
1736
|
+
frameRef,
|
|
1737
|
+
audioAndVideoTags
|
|
1680
1738
|
};
|
|
1681
|
-
}, []);
|
|
1739
|
+
}, [bufferingStore, playingStore, readIsBuffering, readIsPlaying]);
|
|
1682
1740
|
return /* @__PURE__ */ jsx8(AbsoluteTimeContext.Provider, {
|
|
1683
1741
|
value: timelineContextValue,
|
|
1684
1742
|
children: /* @__PURE__ */ jsx8(PlaybackRateContext.Provider, {
|
|
1685
1743
|
value: playbackRateContextValue,
|
|
1686
|
-
children: /* @__PURE__ */ jsx8(
|
|
1687
|
-
value:
|
|
1688
|
-
children: /* @__PURE__ */ jsx8(
|
|
1689
|
-
value:
|
|
1690
|
-
children
|
|
1691
|
-
value: setTimelineContextValue,
|
|
1692
|
-
children
|
|
1693
|
-
})
|
|
1744
|
+
children: /* @__PURE__ */ jsx8(TimelineContext.Provider, {
|
|
1745
|
+
value: timelineContextValue,
|
|
1746
|
+
children: /* @__PURE__ */ jsx8(SetTimelineContext.Provider, {
|
|
1747
|
+
value: setTimelineContextValue,
|
|
1748
|
+
children
|
|
1694
1749
|
})
|
|
1695
1750
|
})
|
|
1696
1751
|
})
|
|
1697
1752
|
});
|
|
1698
1753
|
};
|
|
1699
1754
|
|
|
1755
|
+
// src/use-playing.ts
|
|
1756
|
+
import { useContext as useContext10 } from "react";
|
|
1757
|
+
|
|
1758
|
+
// src/use-sync-external-store.ts
|
|
1759
|
+
import * as React12 from "react";
|
|
1760
|
+
var objectIs = typeof Object.is === "function" ? Object.is : (first, second) => first === second && (first !== 0 || 1 / first === 1 / second) || Number.isNaN(first) && Number.isNaN(second);
|
|
1761
|
+
var checkIfSnapshotChanged = (instance) => {
|
|
1762
|
+
try {
|
|
1763
|
+
return !objectIs(instance.value, instance.getSnapshot());
|
|
1764
|
+
} catch {
|
|
1765
|
+
return true;
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
var useSyncExternalStoreShimClient = (subscribe, getSnapshot) => {
|
|
1769
|
+
const value = getSnapshot();
|
|
1770
|
+
if (false) {}
|
|
1771
|
+
const [{ instance }, forceUpdate] = React12.useState({
|
|
1772
|
+
instance: { value, getSnapshot }
|
|
1773
|
+
});
|
|
1774
|
+
React12.useLayoutEffect(() => {
|
|
1775
|
+
instance.value = value;
|
|
1776
|
+
instance.getSnapshot = getSnapshot;
|
|
1777
|
+
if (checkIfSnapshotChanged(instance)) {
|
|
1778
|
+
forceUpdate({ instance });
|
|
1779
|
+
}
|
|
1780
|
+
}, [getSnapshot, instance, subscribe, value]);
|
|
1781
|
+
React12.useEffect(() => {
|
|
1782
|
+
if (checkIfSnapshotChanged(instance)) {
|
|
1783
|
+
forceUpdate({ instance });
|
|
1784
|
+
}
|
|
1785
|
+
return subscribe(() => {
|
|
1786
|
+
if (checkIfSnapshotChanged(instance)) {
|
|
1787
|
+
forceUpdate({ instance });
|
|
1788
|
+
}
|
|
1789
|
+
});
|
|
1790
|
+
}, [instance, subscribe]);
|
|
1791
|
+
React12.useDebugValue(value);
|
|
1792
|
+
return value;
|
|
1793
|
+
};
|
|
1794
|
+
var useSyncExternalStoreShimServer = (_subscribe, getSnapshot) => getSnapshot();
|
|
1795
|
+
var shim = typeof window === "undefined" || typeof window.document === "undefined" || typeof window.document.createElement === "undefined" ? useSyncExternalStoreShimServer : useSyncExternalStoreShimClient;
|
|
1796
|
+
var useSyncExternalStore2 = React12.useSyncExternalStore ?? shim;
|
|
1797
|
+
|
|
1798
|
+
// src/use-playing.ts
|
|
1799
|
+
var usePlaying = () => {
|
|
1800
|
+
const { isPlaying } = useTimelineContext();
|
|
1801
|
+
const { subscribePlaying } = useContext10(SetTimelineContext);
|
|
1802
|
+
return useSyncExternalStore2(subscribePlaying, isPlaying, isPlaying);
|
|
1803
|
+
};
|
|
1804
|
+
// src/use-buffering.ts
|
|
1805
|
+
import { useContext as useContext11 } from "react";
|
|
1806
|
+
var useBuffering = () => {
|
|
1807
|
+
const { isBuffering, subscribeBuffering } = useContext11(SetTimelineContext);
|
|
1808
|
+
return useSyncExternalStore2(subscribeBuffering, isBuffering, isBuffering);
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1700
1811
|
// src/timeline-position-state.ts
|
|
1701
1812
|
var makeKey = () => {
|
|
1702
1813
|
return `remotion.time-all`;
|
|
@@ -1733,14 +1844,14 @@ var useTimelinePositionFromContext = (state) => {
|
|
|
1733
1844
|
return clampFrameToCompositionRange(unclamped, videoConfig.durationInFrames);
|
|
1734
1845
|
};
|
|
1735
1846
|
var useTimelineContext = () => {
|
|
1736
|
-
const state =
|
|
1847
|
+
const state = useContext12(TimelineContext);
|
|
1737
1848
|
if (state === null) {
|
|
1738
1849
|
throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");
|
|
1739
1850
|
}
|
|
1740
1851
|
return state;
|
|
1741
1852
|
};
|
|
1742
1853
|
var usePlaybackRate = () => {
|
|
1743
|
-
const state =
|
|
1854
|
+
const state = useContext12(PlaybackRateContext);
|
|
1744
1855
|
if (state === null) {
|
|
1745
1856
|
throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");
|
|
1746
1857
|
}
|
|
@@ -1751,26 +1862,21 @@ var useTimelinePosition = () => {
|
|
|
1751
1862
|
return useTimelinePositionFromContext(state);
|
|
1752
1863
|
};
|
|
1753
1864
|
var useAbsoluteTimelinePosition = () => {
|
|
1754
|
-
const state =
|
|
1865
|
+
const state = useContext12(AbsoluteTimeContext);
|
|
1755
1866
|
if (state === null) {
|
|
1756
1867
|
throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");
|
|
1757
1868
|
}
|
|
1758
1869
|
return useTimelinePositionFromContext(state);
|
|
1759
1870
|
};
|
|
1760
1871
|
var useTimelineSetFrame = () => {
|
|
1761
|
-
const { setFrame } =
|
|
1872
|
+
const { setFrame } = useContext12(SetTimelineContext);
|
|
1762
1873
|
return setFrame;
|
|
1763
1874
|
};
|
|
1764
|
-
var usePlayingState = () => {
|
|
1765
|
-
const { playing, imperativePlaying } = useTimelineContext();
|
|
1766
|
-
const { setPlaying } = useContext11(SetTimelineContext);
|
|
1767
|
-
return useMemo10(() => [playing, setPlaying, imperativePlaying], [imperativePlaying, playing, setPlaying]);
|
|
1768
|
-
};
|
|
1769
1875
|
|
|
1770
1876
|
// src/use-current-frame.ts
|
|
1771
|
-
import { useContext as
|
|
1877
|
+
import { useContext as useContext13 } from "react";
|
|
1772
1878
|
var useCurrentFrame = () => {
|
|
1773
|
-
const canUseRemotionHooks =
|
|
1879
|
+
const canUseRemotionHooks = useContext13(CanUseRemotionHooks);
|
|
1774
1880
|
const env = useRemotionEnvironment();
|
|
1775
1881
|
if (!canUseRemotionHooks) {
|
|
1776
1882
|
if (env.isPlayer) {
|
|
@@ -1779,16 +1885,16 @@ var useCurrentFrame = () => {
|
|
|
1779
1885
|
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`);
|
|
1780
1886
|
}
|
|
1781
1887
|
const frame = useTimelinePosition();
|
|
1782
|
-
const context =
|
|
1888
|
+
const context = useContext13(SequenceContext);
|
|
1783
1889
|
const contextOffset = context ? context.cumulatedFrom + context.relativeFrom : 0;
|
|
1784
1890
|
return frame - contextOffset;
|
|
1785
1891
|
};
|
|
1786
1892
|
|
|
1787
1893
|
// src/use-video-config.ts
|
|
1788
|
-
import { useContext as
|
|
1894
|
+
import { useContext as useContext14 } from "react";
|
|
1789
1895
|
var useVideoConfig = () => {
|
|
1790
1896
|
const videoConfig = useUnsafeVideoConfig();
|
|
1791
|
-
const context =
|
|
1897
|
+
const context = useContext14(CanUseRemotionHooks);
|
|
1792
1898
|
const isPlayer = useIsPlayer();
|
|
1793
1899
|
if (!videoConfig) {
|
|
1794
1900
|
if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
|
|
@@ -1827,7 +1933,7 @@ var Freeze = ({
|
|
|
1827
1933
|
if (!Number.isFinite(frameToFreeze)) {
|
|
1828
1934
|
throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frameToFreeze}.`);
|
|
1829
1935
|
}
|
|
1830
|
-
const isActive =
|
|
1936
|
+
const isActive = useMemo9(() => {
|
|
1831
1937
|
if (typeof active === "boolean") {
|
|
1832
1938
|
return active;
|
|
1833
1939
|
}
|
|
@@ -1836,24 +1942,21 @@ var Freeze = ({
|
|
|
1836
1942
|
}
|
|
1837
1943
|
}, [active, frame]);
|
|
1838
1944
|
const timelineContext = useTimelineContext();
|
|
1839
|
-
const sequenceContext =
|
|
1945
|
+
const sequenceContext = useContext15(SequenceContext);
|
|
1840
1946
|
const relativeFrom = sequenceContext?.relativeFrom ?? 0;
|
|
1841
|
-
const timelineValue =
|
|
1947
|
+
const timelineValue = useMemo9(() => {
|
|
1842
1948
|
if (!isActive) {
|
|
1843
1949
|
return timelineContext;
|
|
1844
1950
|
}
|
|
1845
1951
|
return {
|
|
1846
1952
|
...timelineContext,
|
|
1847
|
-
|
|
1848
|
-
imperativePlaying: {
|
|
1849
|
-
current: false
|
|
1850
|
-
},
|
|
1953
|
+
isPlaying: () => false,
|
|
1851
1954
|
frame: {
|
|
1852
1955
|
[videoConfig.id]: frameToFreeze + relativeFrom
|
|
1853
1956
|
}
|
|
1854
1957
|
};
|
|
1855
1958
|
}, [isActive, timelineContext, videoConfig.id, frameToFreeze, relativeFrom]);
|
|
1856
|
-
const newSequenceContext =
|
|
1959
|
+
const newSequenceContext = useMemo9(() => {
|
|
1857
1960
|
if (!sequenceContext) {
|
|
1858
1961
|
return null;
|
|
1859
1962
|
}
|
|
@@ -1950,22 +2053,10 @@ var textSchema = {
|
|
|
1950
2053
|
hiddenFromList: false
|
|
1951
2054
|
},
|
|
1952
2055
|
"style.fontWeight": {
|
|
1953
|
-
type: "
|
|
1954
|
-
default:
|
|
2056
|
+
type: "font-weight",
|
|
2057
|
+
default: 400,
|
|
1955
2058
|
description: "Font weight",
|
|
1956
|
-
|
|
1957
|
-
"100": {},
|
|
1958
|
-
"200": {},
|
|
1959
|
-
"300": {},
|
|
1960
|
-
"400": {},
|
|
1961
|
-
"500": {},
|
|
1962
|
-
"600": {},
|
|
1963
|
-
"700": {},
|
|
1964
|
-
"800": {},
|
|
1965
|
-
"900": {},
|
|
1966
|
-
normal: {},
|
|
1967
|
-
bold: {}
|
|
1968
|
-
}
|
|
2059
|
+
keyframable: false
|
|
1969
2060
|
},
|
|
1970
2061
|
"style.fontStyle": {
|
|
1971
2062
|
type: "enum",
|
|
@@ -2335,31 +2426,33 @@ var validateSequenceCrop = (crop, componentName = "<Sequence />") => {
|
|
|
2335
2426
|
};
|
|
2336
2427
|
|
|
2337
2428
|
// src/SequenceManager.tsx
|
|
2338
|
-
import
|
|
2429
|
+
import React14, { useCallback as useCallback5, useMemo as useMemo10, useRef as useRef3, useState as useState4 } from "react";
|
|
2339
2430
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2340
|
-
var
|
|
2431
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? React14.useEffect : React14.useLayoutEffect;
|
|
2432
|
+
var SequenceManager = React14.createContext({
|
|
2341
2433
|
registerSequence: () => {
|
|
2342
2434
|
throw new Error("SequenceManagerContext not initialized");
|
|
2343
2435
|
},
|
|
2436
|
+
updateSequence: null,
|
|
2344
2437
|
unregisterSequence: () => {
|
|
2345
2438
|
throw new Error("SequenceManagerContext not initialized");
|
|
2346
2439
|
},
|
|
2347
2440
|
sequences: []
|
|
2348
2441
|
});
|
|
2349
|
-
var SequenceManagerRefContext =
|
|
2442
|
+
var SequenceManagerRefContext = React14.createContext({
|
|
2350
2443
|
current: []
|
|
2351
2444
|
});
|
|
2352
|
-
var SequenceRegistrationContext =
|
|
2445
|
+
var SequenceRegistrationContext = React14.createContext(false);
|
|
2353
2446
|
var makeSequencePropsSubscriptionKey = (key) => {
|
|
2354
2447
|
return `${key.absolutePath}\x00${key.nodePath.join(".")}\x00${key.sequenceKeys.join(".")}\x00${key.effectKeys.map((keys) => keys.join(".")).join(".")}`;
|
|
2355
2448
|
};
|
|
2356
|
-
var VisualModePropStatusesContext =
|
|
2449
|
+
var VisualModePropStatusesContext = React14.createContext({
|
|
2357
2450
|
propStatuses: {}
|
|
2358
2451
|
});
|
|
2359
|
-
var VisualModePropStatusesRefContext =
|
|
2452
|
+
var VisualModePropStatusesRefContext = React14.createContext({
|
|
2360
2453
|
current: {}
|
|
2361
2454
|
});
|
|
2362
|
-
var VisualModeDragOverridesContext =
|
|
2455
|
+
var VisualModeDragOverridesContext = React14.createContext({
|
|
2363
2456
|
getDragOverrides: () => {
|
|
2364
2457
|
throw new Error("VisualModeDragOverridesContext not initialized");
|
|
2365
2458
|
},
|
|
@@ -2367,7 +2460,7 @@ var VisualModeDragOverridesContext = React13.createContext({
|
|
|
2367
2460
|
throw new Error("VisualModeDragOverridesContext not initialized");
|
|
2368
2461
|
}
|
|
2369
2462
|
});
|
|
2370
|
-
var VisualModeSettersContext =
|
|
2463
|
+
var VisualModeSettersContext = React14.createContext({
|
|
2371
2464
|
setDragOverrides: () => {
|
|
2372
2465
|
throw new Error("VisualModeSettersContext not initialized");
|
|
2373
2466
|
},
|
|
@@ -2389,15 +2482,19 @@ var VisualModeSettersContext = React13.createContext({
|
|
|
2389
2482
|
});
|
|
2390
2483
|
var effectDragOverridesKey = (nodePath, effectIndex) => `${makeSequencePropsSubscriptionKey(nodePath)}.effects.${effectIndex}`;
|
|
2391
2484
|
var SequenceManagerProvider = ({ children }) => {
|
|
2392
|
-
const
|
|
2393
|
-
const
|
|
2485
|
+
const { isStudio } = useRemotionEnvironment();
|
|
2486
|
+
const [sequenceManagerId] = useState4(() => String(Math.random()));
|
|
2487
|
+
const committedOrderRef = useRef3(null);
|
|
2488
|
+
const committedOrderIdsRef = useRef3(null);
|
|
2489
|
+
const [sequences, setSequences] = useState4([]);
|
|
2490
|
+
const sequencesRef = useRef3(sequences);
|
|
2394
2491
|
sequencesRef.current = sequences;
|
|
2395
|
-
const [dragOverrides, setControlOverrides] =
|
|
2396
|
-
const controlOverridesRef =
|
|
2492
|
+
const [dragOverrides, setControlOverrides] = useState4({});
|
|
2493
|
+
const controlOverridesRef = useRef3(dragOverrides);
|
|
2397
2494
|
controlOverridesRef.current = dragOverrides;
|
|
2398
|
-
const [effectDragOverridesState, setEffectDragOverridesState] =
|
|
2399
|
-
const [propStatuses, setPropStatusesMapState] =
|
|
2400
|
-
const propStatusesRef =
|
|
2495
|
+
const [effectDragOverridesState, setEffectDragOverridesState] = useState4({});
|
|
2496
|
+
const [propStatuses, setPropStatusesMapState] = useState4({});
|
|
2497
|
+
const propStatusesRef = useRef3(propStatuses);
|
|
2401
2498
|
propStatusesRef.current = propStatuses;
|
|
2402
2499
|
const setDragOverrides = useCallback5((nodePath, key, value) => {
|
|
2403
2500
|
setControlOverrides((prev) => ({
|
|
@@ -2467,39 +2564,105 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
2467
2564
|
return next;
|
|
2468
2565
|
});
|
|
2469
2566
|
}, []);
|
|
2567
|
+
useIsomorphicLayoutEffect(() => {
|
|
2568
|
+
if (!isStudio) {
|
|
2569
|
+
return;
|
|
2570
|
+
}
|
|
2571
|
+
let unmounted = false;
|
|
2572
|
+
const onCommitOrder = (event) => {
|
|
2573
|
+
const { detail } = event;
|
|
2574
|
+
const managerOrder = detail.sequenceManagers.find((item) => item.managerId === sequenceManagerId);
|
|
2575
|
+
if (!managerOrder) {
|
|
2576
|
+
return;
|
|
2577
|
+
}
|
|
2578
|
+
const previousOrder = committedOrderIdsRef.current;
|
|
2579
|
+
if (previousOrder !== null && previousOrder.length === managerOrder.sequenceIds.length && previousOrder.every((sequenceId, index) => sequenceId === managerOrder.sequenceIds[index])) {
|
|
2580
|
+
return;
|
|
2581
|
+
}
|
|
2582
|
+
const order = new Map(managerOrder.sequenceIds.map((sequenceId, index) => [
|
|
2583
|
+
sequenceId,
|
|
2584
|
+
index
|
|
2585
|
+
]));
|
|
2586
|
+
committedOrderIdsRef.current = managerOrder.sequenceIds;
|
|
2587
|
+
committedOrderRef.current = order;
|
|
2588
|
+
queueMicrotask(() => {
|
|
2589
|
+
if (unmounted) {
|
|
2590
|
+
return;
|
|
2591
|
+
}
|
|
2592
|
+
setSequences((currentSequences) => {
|
|
2593
|
+
let changed = false;
|
|
2594
|
+
const nextSequences = currentSequences.map((sequence) => {
|
|
2595
|
+
const timelineOrder = order.get(sequence.id) ?? null;
|
|
2596
|
+
if (sequence.timelineOrder === timelineOrder) {
|
|
2597
|
+
return sequence;
|
|
2598
|
+
}
|
|
2599
|
+
changed = true;
|
|
2600
|
+
return { ...sequence, timelineOrder };
|
|
2601
|
+
});
|
|
2602
|
+
return changed ? nextSequences : currentSequences;
|
|
2603
|
+
});
|
|
2604
|
+
});
|
|
2605
|
+
};
|
|
2606
|
+
window.addEventListener(COMMIT_ORDER_EVENT, onCommitOrder);
|
|
2607
|
+
return () => {
|
|
2608
|
+
unmounted = true;
|
|
2609
|
+
window.removeEventListener(COMMIT_ORDER_EVENT, onCommitOrder);
|
|
2610
|
+
};
|
|
2611
|
+
}, [isStudio, sequenceManagerId]);
|
|
2470
2612
|
const registerSequence = useCallback5((seq) => {
|
|
2471
2613
|
setSequences((seqs) => {
|
|
2472
|
-
return [
|
|
2614
|
+
return [
|
|
2615
|
+
...seqs,
|
|
2616
|
+
{
|
|
2617
|
+
...seq,
|
|
2618
|
+
timelineOrder: committedOrderRef.current?.get(seq.id) ?? null
|
|
2619
|
+
}
|
|
2620
|
+
];
|
|
2621
|
+
});
|
|
2622
|
+
}, []);
|
|
2623
|
+
const updateSequence = useCallback5((seq) => {
|
|
2624
|
+
setSequences((seqs) => {
|
|
2625
|
+
const index = seqs.findIndex((item) => item.id === seq.id);
|
|
2626
|
+
if (index === -1) {
|
|
2627
|
+
return seqs;
|
|
2628
|
+
}
|
|
2629
|
+
const next = [...seqs];
|
|
2630
|
+
next[index] = {
|
|
2631
|
+
...seq,
|
|
2632
|
+
timelineOrder: committedOrderRef.current?.get(seq.id) ?? null
|
|
2633
|
+
};
|
|
2634
|
+
return next;
|
|
2473
2635
|
});
|
|
2474
2636
|
}, []);
|
|
2475
2637
|
const unregisterSequence = useCallback5((seq) => {
|
|
2476
2638
|
setSequences((seqs) => seqs.filter((s) => s.id !== seq));
|
|
2477
2639
|
}, []);
|
|
2478
|
-
const sequenceContext =
|
|
2640
|
+
const sequenceContext = useMemo10(() => {
|
|
2479
2641
|
return {
|
|
2480
2642
|
registerSequence,
|
|
2481
2643
|
sequences,
|
|
2644
|
+
updateSequence,
|
|
2482
2645
|
unregisterSequence
|
|
2483
2646
|
};
|
|
2484
|
-
}, [registerSequence, sequences, unregisterSequence]);
|
|
2647
|
+
}, [registerSequence, sequences, unregisterSequence, updateSequence]);
|
|
2485
2648
|
const getDragOverrides = useCallback5((nodePath) => {
|
|
2486
2649
|
return dragOverrides[makeSequencePropsSubscriptionKey(nodePath)] ?? {};
|
|
2487
2650
|
}, [dragOverrides]);
|
|
2488
2651
|
const getEffectDragOverrides = useCallback5((nodePath, effectIndex) => {
|
|
2489
2652
|
return effectDragOverridesState[effectDragOverridesKey(nodePath, effectIndex)] ?? {};
|
|
2490
2653
|
}, [effectDragOverridesState]);
|
|
2491
|
-
const propStatusesContext =
|
|
2654
|
+
const propStatusesContext = useMemo10(() => {
|
|
2492
2655
|
return {
|
|
2493
2656
|
propStatuses
|
|
2494
2657
|
};
|
|
2495
2658
|
}, [propStatuses]);
|
|
2496
|
-
const dragOverridesContext =
|
|
2659
|
+
const dragOverridesContext = useMemo10(() => {
|
|
2497
2660
|
return {
|
|
2498
2661
|
getDragOverrides,
|
|
2499
2662
|
getEffectDragOverrides
|
|
2500
2663
|
};
|
|
2501
2664
|
}, [getDragOverrides, getEffectDragOverrides]);
|
|
2502
|
-
const settersContext =
|
|
2665
|
+
const settersContext = useMemo10(() => {
|
|
2503
2666
|
return {
|
|
2504
2667
|
setDragOverrides,
|
|
2505
2668
|
clearDragOverrides,
|
|
@@ -2516,7 +2679,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
2516
2679
|
setPropStatuses,
|
|
2517
2680
|
remapPropStatuses
|
|
2518
2681
|
]);
|
|
2519
|
-
|
|
2682
|
+
const providers = /* @__PURE__ */ jsx10(SequenceManagerRefContext.Provider, {
|
|
2520
2683
|
value: sequencesRef,
|
|
2521
2684
|
children: /* @__PURE__ */ jsx10(SequenceManager.Provider, {
|
|
2522
2685
|
value: sequenceContext,
|
|
@@ -2535,12 +2698,16 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
2535
2698
|
})
|
|
2536
2699
|
})
|
|
2537
2700
|
});
|
|
2701
|
+
return isStudio ? /* @__PURE__ */ jsx10(SequenceManagerOrderMarker, {
|
|
2702
|
+
managerId: sequenceManagerId,
|
|
2703
|
+
children: providers
|
|
2704
|
+
}) : providers;
|
|
2538
2705
|
};
|
|
2539
2706
|
|
|
2540
2707
|
// src/series/is-inside-series.tsx
|
|
2541
|
-
import
|
|
2708
|
+
import React15, { createContext as createContext14 } from "react";
|
|
2542
2709
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2543
|
-
var IsInsideSeriesContext =
|
|
2710
|
+
var IsInsideSeriesContext = createContext14(false);
|
|
2544
2711
|
var IsInsideSeriesContainer = ({ children }) => {
|
|
2545
2712
|
return /* @__PURE__ */ jsx11(IsInsideSeriesContext.Provider, {
|
|
2546
2713
|
value: true,
|
|
@@ -2554,18 +2721,18 @@ var IsNotInsideSeriesProvider = ({ children }) => {
|
|
|
2554
2721
|
});
|
|
2555
2722
|
};
|
|
2556
2723
|
var useRequireToBeInsideSeries = () => {
|
|
2557
|
-
const isInsideSeries =
|
|
2724
|
+
const isInsideSeries = React15.useContext(IsInsideSeriesContext);
|
|
2558
2725
|
if (!isInsideSeries) {
|
|
2559
2726
|
throw new Error("This component must be inside a <Series /> component.");
|
|
2560
2727
|
}
|
|
2561
2728
|
};
|
|
2562
2729
|
|
|
2563
2730
|
// src/use-premounting.ts
|
|
2564
|
-
import { useContext as
|
|
2731
|
+
import { useContext as useContext16, useMemo as useMemo11 } from "react";
|
|
2565
2732
|
|
|
2566
2733
|
// src/PremountContext.tsx
|
|
2567
|
-
import { createContext as
|
|
2568
|
-
var PremountContext =
|
|
2734
|
+
import { createContext as createContext15 } from "react";
|
|
2735
|
+
var PremountContext = createContext15({
|
|
2569
2736
|
premountFramesRemaining: 0
|
|
2570
2737
|
});
|
|
2571
2738
|
|
|
@@ -2586,7 +2753,7 @@ var usePremounting = ({
|
|
|
2586
2753
|
styleWhilePostmounted,
|
|
2587
2754
|
hideWhilePremounted
|
|
2588
2755
|
}) => {
|
|
2589
|
-
const parentPremountContext =
|
|
2756
|
+
const parentPremountContext = useContext16(PremountContext);
|
|
2590
2757
|
const frame = useCurrentFrame() - parentPremountContext.premountFramesRemaining;
|
|
2591
2758
|
const environment = useRemotionEnvironment();
|
|
2592
2759
|
const { fps } = useVideoConfig();
|
|
@@ -2597,7 +2764,7 @@ var usePremounting = ({
|
|
|
2597
2764
|
const postmountingActive = !environment.isRendering && frame > endThreshold && frame <= endThreshold + effectivePostmountFor;
|
|
2598
2765
|
const isPremountingOrPostmounting = premountingActive || postmountingActive;
|
|
2599
2766
|
const freezeFrame = premountingActive ? from : postmountingActive ? from + durationInFrames - 1 : 0;
|
|
2600
|
-
const premountingStyle =
|
|
2767
|
+
const premountingStyle = useMemo11(() => {
|
|
2601
2768
|
if (!isPremountingOrPostmounting) {
|
|
2602
2769
|
return style;
|
|
2603
2770
|
}
|
|
@@ -2628,14 +2795,49 @@ var usePremounting = ({
|
|
|
2628
2795
|
};
|
|
2629
2796
|
};
|
|
2630
2797
|
|
|
2798
|
+
// src/use-sequence-registration.ts
|
|
2799
|
+
import { useContext as useContext17, useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
2800
|
+
var useSequenceRegistration = ({
|
|
2801
|
+
getSequence,
|
|
2802
|
+
id
|
|
2803
|
+
}) => {
|
|
2804
|
+
const { registerSequence, unregisterSequence, updateSequence } = useContext17(SequenceManager);
|
|
2805
|
+
const getSequenceRef = useRef4(getSequence);
|
|
2806
|
+
getSequenceRef.current = getSequence;
|
|
2807
|
+
const lastRegisteredGetterRef = useRef4(null);
|
|
2808
|
+
const registrationEnabled = getSequence !== null;
|
|
2809
|
+
useEffect4(() => {
|
|
2810
|
+
if (!registrationEnabled) {
|
|
2811
|
+
return;
|
|
2812
|
+
}
|
|
2813
|
+
const currentGetter = getSequenceRef.current;
|
|
2814
|
+
if (currentGetter === null) {
|
|
2815
|
+
throw new Error("Expected a sequence registration getter");
|
|
2816
|
+
}
|
|
2817
|
+
registerSequence(currentGetter());
|
|
2818
|
+
lastRegisteredGetterRef.current = currentGetter;
|
|
2819
|
+
return () => {
|
|
2820
|
+
lastRegisteredGetterRef.current = null;
|
|
2821
|
+
unregisterSequence(id);
|
|
2822
|
+
};
|
|
2823
|
+
}, [id, registerSequence, registrationEnabled, unregisterSequence]);
|
|
2824
|
+
useEffect4(() => {
|
|
2825
|
+
if (getSequence === null || updateSequence === null || lastRegisteredGetterRef.current === getSequence) {
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
updateSequence(getSequence());
|
|
2829
|
+
lastRegisteredGetterRef.current = getSequence;
|
|
2830
|
+
}, [getSequence, updateSequence]);
|
|
2831
|
+
};
|
|
2832
|
+
|
|
2631
2833
|
// src/with-interactivity-schema.ts
|
|
2632
|
-
import
|
|
2633
|
-
createContext as
|
|
2834
|
+
import React16, {
|
|
2835
|
+
createContext as createContext17,
|
|
2634
2836
|
forwardRef as forwardRef2,
|
|
2635
|
-
useContext as
|
|
2636
|
-
useLayoutEffect as
|
|
2637
|
-
useMemo as
|
|
2638
|
-
useState as
|
|
2837
|
+
useContext as useContext19,
|
|
2838
|
+
useLayoutEffect as useLayoutEffect4,
|
|
2839
|
+
useMemo as useMemo12,
|
|
2840
|
+
useState as useState5
|
|
2639
2841
|
} from "react";
|
|
2640
2842
|
|
|
2641
2843
|
// src/delete-nested-key.ts
|
|
@@ -2672,7 +2874,7 @@ var deleteNestedKey = (obj, keysToRemove) => {
|
|
|
2672
2874
|
};
|
|
2673
2875
|
|
|
2674
2876
|
// src/effects/use-memoized-effects.ts
|
|
2675
|
-
import { useContext as
|
|
2877
|
+
import { useContext as useContext18, useLayoutEffect as useLayoutEffect3, useRef as useRef5 } from "react";
|
|
2676
2878
|
|
|
2677
2879
|
// src/bezier.ts
|
|
2678
2880
|
var NEWTON_ITERATIONS = 4;
|
|
@@ -4542,39 +4744,12 @@ var getEffectiveVisualModeValue = ({
|
|
|
4542
4744
|
return propStatus.codeValue;
|
|
4543
4745
|
};
|
|
4544
4746
|
|
|
4545
|
-
// src/runtime-value-store.ts
|
|
4546
|
-
var createRuntimeValueStore = (initialSnapshot) => {
|
|
4547
|
-
let snapshot = initialSnapshot;
|
|
4548
|
-
const listeners = new Set;
|
|
4549
|
-
const store = {
|
|
4550
|
-
getSnapshot: () => snapshot,
|
|
4551
|
-
subscribe: (listener) => {
|
|
4552
|
-
listeners.add(listener);
|
|
4553
|
-
return () => {
|
|
4554
|
-
listeners.delete(listener);
|
|
4555
|
-
};
|
|
4556
|
-
}
|
|
4557
|
-
};
|
|
4558
|
-
return {
|
|
4559
|
-
store,
|
|
4560
|
-
setSnapshot: (newSnapshot) => {
|
|
4561
|
-
if (snapshot === newSnapshot) {
|
|
4562
|
-
return;
|
|
4563
|
-
}
|
|
4564
|
-
snapshot = newSnapshot;
|
|
4565
|
-
for (const listener of listeners) {
|
|
4566
|
-
listener();
|
|
4567
|
-
}
|
|
4568
|
-
}
|
|
4569
|
-
};
|
|
4570
|
-
};
|
|
4571
|
-
|
|
4572
4747
|
// src/sequence-node-path.tsx
|
|
4573
|
-
import { createContext as
|
|
4574
|
-
var OverrideIdsToNodePathsGettersContext =
|
|
4748
|
+
import { createContext as createContext16 } from "react";
|
|
4749
|
+
var OverrideIdsToNodePathsGettersContext = createContext16({
|
|
4575
4750
|
overrideIdToNodePathMappings: {}
|
|
4576
4751
|
});
|
|
4577
|
-
var OverrideIdsToNodePathsSettersContext =
|
|
4752
|
+
var OverrideIdsToNodePathsSettersContext = createContext16({
|
|
4578
4753
|
setOverrideIdToNodePath: () => {
|
|
4579
4754
|
throw new Error("OverrideIdsToNodePathsSettersContext not initialized");
|
|
4580
4755
|
}
|
|
@@ -4649,7 +4824,7 @@ var useMemoizedEffectDefinitions = (effects) => {
|
|
|
4649
4824
|
const isSame = previous !== null && previous.definitions.length === definitions.length && previous.definitions.every((definition, i) => definition === definitions[i]);
|
|
4650
4825
|
const controllers = isSame ? previous.controllers : effects.map((effect) => createRuntimeValueStore(effect.params));
|
|
4651
4826
|
const stableDefinitions = isSame ? previous.definitions : definitions;
|
|
4652
|
-
|
|
4827
|
+
useLayoutEffect3(() => {
|
|
4653
4828
|
stableDefinitions.forEach((_definition, index) => {
|
|
4654
4829
|
const snapshot = effects[index]?.params;
|
|
4655
4830
|
controllers[index].setSnapshot(snapshot);
|
|
@@ -4696,10 +4871,10 @@ var useMemoizedEffects = ({
|
|
|
4696
4871
|
overrideId
|
|
4697
4872
|
}) => {
|
|
4698
4873
|
const previousRef = useRef5(null);
|
|
4699
|
-
const { propStatuses } =
|
|
4700
|
-
const { getEffectDragOverrides } =
|
|
4874
|
+
const { propStatuses } = useContext18(VisualModePropStatusesContext);
|
|
4875
|
+
const { getEffectDragOverrides } = useContext18(VisualModeDragOverridesContext);
|
|
4701
4876
|
const frame = useCurrentFrame();
|
|
4702
|
-
const { overrideIdToNodePathMappings } =
|
|
4877
|
+
const { overrideIdToNodePathMappings } = useContext18(OverrideIdsToNodePathsGettersContext);
|
|
4703
4878
|
const previous = previousRef.current;
|
|
4704
4879
|
const nodePath = overrideId ? overrideIdToNodePathMappings[overrideId] ?? null : null;
|
|
4705
4880
|
const resolved = effects.map((descriptor, index) => {
|
|
@@ -5033,9 +5208,9 @@ var mergeValues = ({
|
|
|
5033
5208
|
return merged;
|
|
5034
5209
|
};
|
|
5035
5210
|
var stackToOverrideMap = {};
|
|
5036
|
-
var DisableInteractivityContext =
|
|
5211
|
+
var DisableInteractivityContext = createContext17(false);
|
|
5037
5212
|
var DisableInteractivityProvider = ({ children }) => {
|
|
5038
|
-
return
|
|
5213
|
+
return React16.createElement(DisableInteractivityContext.Provider, { value: true }, children);
|
|
5039
5214
|
};
|
|
5040
5215
|
var withInteractivitySchema = ({
|
|
5041
5216
|
Component,
|
|
@@ -5054,30 +5229,30 @@ var withInteractivitySchema = ({
|
|
|
5054
5229
|
} = props;
|
|
5055
5230
|
const cleanProps = propsWithoutInternalStack;
|
|
5056
5231
|
const env = useRemotionEnvironment();
|
|
5057
|
-
const canUseRemotionHooks =
|
|
5058
|
-
const disableInteractivity =
|
|
5232
|
+
const canUseRemotionHooks = useContext19(CanUseRemotionHooks);
|
|
5233
|
+
const disableInteractivity = useContext19(DisableInteractivityContext);
|
|
5059
5234
|
if (!env.isStudio || env.isRendering || !canUseRemotionHooks || disableInteractivity) {
|
|
5060
|
-
return
|
|
5235
|
+
return React16.createElement(Component, {
|
|
5061
5236
|
...cleanProps,
|
|
5062
5237
|
controls: null,
|
|
5063
5238
|
ref
|
|
5064
5239
|
});
|
|
5065
5240
|
}
|
|
5066
|
-
const { propStatuses } =
|
|
5067
|
-
const { getDragOverrides } =
|
|
5068
|
-
const nodePathMapping =
|
|
5241
|
+
const { propStatuses } = useContext19(VisualModePropStatusesContext);
|
|
5242
|
+
const { getDragOverrides } = useContext19(VisualModeDragOverridesContext);
|
|
5243
|
+
const nodePathMapping = useContext19(OverrideIdsToNodePathsGettersContext);
|
|
5069
5244
|
const frame = useCurrentFrame();
|
|
5070
5245
|
if (cleanProps.controls) {
|
|
5071
5246
|
const passedControls = cleanProps.controls;
|
|
5072
5247
|
if (getStackForControls(passedControls) === null) {
|
|
5073
5248
|
setStackForControls(passedControls, internalStack);
|
|
5074
5249
|
}
|
|
5075
|
-
return
|
|
5250
|
+
return React16.createElement(Component, {
|
|
5076
5251
|
...cleanProps,
|
|
5077
5252
|
ref
|
|
5078
5253
|
});
|
|
5079
5254
|
}
|
|
5080
|
-
const [overrideId] =
|
|
5255
|
+
const [overrideId] = useState5(() => {
|
|
5081
5256
|
if (!internalStack) {
|
|
5082
5257
|
return String(Math.random());
|
|
5083
5258
|
}
|
|
@@ -5095,12 +5270,12 @@ var withInteractivitySchema = ({
|
|
|
5095
5270
|
key,
|
|
5096
5271
|
props: cleanProps
|
|
5097
5272
|
}));
|
|
5098
|
-
const currentRuntimeValueDotNotation =
|
|
5099
|
-
const [runtimeValueStore] =
|
|
5100
|
-
|
|
5273
|
+
const currentRuntimeValueDotNotation = useMemo12(() => readValuesFromProps(cleanProps, flatKeys, flatSchema), runtimeValues);
|
|
5274
|
+
const [runtimeValueStore] = useState5(() => createRuntimeValueStore(currentRuntimeValueDotNotation));
|
|
5275
|
+
useLayoutEffect4(() => {
|
|
5101
5276
|
runtimeValueStore.setSnapshot(currentRuntimeValueDotNotation);
|
|
5102
5277
|
}, [currentRuntimeValueDotNotation, runtimeValueStore]);
|
|
5103
|
-
const controls =
|
|
5278
|
+
const controls = useMemo12(() => {
|
|
5104
5279
|
return {
|
|
5105
5280
|
schema: schemaWithSequenceName,
|
|
5106
5281
|
currentRuntimeValueDotNotation,
|
|
@@ -5112,7 +5287,7 @@ var withInteractivitySchema = ({
|
|
|
5112
5287
|
};
|
|
5113
5288
|
}, [currentRuntimeValueDotNotation, overrideId, runtimeValueStore.store]);
|
|
5114
5289
|
setStackForControls(controls, internalStack);
|
|
5115
|
-
const { merged: valuesDotNotation, propsToDelete } =
|
|
5290
|
+
const { merged: valuesDotNotation, propsToDelete } = useMemo12(() => {
|
|
5116
5291
|
return computeEffectiveSchemaValuesDotNotation({
|
|
5117
5292
|
schema: schemaWithSequenceName,
|
|
5118
5293
|
currentValue: currentRuntimeValueDotNotation,
|
|
@@ -5135,7 +5310,7 @@ var withInteractivitySchema = ({
|
|
|
5135
5310
|
schemaKeys: activeKeys,
|
|
5136
5311
|
propsToDelete
|
|
5137
5312
|
});
|
|
5138
|
-
return
|
|
5313
|
+
return React16.createElement(Component, {
|
|
5139
5314
|
...mergedProps,
|
|
5140
5315
|
controls,
|
|
5141
5316
|
ref
|
|
@@ -5176,10 +5351,9 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5176
5351
|
...other
|
|
5177
5352
|
}, ref) => {
|
|
5178
5353
|
const { layout = "absolute-fill" } = other;
|
|
5179
|
-
const [id] =
|
|
5180
|
-
const parentSequence =
|
|
5354
|
+
const [id] = useState6(() => String(Math.random()));
|
|
5355
|
+
const parentSequence = useContext20(SequenceContext);
|
|
5181
5356
|
const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
|
|
5182
|
-
const nonce = useNonce();
|
|
5183
5357
|
if (layout !== "absolute-fill" && layout !== "none") {
|
|
5184
5358
|
throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
|
|
5185
5359
|
}
|
|
@@ -5239,14 +5413,13 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5239
5413
|
const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + effectiveRelativeFrom;
|
|
5240
5414
|
const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - effectiveRelativeFrom, durationInFrames) : durationInFrames;
|
|
5241
5415
|
const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
|
|
5242
|
-
const
|
|
5243
|
-
const sequenceRegistrationEnabled = useContext18(SequenceRegistrationContext);
|
|
5416
|
+
const sequenceRegistrationEnabled = useContext20(SequenceRegistrationContext);
|
|
5244
5417
|
const wrapperRefForOutline = useRef6(null);
|
|
5245
5418
|
const refForOutline = other.layout === "none" ? passedRefForOutline ?? null : passedRefForOutline ?? wrapperRefForOutline;
|
|
5246
|
-
const premounting =
|
|
5419
|
+
const premounting = useMemo13(() => {
|
|
5247
5420
|
return parentSequence?.premounting || Boolean(other._remotionInternalIsPremounting);
|
|
5248
5421
|
}, [other._remotionInternalIsPremounting, parentSequence?.premounting]);
|
|
5249
|
-
const postmounting =
|
|
5422
|
+
const postmounting = useMemo13(() => {
|
|
5250
5423
|
return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
|
|
5251
5424
|
}, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
|
|
5252
5425
|
const currentSequenceStart = cumulatedFrom + effectiveRelativeFrom;
|
|
@@ -5254,7 +5427,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5254
5427
|
const parentFirstFrame = parentSequence ? parentSequenceStart - parentSequence.cumulatedNegativeFrom : 0;
|
|
5255
5428
|
const firstFrame = Math.max(0, parentFirstFrame, currentSequenceStart);
|
|
5256
5429
|
const cumulatedNegativeFrom = currentSequenceStart - firstFrame;
|
|
5257
|
-
const contextValue =
|
|
5430
|
+
const contextValue = useMemo13(() => {
|
|
5258
5431
|
return {
|
|
5259
5432
|
absoluteFrom,
|
|
5260
5433
|
cumulatedFrom,
|
|
@@ -5285,12 +5458,12 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5285
5458
|
postmountDisplay,
|
|
5286
5459
|
cumulatedNegativeFrom
|
|
5287
5460
|
]);
|
|
5288
|
-
const timelineClipName =
|
|
5461
|
+
const timelineClipName = useMemo13(() => {
|
|
5289
5462
|
return name ?? "";
|
|
5290
5463
|
}, [name]);
|
|
5291
5464
|
const resolvedDocumentationLink = documentationLink ?? "https://www.remotion.dev/docs/sequence";
|
|
5292
5465
|
const env = useRemotionEnvironment();
|
|
5293
|
-
const isInsideSeries =
|
|
5466
|
+
const isInsideSeries = useContext20(IsInsideSeriesContext);
|
|
5294
5467
|
const stackRef = useRef6(null);
|
|
5295
5468
|
stackRef.current = controls ? getStackForControls(controls) ?? stack ?? null : stack ?? null;
|
|
5296
5469
|
const registeredFrozenFrame = typeof freeze === "number" ? freeze : null;
|
|
@@ -5305,8 +5478,8 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5305
5478
|
const controlsSupportsEffects = controls?.supportsEffects;
|
|
5306
5479
|
const controlsComponentIdentity = controls?.componentIdentity;
|
|
5307
5480
|
const controlsComponentName = controls?.componentName;
|
|
5308
|
-
const effectRuntimeValues =
|
|
5309
|
-
const registrationControls =
|
|
5481
|
+
const effectRuntimeValues = useMemo13(() => _remotionInternalEffects?.runtimeValues ?? null, [_remotionInternalEffects]);
|
|
5482
|
+
const registrationControls = useMemo13(() => {
|
|
5310
5483
|
if (controlsSchema === undefined || controlsRuntimeValues === undefined || controlsOverrideId === undefined || controlsSupportsEffects === undefined || controlsComponentIdentity === undefined || controlsComponentName === undefined) {
|
|
5311
5484
|
return null;
|
|
5312
5485
|
}
|
|
@@ -5326,13 +5499,10 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5326
5499
|
controlsSchema,
|
|
5327
5500
|
controlsSupportsEffects
|
|
5328
5501
|
]);
|
|
5329
|
-
|
|
5330
|
-
if (!env.isStudio && !sequenceRegistrationEnabled) {
|
|
5331
|
-
return;
|
|
5332
|
-
}
|
|
5502
|
+
const getSequenceForRegistration = useCallback6(() => {
|
|
5333
5503
|
if (isMedia) {
|
|
5334
5504
|
if (isMedia.type === "image") {
|
|
5335
|
-
|
|
5505
|
+
return {
|
|
5336
5506
|
type: "image",
|
|
5337
5507
|
controls: registrationControls,
|
|
5338
5508
|
effects: _remotionInternalEffects ?? EMPTY_EFFECTS,
|
|
@@ -5344,56 +5514,52 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5344
5514
|
trimBefore: registeredTrimBefore,
|
|
5345
5515
|
id,
|
|
5346
5516
|
loopDisplay,
|
|
5347
|
-
nonce: nonce.get(),
|
|
5348
5517
|
parent: parentSequence?.id ?? null,
|
|
5349
5518
|
postmountDisplay: postmountDisplay ?? null,
|
|
5350
5519
|
premountDisplay: premountDisplay ?? null,
|
|
5351
5520
|
showInTimeline,
|
|
5521
|
+
timelineOrder: null,
|
|
5352
5522
|
src: isMedia.src,
|
|
5353
5523
|
getStack: () => stackRef.current,
|
|
5354
5524
|
refForOutline: refForOutline ?? null,
|
|
5355
5525
|
isInsideSeries,
|
|
5356
5526
|
frozenFrame: registeredFrozenFrame,
|
|
5357
5527
|
singleChildComponent: singleChildComponent ?? null
|
|
5358
|
-
}
|
|
5359
|
-
} else {
|
|
5360
|
-
registerSequence({
|
|
5361
|
-
type: isMedia.type,
|
|
5362
|
-
controls: registrationControls,
|
|
5363
|
-
effects: _remotionInternalEffects ?? EMPTY_EFFECTS,
|
|
5364
|
-
effectRuntimeValues,
|
|
5365
|
-
displayName: timelineClipName,
|
|
5366
|
-
documentationLink: resolvedDocumentationLink,
|
|
5367
|
-
doesVolumeChange: isMedia.data.doesVolumeChange,
|
|
5368
|
-
duration: actualDurationInFrames,
|
|
5369
|
-
from,
|
|
5370
|
-
trimBefore: registeredTrimBefore,
|
|
5371
|
-
id,
|
|
5372
|
-
loopDisplay,
|
|
5373
|
-
nonce: nonce.get(),
|
|
5374
|
-
parent: parentSequence?.id ?? null,
|
|
5375
|
-
playbackRate: isMedia.data.playbackRate,
|
|
5376
|
-
postmountDisplay: postmountDisplay ?? null,
|
|
5377
|
-
premountDisplay: premountDisplay ?? null,
|
|
5378
|
-
showInTimeline,
|
|
5379
|
-
src: isMedia.data.src,
|
|
5380
|
-
getStack: () => stackRef.current,
|
|
5381
|
-
startMediaFrom: startMediaFrom ?? isMedia.data.startMediaFrom,
|
|
5382
|
-
mediaFrameAtSequenceZero,
|
|
5383
|
-
volume: isMedia.data.volumes,
|
|
5384
|
-
muted: isMedia.data.muted,
|
|
5385
|
-
refForOutline: refForOutline ?? null,
|
|
5386
|
-
isInsideSeries,
|
|
5387
|
-
frozenFrame: registeredFrozenFrame,
|
|
5388
|
-
frozenMediaFrame,
|
|
5389
|
-
singleChildComponent: singleChildComponent ?? null
|
|
5390
|
-
});
|
|
5528
|
+
};
|
|
5391
5529
|
}
|
|
5392
|
-
return
|
|
5393
|
-
|
|
5530
|
+
return {
|
|
5531
|
+
type: isMedia.type,
|
|
5532
|
+
controls: registrationControls,
|
|
5533
|
+
effects: _remotionInternalEffects ?? EMPTY_EFFECTS,
|
|
5534
|
+
effectRuntimeValues,
|
|
5535
|
+
displayName: timelineClipName,
|
|
5536
|
+
documentationLink: resolvedDocumentationLink,
|
|
5537
|
+
doesVolumeChange: isMedia.data.doesVolumeChange,
|
|
5538
|
+
duration: actualDurationInFrames,
|
|
5539
|
+
from,
|
|
5540
|
+
trimBefore: registeredTrimBefore,
|
|
5541
|
+
id,
|
|
5542
|
+
loopDisplay,
|
|
5543
|
+
parent: parentSequence?.id ?? null,
|
|
5544
|
+
playbackRate: isMedia.data.playbackRate,
|
|
5545
|
+
postmountDisplay: postmountDisplay ?? null,
|
|
5546
|
+
premountDisplay: premountDisplay ?? null,
|
|
5547
|
+
showInTimeline,
|
|
5548
|
+
timelineOrder: null,
|
|
5549
|
+
src: isMedia.data.src,
|
|
5550
|
+
getStack: () => stackRef.current,
|
|
5551
|
+
startMediaFrom: startMediaFrom ?? isMedia.data.startMediaFrom,
|
|
5552
|
+
mediaFrameAtSequenceZero,
|
|
5553
|
+
volume: isMedia.data.volumes,
|
|
5554
|
+
muted: isMedia.data.muted,
|
|
5555
|
+
refForOutline: refForOutline ?? null,
|
|
5556
|
+
isInsideSeries,
|
|
5557
|
+
frozenFrame: registeredFrozenFrame,
|
|
5558
|
+
frozenMediaFrame,
|
|
5559
|
+
singleChildComponent: singleChildComponent ?? null
|
|
5394
5560
|
};
|
|
5395
5561
|
}
|
|
5396
|
-
|
|
5562
|
+
return {
|
|
5397
5563
|
from,
|
|
5398
5564
|
trimBefore: registeredTrimBefore,
|
|
5399
5565
|
duration: actualDurationInFrames,
|
|
@@ -5403,7 +5569,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5403
5569
|
parent: parentSequence?.id ?? null,
|
|
5404
5570
|
type: "sequence",
|
|
5405
5571
|
showInTimeline,
|
|
5406
|
-
|
|
5572
|
+
timelineOrder: null,
|
|
5407
5573
|
loopDisplay,
|
|
5408
5574
|
getStack: () => stackRef.current,
|
|
5409
5575
|
premountDisplay: premountDisplay ?? null,
|
|
@@ -5415,29 +5581,18 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5415
5581
|
isInsideSeries,
|
|
5416
5582
|
frozenFrame: registeredFrozenFrame,
|
|
5417
5583
|
singleChildComponent: singleChildComponent ?? null
|
|
5418
|
-
});
|
|
5419
|
-
return () => {
|
|
5420
|
-
unregisterSequence(id);
|
|
5421
5584
|
};
|
|
5422
5585
|
}, [
|
|
5423
|
-
durationInFrames,
|
|
5424
5586
|
id,
|
|
5425
|
-
name,
|
|
5426
|
-
registerSequence,
|
|
5427
5587
|
timelineClipName,
|
|
5428
|
-
unregisterSequence,
|
|
5429
5588
|
parentSequence?.id,
|
|
5430
5589
|
actualDurationInFrames,
|
|
5431
5590
|
from,
|
|
5432
|
-
trimBefore,
|
|
5433
5591
|
registeredTrimBefore,
|
|
5434
5592
|
showInTimeline,
|
|
5435
|
-
nonce,
|
|
5436
5593
|
loopDisplay,
|
|
5437
5594
|
premountDisplay,
|
|
5438
5595
|
postmountDisplay,
|
|
5439
|
-
env.isStudio,
|
|
5440
|
-
sequenceRegistrationEnabled,
|
|
5441
5596
|
registrationControls,
|
|
5442
5597
|
_remotionInternalEffects,
|
|
5443
5598
|
effectRuntimeValues,
|
|
@@ -5451,6 +5606,10 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5451
5606
|
frozenMediaFrame,
|
|
5452
5607
|
singleChildComponent
|
|
5453
5608
|
]);
|
|
5609
|
+
useSequenceRegistration({
|
|
5610
|
+
getSequence: env.isStudio || sequenceRegistrationEnabled ? getSequenceForRegistration : null,
|
|
5611
|
+
id
|
|
5612
|
+
});
|
|
5454
5613
|
const endThreshold = Math.ceil(cumulatedFrom + from + durationInFrames - 1);
|
|
5455
5614
|
const content2 = absoluteFrame < cumulatedFrom + from ? null : absoluteFrame > endThreshold ? null : children;
|
|
5456
5615
|
const frozenContent = content2 === null || typeof freeze === "undefined" || freeze === null ? content2 : /* @__PURE__ */ jsx12(Freeze, {
|
|
@@ -5473,7 +5632,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5473
5632
|
ref.current = node;
|
|
5474
5633
|
}
|
|
5475
5634
|
}, [ref]);
|
|
5476
|
-
const defaultStyle =
|
|
5635
|
+
const defaultStyle = useMemo13(() => {
|
|
5477
5636
|
return {
|
|
5478
5637
|
flexDirection: undefined,
|
|
5479
5638
|
...width ? { width } : {},
|
|
@@ -5488,9 +5647,12 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5488
5647
|
throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
|
|
5489
5648
|
}
|
|
5490
5649
|
if (hidden) {
|
|
5491
|
-
return
|
|
5650
|
+
return env.isStudio ? /* @__PURE__ */ jsx12(SequenceOrderMarker, {
|
|
5651
|
+
sequenceId: id,
|
|
5652
|
+
children: null
|
|
5653
|
+
}) : null;
|
|
5492
5654
|
}
|
|
5493
|
-
|
|
5655
|
+
const sequence = /* @__PURE__ */ jsx12(SequenceContext.Provider, {
|
|
5494
5656
|
value: contextValue,
|
|
5495
5657
|
children: frozenContent === null ? null : other.layout === "none" ? frozenContent : /* @__PURE__ */ jsx12(AbsoluteFillElement, {
|
|
5496
5658
|
ref: sequenceRef,
|
|
@@ -5499,6 +5661,10 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
5499
5661
|
children: frozenContent
|
|
5500
5662
|
})
|
|
5501
5663
|
});
|
|
5664
|
+
return env.isStudio ? /* @__PURE__ */ jsx12(SequenceOrderMarker, {
|
|
5665
|
+
sequenceId: id,
|
|
5666
|
+
children: sequence
|
|
5667
|
+
}) : sequence;
|
|
5502
5668
|
};
|
|
5503
5669
|
var RegularSequence = forwardRef3(RegularSequenceRefForwardingFunction);
|
|
5504
5670
|
var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
@@ -5660,15 +5826,15 @@ addSequenceStackTraces(AbsoluteFill);
|
|
|
5660
5826
|
// src/animated-image/AnimatedImage.tsx
|
|
5661
5827
|
import {
|
|
5662
5828
|
forwardRef as forwardRef4,
|
|
5663
|
-
useEffect as
|
|
5829
|
+
useEffect as useEffect6,
|
|
5664
5830
|
useImperativeHandle as useImperativeHandle2,
|
|
5665
|
-
useLayoutEffect as
|
|
5831
|
+
useLayoutEffect as useLayoutEffect5,
|
|
5666
5832
|
useRef as useRef10,
|
|
5667
|
-
useState as
|
|
5833
|
+
useState as useState7
|
|
5668
5834
|
} from "react";
|
|
5669
5835
|
|
|
5670
5836
|
// src/use-crop-style.ts
|
|
5671
|
-
import { useMemo as
|
|
5837
|
+
import { useMemo as useMemo14 } from "react";
|
|
5672
5838
|
var useCropStyle = ({
|
|
5673
5839
|
cropLeft,
|
|
5674
5840
|
cropRight,
|
|
@@ -5678,7 +5844,7 @@ var useCropStyle = ({
|
|
|
5678
5844
|
componentName
|
|
5679
5845
|
}) => {
|
|
5680
5846
|
validateSequenceCrop({ cropLeft, cropRight, cropTop, cropBottom }, componentName);
|
|
5681
|
-
return
|
|
5847
|
+
return useMemo14(() => {
|
|
5682
5848
|
const cropClipPath = getSequenceCropClipPath({
|
|
5683
5849
|
...resolveSequenceCrop({ cropLeft, cropRight, cropTop, cropBottom }),
|
|
5684
5850
|
style
|
|
@@ -5691,7 +5857,7 @@ var useCropStyle = ({
|
|
|
5691
5857
|
};
|
|
5692
5858
|
|
|
5693
5859
|
// src/animated-image/canvas.tsx
|
|
5694
|
-
import
|
|
5860
|
+
import React19, { useCallback as useCallback8, useImperativeHandle, useMemo as useMemo16, useRef as useRef9 } from "react";
|
|
5695
5861
|
|
|
5696
5862
|
// src/calculate-image-fit.ts
|
|
5697
5863
|
var calculateImageFit = (fit, imageSize, canvasSize) => {
|
|
@@ -5987,18 +6153,18 @@ var runEffectChain = async ({
|
|
|
5987
6153
|
};
|
|
5988
6154
|
|
|
5989
6155
|
// src/effects/use-effect-chain-state.ts
|
|
5990
|
-
import { useEffect as
|
|
6156
|
+
import { useEffect as useEffect5, useMemo as useMemo15, useRef as useRef8 } from "react";
|
|
5991
6157
|
var useEffectChainState = () => {
|
|
5992
6158
|
const chainStateRef = useRef8(null);
|
|
5993
6159
|
const sizeRef = useRef8(null);
|
|
5994
|
-
|
|
6160
|
+
useEffect5(() => {
|
|
5995
6161
|
return () => {
|
|
5996
6162
|
if (chainStateRef.current) {
|
|
5997
6163
|
cleanupEffectChainState(chainStateRef.current);
|
|
5998
6164
|
}
|
|
5999
6165
|
};
|
|
6000
6166
|
}, []);
|
|
6001
|
-
return
|
|
6167
|
+
return useMemo15(() => ({
|
|
6002
6168
|
get: (width, height) => {
|
|
6003
6169
|
if (!sizeRef.current || sizeRef.current.width !== width || sizeRef.current.height !== height) {
|
|
6004
6170
|
if (chainStateRef.current) {
|
|
@@ -6017,7 +6183,7 @@ import { jsx as jsx14 } from "react/jsx-runtime";
|
|
|
6017
6183
|
var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effects, ...props }, ref) => {
|
|
6018
6184
|
const canvasRef = useRef9(null);
|
|
6019
6185
|
const chainState = useEffectChainState();
|
|
6020
|
-
const sourceCanvas =
|
|
6186
|
+
const sourceCanvas = useMemo16(() => {
|
|
6021
6187
|
if (typeof document === "undefined") {
|
|
6022
6188
|
return null;
|
|
6023
6189
|
}
|
|
@@ -6082,7 +6248,7 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
|
|
|
6082
6248
|
...props
|
|
6083
6249
|
});
|
|
6084
6250
|
};
|
|
6085
|
-
var Canvas =
|
|
6251
|
+
var Canvas = React19.forwardRef(CanvasRefForwardingFunction);
|
|
6086
6252
|
|
|
6087
6253
|
// src/animated-image/create-image-decoder.ts
|
|
6088
6254
|
var createImageDecoder = async ({
|
|
@@ -6287,6 +6453,7 @@ import { jsx as jsx15 } from "react/jsx-runtime";
|
|
|
6287
6453
|
var animatedImageSchema = {
|
|
6288
6454
|
src: {
|
|
6289
6455
|
type: "asset",
|
|
6456
|
+
assetType: "image",
|
|
6290
6457
|
default: undefined,
|
|
6291
6458
|
description: "Source",
|
|
6292
6459
|
keyframable: false
|
|
@@ -6333,9 +6500,9 @@ var AnimatedImageContent = forwardRef4(({
|
|
|
6333
6500
|
...props
|
|
6334
6501
|
}, canvasRef) => {
|
|
6335
6502
|
const resolvedSrc = resolveAnimatedImageSource(src);
|
|
6336
|
-
const [imageDecoder, setImageDecoder] =
|
|
6503
|
+
const [imageDecoder, setImageDecoder] = useState7(null);
|
|
6337
6504
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
6338
|
-
const [decodeHandle] =
|
|
6505
|
+
const [decodeHandle] = useState7(() => delayRender2(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
|
|
6339
6506
|
const frame = useCurrentFrame();
|
|
6340
6507
|
const { fps } = useVideoConfig();
|
|
6341
6508
|
const currentTime = getCurrentTime({ frame, playbackRate, fps });
|
|
@@ -6356,8 +6523,8 @@ var AnimatedImageContent = forwardRef4(({
|
|
|
6356
6523
|
}
|
|
6357
6524
|
return c2;
|
|
6358
6525
|
}, []);
|
|
6359
|
-
const [initialLoopBehavior] =
|
|
6360
|
-
|
|
6526
|
+
const [initialLoopBehavior] = useState7(() => loopBehavior);
|
|
6527
|
+
useEffect6(() => {
|
|
6361
6528
|
const controller = new AbortController;
|
|
6362
6529
|
let cancelled = false;
|
|
6363
6530
|
let continued = false;
|
|
@@ -6409,12 +6576,12 @@ var AnimatedImageContent = forwardRef4(({
|
|
|
6409
6576
|
initialLoopBehavior,
|
|
6410
6577
|
continueRender2
|
|
6411
6578
|
]);
|
|
6412
|
-
|
|
6579
|
+
useEffect6(() => {
|
|
6413
6580
|
return () => {
|
|
6414
6581
|
imageDecoder?.close();
|
|
6415
6582
|
};
|
|
6416
6583
|
}, [imageDecoder]);
|
|
6417
|
-
|
|
6584
|
+
useLayoutEffect5(() => {
|
|
6418
6585
|
if (!imageDecoder) {
|
|
6419
6586
|
return;
|
|
6420
6587
|
}
|
|
@@ -6611,17 +6778,17 @@ var createEffect = (definition) => {
|
|
|
6611
6778
|
return factory;
|
|
6612
6779
|
};
|
|
6613
6780
|
// src/Artifact.tsx
|
|
6614
|
-
import { useContext as
|
|
6781
|
+
import { useContext as useContext21, useLayoutEffect as useLayoutEffect7, useState as useState9 } from "react";
|
|
6615
6782
|
|
|
6616
6783
|
// src/RenderAssetManager.tsx
|
|
6617
6784
|
import {
|
|
6618
|
-
createContext as
|
|
6785
|
+
createContext as createContext18,
|
|
6619
6786
|
useCallback as useCallback9,
|
|
6620
6787
|
useImperativeHandle as useImperativeHandle3,
|
|
6621
|
-
useLayoutEffect as
|
|
6622
|
-
useMemo as
|
|
6788
|
+
useLayoutEffect as useLayoutEffect6,
|
|
6789
|
+
useMemo as useMemo17,
|
|
6623
6790
|
useRef as useRef11,
|
|
6624
|
-
useState as
|
|
6791
|
+
useState as useState8
|
|
6625
6792
|
} from "react";
|
|
6626
6793
|
|
|
6627
6794
|
// src/validation/validate-artifact.ts
|
|
@@ -6657,7 +6824,7 @@ var validateRenderAsset = (artifact) => {
|
|
|
6657
6824
|
|
|
6658
6825
|
// src/RenderAssetManager.tsx
|
|
6659
6826
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
6660
|
-
var RenderAssetManager =
|
|
6827
|
+
var RenderAssetManager = createContext18({
|
|
6661
6828
|
registerRenderAsset: () => {
|
|
6662
6829
|
return;
|
|
6663
6830
|
},
|
|
@@ -6667,7 +6834,7 @@ var RenderAssetManager = createContext19({
|
|
|
6667
6834
|
renderAssets: []
|
|
6668
6835
|
});
|
|
6669
6836
|
var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
6670
|
-
const [renderAssets, setRenderAssets] =
|
|
6837
|
+
const [renderAssets, setRenderAssets] = useState8([]);
|
|
6671
6838
|
const renderAssetsRef = useRef11([]);
|
|
6672
6839
|
const registerRenderAsset = useCallback9((renderAsset) => {
|
|
6673
6840
|
validateRenderAsset(renderAsset);
|
|
@@ -6690,7 +6857,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
6690
6857
|
renderAssetsRef.current = renderAssetsRef.current.filter((a2) => a2.id !== id);
|
|
6691
6858
|
setRenderAssets(renderAssetsRef.current);
|
|
6692
6859
|
}, []);
|
|
6693
|
-
|
|
6860
|
+
useLayoutEffect6(() => {
|
|
6694
6861
|
if (typeof window !== "undefined") {
|
|
6695
6862
|
window.remotion_collectAssets = () => {
|
|
6696
6863
|
const assets = renderAssetsRef.current;
|
|
@@ -6700,7 +6867,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
6700
6867
|
};
|
|
6701
6868
|
}
|
|
6702
6869
|
}, []);
|
|
6703
|
-
const contextValue =
|
|
6870
|
+
const contextValue = useMemo17(() => {
|
|
6704
6871
|
return {
|
|
6705
6872
|
registerRenderAsset,
|
|
6706
6873
|
unregisterRenderAsset,
|
|
@@ -6716,13 +6883,13 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
6716
6883
|
// src/Artifact.tsx
|
|
6717
6884
|
var ArtifactThumbnail = Symbol("Thumbnail");
|
|
6718
6885
|
var Artifact = ({ filename, content: content2, downloadBehavior }) => {
|
|
6719
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
6886
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext21(RenderAssetManager);
|
|
6720
6887
|
const env = useRemotionEnvironment();
|
|
6721
6888
|
const frame = useCurrentFrame();
|
|
6722
|
-
const [id] =
|
|
6889
|
+
const [id] = useState9(() => {
|
|
6723
6890
|
return String(Math.random());
|
|
6724
6891
|
});
|
|
6725
|
-
|
|
6892
|
+
useLayoutEffect7(() => {
|
|
6726
6893
|
if (!env.isRendering) {
|
|
6727
6894
|
return;
|
|
6728
6895
|
}
|
|
@@ -6773,7 +6940,7 @@ var Artifact = ({ filename, content: content2, downloadBehavior }) => {
|
|
|
6773
6940
|
};
|
|
6774
6941
|
Artifact.Thumbnail = ArtifactThumbnail;
|
|
6775
6942
|
// src/audio/html5-audio.tsx
|
|
6776
|
-
import { forwardRef as forwardRef7, useCallback as
|
|
6943
|
+
import { forwardRef as forwardRef7, useCallback as useCallback16, useContext as useContext33 } from "react";
|
|
6777
6944
|
|
|
6778
6945
|
// src/absolute-src.ts
|
|
6779
6946
|
var getAbsoluteSrc = (relativeSrc) => {
|
|
@@ -6805,11 +6972,11 @@ var calculateMediaDuration = ({
|
|
|
6805
6972
|
};
|
|
6806
6973
|
|
|
6807
6974
|
// src/loop/index.tsx
|
|
6808
|
-
import
|
|
6975
|
+
import React20, { createContext as createContext19, useMemo as useMemo18 } from "react";
|
|
6809
6976
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
6810
|
-
var LoopContext =
|
|
6977
|
+
var LoopContext = createContext19(null);
|
|
6811
6978
|
var useLoop = () => {
|
|
6812
|
-
return
|
|
6979
|
+
return React20.useContext(LoopContext);
|
|
6813
6980
|
};
|
|
6814
6981
|
var Loop = ({
|
|
6815
6982
|
durationInFrames,
|
|
@@ -6841,14 +7008,14 @@ var Loop = ({
|
|
|
6841
7008
|
const iteration = Math.floor(currentFrame / durationInFrames);
|
|
6842
7009
|
const start = iteration * durationInFrames;
|
|
6843
7010
|
const from = Math.min(start, maxFrame);
|
|
6844
|
-
const loopDisplay =
|
|
7011
|
+
const loopDisplay = useMemo18(() => {
|
|
6845
7012
|
return {
|
|
6846
7013
|
numberOfTimes: Math.min(compDuration / durationInFrames, times),
|
|
6847
7014
|
startOffset: -from,
|
|
6848
7015
|
durationInFrames
|
|
6849
7016
|
};
|
|
6850
7017
|
}, [compDuration, durationInFrames, from, times]);
|
|
6851
|
-
const loopContext =
|
|
7018
|
+
const loopContext = useMemo18(() => {
|
|
6852
7019
|
return {
|
|
6853
7020
|
iteration: Math.floor(currentFrame / durationInFrames),
|
|
6854
7021
|
durationInFrames
|
|
@@ -6872,7 +7039,7 @@ var Loop = ({
|
|
|
6872
7039
|
Loop.useLoop = useLoop;
|
|
6873
7040
|
|
|
6874
7041
|
// src/prefetch.ts
|
|
6875
|
-
import { useContext as
|
|
7042
|
+
import { useContext as useContext22 } from "react";
|
|
6876
7043
|
|
|
6877
7044
|
// src/playback-logging.ts
|
|
6878
7045
|
var playbackLogging = ({
|
|
@@ -6886,9 +7053,9 @@ var playbackLogging = ({
|
|
|
6886
7053
|
};
|
|
6887
7054
|
|
|
6888
7055
|
// src/prefetch-state.tsx
|
|
6889
|
-
import { createContext as
|
|
7056
|
+
import { createContext as createContext20, useEffect as useEffect7, useState as useState10 } from "react";
|
|
6890
7057
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
6891
|
-
var PreloadContext =
|
|
7058
|
+
var PreloadContext = createContext20({});
|
|
6892
7059
|
var preloads = {};
|
|
6893
7060
|
var updaters = [];
|
|
6894
7061
|
var setPreloads = (updater) => {
|
|
@@ -6896,8 +7063,8 @@ var setPreloads = (updater) => {
|
|
|
6896
7063
|
updaters.forEach((u) => u());
|
|
6897
7064
|
};
|
|
6898
7065
|
var PrefetchProvider = ({ children }) => {
|
|
6899
|
-
const [_preloads, _setPreloads] =
|
|
6900
|
-
|
|
7066
|
+
const [_preloads, _setPreloads] = useState10(() => preloads);
|
|
7067
|
+
useEffect7(() => {
|
|
6901
7068
|
const updaterFunction = () => {
|
|
6902
7069
|
_setPreloads(preloads);
|
|
6903
7070
|
};
|
|
@@ -6928,7 +7095,7 @@ var getSrcWithoutHash = (src) => {
|
|
|
6928
7095
|
return src.slice(0, hashIndex);
|
|
6929
7096
|
};
|
|
6930
7097
|
var usePreload = (src) => {
|
|
6931
|
-
const preloads2 =
|
|
7098
|
+
const preloads2 = useContext22(PreloadContext);
|
|
6932
7099
|
const hashFragmentIndex = removeAndGetHashFragment(src);
|
|
6933
7100
|
const withoutHashFragment = getSrcWithoutHash(src);
|
|
6934
7101
|
if (!preloads2[withoutHashFragment]) {
|
|
@@ -7213,7 +7380,7 @@ var resolveTrimProps = ({
|
|
|
7213
7380
|
};
|
|
7214
7381
|
|
|
7215
7382
|
// src/video/duration-state.tsx
|
|
7216
|
-
import { createContext as
|
|
7383
|
+
import { createContext as createContext21, useMemo as useMemo19, useReducer } from "react";
|
|
7217
7384
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
7218
7385
|
var durationReducer = (state, action) => {
|
|
7219
7386
|
switch (action.type) {
|
|
@@ -7231,7 +7398,7 @@ var durationReducer = (state, action) => {
|
|
|
7231
7398
|
return state;
|
|
7232
7399
|
}
|
|
7233
7400
|
};
|
|
7234
|
-
var DurationsContext =
|
|
7401
|
+
var DurationsContext = createContext21({
|
|
7235
7402
|
durations: {},
|
|
7236
7403
|
setDurations: () => {
|
|
7237
7404
|
throw new Error("context missing");
|
|
@@ -7239,7 +7406,7 @@ var DurationsContext = createContext22({
|
|
|
7239
7406
|
});
|
|
7240
7407
|
var DurationsContextProvider = ({ children }) => {
|
|
7241
7408
|
const [durations, setDurations] = useReducer(durationReducer, {});
|
|
7242
|
-
const value =
|
|
7409
|
+
const value = useMemo19(() => {
|
|
7243
7410
|
return {
|
|
7244
7411
|
durations,
|
|
7245
7412
|
setDurations
|
|
@@ -7252,15 +7419,15 @@ var DurationsContextProvider = ({ children }) => {
|
|
|
7252
7419
|
};
|
|
7253
7420
|
|
|
7254
7421
|
// src/audio/AudioForPreview.tsx
|
|
7255
|
-
import { useCallback as
|
|
7256
|
-
import
|
|
7422
|
+
import { useCallback as useCallback15 } from "react";
|
|
7423
|
+
import React26, {
|
|
7257
7424
|
forwardRef as forwardRef5,
|
|
7258
|
-
useContext as
|
|
7259
|
-
useEffect as
|
|
7425
|
+
useContext as useContext31,
|
|
7426
|
+
useEffect as useEffect15,
|
|
7260
7427
|
useImperativeHandle as useImperativeHandle4,
|
|
7261
|
-
useMemo as
|
|
7428
|
+
useMemo as useMemo27,
|
|
7262
7429
|
useRef as useRef20,
|
|
7263
|
-
useState as
|
|
7430
|
+
useState as useState15
|
|
7264
7431
|
} from "react";
|
|
7265
7432
|
|
|
7266
7433
|
// src/get-cross-origin-value.ts
|
|
@@ -7316,18 +7483,18 @@ var random = (seed, dummy) => {
|
|
|
7316
7483
|
};
|
|
7317
7484
|
|
|
7318
7485
|
// src/use-amplification.ts
|
|
7319
|
-
import { useContext as
|
|
7486
|
+
import { useContext as useContext24, useLayoutEffect as useLayoutEffect8, useRef as useRef15 } from "react";
|
|
7320
7487
|
|
|
7321
7488
|
// src/audio/shared-audio-tags.tsx
|
|
7322
|
-
import
|
|
7323
|
-
createContext as
|
|
7489
|
+
import React23, {
|
|
7490
|
+
createContext as createContext22,
|
|
7324
7491
|
createRef as createRef2,
|
|
7325
7492
|
useCallback as useCallback10,
|
|
7326
|
-
useContext as
|
|
7327
|
-
useEffect as
|
|
7328
|
-
useMemo as
|
|
7493
|
+
useContext as useContext23,
|
|
7494
|
+
useEffect as useEffect8,
|
|
7495
|
+
useMemo as useMemo21,
|
|
7329
7496
|
useRef as useRef13,
|
|
7330
|
-
useState as
|
|
7497
|
+
useState as useState11
|
|
7331
7498
|
} from "react";
|
|
7332
7499
|
|
|
7333
7500
|
// src/play-and-handle-not-allowed-error.ts
|
|
@@ -7430,7 +7597,7 @@ var makeSharedElementSourceNode = ({
|
|
|
7430
7597
|
};
|
|
7431
7598
|
|
|
7432
7599
|
// src/audio/use-audio-context.ts
|
|
7433
|
-
import { useMemo as
|
|
7600
|
+
import { useMemo as useMemo20, useRef as useRef12 } from "react";
|
|
7434
7601
|
var warned = false;
|
|
7435
7602
|
var warnOnce = (logLevel) => {
|
|
7436
7603
|
if (warned) {
|
|
@@ -7452,7 +7619,7 @@ var useSingletonAudioContext = ({
|
|
|
7452
7619
|
if (sampleRate !== initialSampleRate.current) {
|
|
7453
7620
|
throw new Error(`Changing the AudioContext sample rate dynamically is not supported. The sample rate was initialized with ${initialSampleRate.current} Hz, but ${sampleRate} Hz was passed later.`);
|
|
7454
7621
|
}
|
|
7455
|
-
const context =
|
|
7622
|
+
const context = useMemo20(() => {
|
|
7456
7623
|
if (env.isRendering) {
|
|
7457
7624
|
return null;
|
|
7458
7625
|
}
|
|
@@ -7515,7 +7682,7 @@ var useSingletonAudioContext = ({
|
|
|
7515
7682
|
|
|
7516
7683
|
// src/audio/wait-until-actually-resumed.ts
|
|
7517
7684
|
var RESUME_WAIT_TIMEOUT = 1000;
|
|
7518
|
-
var waitUntilActuallyResumed = (audioContext, logLevel, signal) => {
|
|
7685
|
+
var waitUntilActuallyResumed = (audioContext, logLevel, signal, isAutoPlayAttempt) => {
|
|
7519
7686
|
return new Promise((resolve) => {
|
|
7520
7687
|
const startCurrentTime = audioContext.currentTime;
|
|
7521
7688
|
const start = audioContext.getOutputTimestamp();
|
|
@@ -7563,14 +7730,16 @@ var waitUntilActuallyResumed = (audioContext, logLevel, signal) => {
|
|
|
7563
7730
|
return;
|
|
7564
7731
|
}
|
|
7565
7732
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7733
|
+
if (isAutoPlayAttempt) {
|
|
7734
|
+
timeout = setTimeout(() => {
|
|
7735
|
+
if (hasAudiblyStarted(startOutputPerformanceTime)) {
|
|
7736
|
+
finish("resumed");
|
|
7737
|
+
return;
|
|
7738
|
+
}
|
|
7739
|
+
Log.warn({ logLevel, tag: "audio" }, "WARNING: You enabled autoPlay on an unmuted <Player /> and the browser did not allow the video to be started. Remotion muted the <Player /> so it can play. To properly handle this, either set the `muted` prop or remove the `autoPlay` prop");
|
|
7740
|
+
finish("failed");
|
|
7741
|
+
}, RESUME_WAIT_TIMEOUT);
|
|
7742
|
+
}
|
|
7574
7743
|
animationFrame = requestAnimationFrame(check);
|
|
7575
7744
|
});
|
|
7576
7745
|
};
|
|
@@ -7603,8 +7772,8 @@ var didPropChange = (key, newProp, prevProp) => {
|
|
|
7603
7772
|
}
|
|
7604
7773
|
return true;
|
|
7605
7774
|
};
|
|
7606
|
-
var SharedAudioContext =
|
|
7607
|
-
var SharedAudioTagsContext =
|
|
7775
|
+
var SharedAudioContext = createContext22(null);
|
|
7776
|
+
var SharedAudioTagsContext = createContext22(null);
|
|
7608
7777
|
var shouldSaveForLater = (state) => {
|
|
7609
7778
|
if (state === "suspended" || state === "running-to-suspended" || state === "interrupted") {
|
|
7610
7779
|
return true;
|
|
@@ -7623,7 +7792,7 @@ var SharedAudioContextProvider = ({
|
|
|
7623
7792
|
}) => {
|
|
7624
7793
|
const logLevel = useLogLevel();
|
|
7625
7794
|
const sampleRate = previewSampleRate ?? 48000;
|
|
7626
|
-
|
|
7795
|
+
useEffect8(() => {
|
|
7627
7796
|
if (typeof window === "undefined") {
|
|
7628
7797
|
return;
|
|
7629
7798
|
}
|
|
@@ -7642,9 +7811,10 @@ var SharedAudioContextProvider = ({
|
|
|
7642
7811
|
}
|
|
7643
7812
|
const isResuming = useRef13(null);
|
|
7644
7813
|
const nextResumeAttemptId = useRef13(0);
|
|
7645
|
-
const
|
|
7814
|
+
const nextResumeIsAutoPlayAttempt = useRef13(false);
|
|
7815
|
+
const audioSyncAnchor = useMemo21(() => ({ value: 0 }), []);
|
|
7646
7816
|
const audioSyncAnchorListeners = useRef13([]);
|
|
7647
|
-
const audioSyncAnchorEmitter =
|
|
7817
|
+
const audioSyncAnchorEmitter = useMemo21(() => {
|
|
7648
7818
|
return {
|
|
7649
7819
|
dispatch: (event) => {
|
|
7650
7820
|
audioSyncAnchorListeners.current.forEach((l) => l(event));
|
|
@@ -7664,7 +7834,7 @@ var SharedAudioContextProvider = ({
|
|
|
7664
7834
|
const unscheduleAudioNode = useCallback10((node) => {
|
|
7665
7835
|
nodesToResume.current.delete(node);
|
|
7666
7836
|
}, []);
|
|
7667
|
-
const scheduleAudioNode =
|
|
7837
|
+
const scheduleAudioNode = useMemo21(() => {
|
|
7668
7838
|
return ({
|
|
7669
7839
|
node,
|
|
7670
7840
|
mediaTimestamp,
|
|
@@ -7717,6 +7887,8 @@ var SharedAudioContextProvider = ({
|
|
|
7717
7887
|
};
|
|
7718
7888
|
}, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
|
|
7719
7889
|
const resume = useCallback10(() => {
|
|
7890
|
+
const isAutoPlayAttempt = nextResumeIsAutoPlayAttempt.current;
|
|
7891
|
+
nextResumeIsAutoPlayAttempt.current = false;
|
|
7720
7892
|
if (!ctxAndGain) {
|
|
7721
7893
|
return Promise.resolve();
|
|
7722
7894
|
}
|
|
@@ -7738,7 +7910,7 @@ var SharedAudioContextProvider = ({
|
|
|
7738
7910
|
const abortController = new AbortController;
|
|
7739
7911
|
const resumeAttemptId = nextResumeAttemptId.current++;
|
|
7740
7912
|
const waitPromise = new Promise((resolve) => {
|
|
7741
|
-
waitUntilActuallyResumed(ctxAndGain.audioContext, logLevel, abortController.signal).then(resolve);
|
|
7913
|
+
waitUntilActuallyResumed(ctxAndGain.audioContext, logLevel, abortController.signal, isAutoPlayAttempt).then(resolve);
|
|
7742
7914
|
resumePromise.catch((err) => {
|
|
7743
7915
|
Log.warn({ logLevel, tag: "audio" }, "AudioContext resume rejected, muting playback and continuing without audio", err);
|
|
7744
7916
|
abortController.abort();
|
|
@@ -7756,6 +7928,10 @@ var SharedAudioContextProvider = ({
|
|
|
7756
7928
|
};
|
|
7757
7929
|
return resumePromise.catch(() => {});
|
|
7758
7930
|
}, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
|
|
7931
|
+
const resumeAsAutoPlay = useCallback10(() => {
|
|
7932
|
+
nextResumeIsAutoPlayAttempt.current = true;
|
|
7933
|
+
return resume();
|
|
7934
|
+
}, [resume]);
|
|
7759
7935
|
const getIsResumingAudioContext = useCallback10(() => {
|
|
7760
7936
|
return isResuming.current?.promise ?? null;
|
|
7761
7937
|
}, []);
|
|
@@ -7775,7 +7951,7 @@ var SharedAudioContextProvider = ({
|
|
|
7775
7951
|
}
|
|
7776
7952
|
return ctxAndGain.suspend();
|
|
7777
7953
|
}, [ctxAndGain, _experimentalKeepAudioContextAlive]);
|
|
7778
|
-
|
|
7954
|
+
useEffect8(() => {
|
|
7779
7955
|
if (!_experimentalKeepAudioContextAlive) {
|
|
7780
7956
|
return;
|
|
7781
7957
|
}
|
|
@@ -7803,7 +7979,7 @@ var SharedAudioContextProvider = ({
|
|
|
7803
7979
|
ctxAndGain.suspend().catch(() => {});
|
|
7804
7980
|
};
|
|
7805
7981
|
}, [ctxAndGain, _experimentalKeepAudioContextAlive]);
|
|
7806
|
-
const audioContextValue =
|
|
7982
|
+
const audioContextValue = useMemo21(() => {
|
|
7807
7983
|
return {
|
|
7808
7984
|
audioContext: ctxAndGain?.audioContext ?? null,
|
|
7809
7985
|
getAudioContextState: () => ctxAndGain?.getState() ?? null,
|
|
@@ -7812,6 +7988,7 @@ var SharedAudioContextProvider = ({
|
|
|
7812
7988
|
audioSyncAnchorEmitter,
|
|
7813
7989
|
scheduleAudioNode,
|
|
7814
7990
|
resume,
|
|
7991
|
+
resumeAsAutoPlay,
|
|
7815
7992
|
suspend,
|
|
7816
7993
|
getIsResumingAudioContext,
|
|
7817
7994
|
unscheduleAudioNode,
|
|
@@ -7823,6 +8000,7 @@ var SharedAudioContextProvider = ({
|
|
|
7823
8000
|
audioSyncAnchorEmitter,
|
|
7824
8001
|
scheduleAudioNode,
|
|
7825
8002
|
resume,
|
|
8003
|
+
resumeAsAutoPlay,
|
|
7826
8004
|
suspend,
|
|
7827
8005
|
getIsResumingAudioContext,
|
|
7828
8006
|
unscheduleAudioNode,
|
|
@@ -7835,17 +8013,17 @@ var SharedAudioContextProvider = ({
|
|
|
7835
8013
|
};
|
|
7836
8014
|
var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
7837
8015
|
const audios = useRef13([]);
|
|
7838
|
-
const [initialNumberOfAudioTags] =
|
|
8016
|
+
const [initialNumberOfAudioTags] = useState11(numberOfAudioTags);
|
|
7839
8017
|
if (numberOfAudioTags !== initialNumberOfAudioTags) {
|
|
7840
8018
|
throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");
|
|
7841
8019
|
}
|
|
7842
8020
|
const logLevel = useLogLevel();
|
|
7843
8021
|
const mountTime = useMountTime();
|
|
7844
8022
|
const env = useRemotionEnvironment();
|
|
7845
|
-
const audioCtx =
|
|
8023
|
+
const audioCtx = useContext23(SharedAudioContext);
|
|
7846
8024
|
const audioContext = audioCtx?.audioContext ?? null;
|
|
7847
8025
|
const resume = audioCtx?.resume;
|
|
7848
|
-
const [refs] =
|
|
8026
|
+
const [refs] = useState11(() => {
|
|
7849
8027
|
return new Array(numberOfAudioTags).fill(true).map(() => {
|
|
7850
8028
|
const ref = createRef2();
|
|
7851
8029
|
return {
|
|
@@ -7861,7 +8039,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
7861
8039
|
for (const { mediaElementSourceNode } of refs) {
|
|
7862
8040
|
mediaElementSourceNode?.setAudioContext(audioContext);
|
|
7863
8041
|
}
|
|
7864
|
-
const effectToUse =
|
|
8042
|
+
const effectToUse = React23.useInsertionEffect ?? React23.useLayoutEffect;
|
|
7865
8043
|
effectToUse(() => {
|
|
7866
8044
|
return () => {
|
|
7867
8045
|
requestAnimationFrame(() => {
|
|
@@ -7987,7 +8165,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
7987
8165
|
});
|
|
7988
8166
|
resume?.();
|
|
7989
8167
|
}, [logLevel, mountTime, refs, env.isPlayer, resume]);
|
|
7990
|
-
const audioTagsValue =
|
|
8168
|
+
const audioTagsValue = useMemo21(() => {
|
|
7991
8169
|
return {
|
|
7992
8170
|
registerAudio,
|
|
7993
8171
|
unregisterAudio,
|
|
@@ -8002,7 +8180,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
8002
8180
|
unregisterAudio,
|
|
8003
8181
|
updateAudio
|
|
8004
8182
|
]);
|
|
8005
|
-
const sharedAudioTagElements =
|
|
8183
|
+
const sharedAudioTagElements = useMemo21(() => {
|
|
8006
8184
|
return refs.map(({ id, ref }) => {
|
|
8007
8185
|
return /* @__PURE__ */ jsx20("audio", {
|
|
8008
8186
|
ref,
|
|
@@ -8025,13 +8203,13 @@ var useSharedAudio = ({
|
|
|
8025
8203
|
premounting,
|
|
8026
8204
|
postmounting
|
|
8027
8205
|
}) => {
|
|
8028
|
-
const audioCtx =
|
|
8029
|
-
const tagsCtx =
|
|
8030
|
-
const [elem] =
|
|
8206
|
+
const audioCtx = useContext23(SharedAudioContext);
|
|
8207
|
+
const tagsCtx = useContext23(SharedAudioTagsContext);
|
|
8208
|
+
const [elem] = useState11(() => {
|
|
8031
8209
|
if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
|
|
8032
8210
|
return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
|
|
8033
8211
|
}
|
|
8034
|
-
const el =
|
|
8212
|
+
const el = React23.createRef();
|
|
8035
8213
|
const mediaElementSourceNode = makeSharedElementSourceNode({
|
|
8036
8214
|
audioContext: audioCtx?.audioContext ?? null,
|
|
8037
8215
|
ref: el
|
|
@@ -8051,7 +8229,7 @@ var useSharedAudio = ({
|
|
|
8051
8229
|
};
|
|
8052
8230
|
});
|
|
8053
8231
|
elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
|
|
8054
|
-
const effectToUse =
|
|
8232
|
+
const effectToUse = React23.useInsertionEffect ?? React23.useLayoutEffect;
|
|
8055
8233
|
if (typeof document !== "undefined") {
|
|
8056
8234
|
effectToUse(() => {
|
|
8057
8235
|
if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
|
|
@@ -8213,13 +8391,13 @@ var useVolume = ({
|
|
|
8213
8391
|
const audioStuffRef = useRef15(null);
|
|
8214
8392
|
const currentVolumeRef = useRef15(volume);
|
|
8215
8393
|
currentVolumeRef.current = volume;
|
|
8216
|
-
const sharedAudioContext =
|
|
8394
|
+
const sharedAudioContext = useContext24(SharedAudioContext);
|
|
8217
8395
|
if (!sharedAudioContext) {
|
|
8218
8396
|
throw new Error("useAmplification must be used within a SharedAudioContext");
|
|
8219
8397
|
}
|
|
8220
8398
|
const { audioContext, gainNode: masterGainNode } = sharedAudioContext;
|
|
8221
8399
|
if (typeof window !== "undefined") {
|
|
8222
|
-
|
|
8400
|
+
useLayoutEffect8(() => {
|
|
8223
8401
|
if (!audioContext) {
|
|
8224
8402
|
return;
|
|
8225
8403
|
}
|
|
@@ -8279,12 +8457,12 @@ var useVolume = ({
|
|
|
8279
8457
|
};
|
|
8280
8458
|
|
|
8281
8459
|
// src/use-media-in-timeline.ts
|
|
8282
|
-
import { useContext as
|
|
8460
|
+
import { useCallback as useCallback11, useContext as useContext26, useEffect as useEffect9, useMemo as useMemo22, useState as useState12 } from "react";
|
|
8283
8461
|
|
|
8284
8462
|
// src/audio/use-audio-frame.ts
|
|
8285
|
-
import { useContext as
|
|
8463
|
+
import { useContext as useContext25 } from "react";
|
|
8286
8464
|
var useMediaStartsAt = () => {
|
|
8287
|
-
const parentSequence =
|
|
8465
|
+
const parentSequence = useContext25(SequenceContext);
|
|
8288
8466
|
return parentSequence?.cumulatedNegativeFrom ?? 0;
|
|
8289
8467
|
};
|
|
8290
8468
|
var useFrameForVolumeProp = (behavior) => {
|
|
@@ -8386,8 +8564,8 @@ var useBasicMediaInTimeline = ({
|
|
|
8386
8564
|
if (!src) {
|
|
8387
8565
|
throw new Error("No src passed");
|
|
8388
8566
|
}
|
|
8389
|
-
const parentSequence =
|
|
8390
|
-
const [initialVolume] =
|
|
8567
|
+
const parentSequence = useContext26(SequenceContext);
|
|
8568
|
+
const [initialVolume] = useState12(() => volume);
|
|
8391
8569
|
const duration = getTimelineDuration({
|
|
8392
8570
|
compositionDurationInFrames: sequenceDurationInFrames,
|
|
8393
8571
|
playbackRate,
|
|
@@ -8396,7 +8574,7 @@ var useBasicMediaInTimeline = ({
|
|
|
8396
8574
|
parentSequenceDurationInFrames: parentSequence?.durationInFrames ?? null,
|
|
8397
8575
|
loop
|
|
8398
8576
|
});
|
|
8399
|
-
const volumes =
|
|
8577
|
+
const volumes = useMemo22(() => {
|
|
8400
8578
|
if (typeof volume === "number") {
|
|
8401
8579
|
return volume;
|
|
8402
8580
|
}
|
|
@@ -8415,20 +8593,18 @@ var useBasicMediaInTimeline = ({
|
|
|
8415
8593
|
});
|
|
8416
8594
|
}).join(",");
|
|
8417
8595
|
}, [duration, mediaStartsAt, volume, mediaVolume]);
|
|
8418
|
-
|
|
8596
|
+
useEffect9(() => {
|
|
8419
8597
|
if (typeof volume === "number" && volume !== initialVolume) {
|
|
8420
8598
|
warnOnce2(`Remotion: The ${mediaType} with src ${src} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`);
|
|
8421
8599
|
}
|
|
8422
8600
|
}, [initialVolume, mediaType, src, volume]);
|
|
8423
8601
|
const doesVolumeChange = typeof volume === "function";
|
|
8424
|
-
const nonce = useNonce();
|
|
8425
8602
|
const startMediaFrom = 0 - mediaStartsAt + (trimBefore ?? 0);
|
|
8426
|
-
const memoizedResult =
|
|
8603
|
+
const memoizedResult = useMemo22(() => {
|
|
8427
8604
|
return {
|
|
8428
8605
|
volumes,
|
|
8429
8606
|
duration,
|
|
8430
8607
|
doesVolumeChange,
|
|
8431
|
-
nonce,
|
|
8432
8608
|
finalDisplayName: displayName ?? getAssetDisplayName(src),
|
|
8433
8609
|
startMediaFrom,
|
|
8434
8610
|
src,
|
|
@@ -8439,7 +8615,6 @@ var useBasicMediaInTimeline = ({
|
|
|
8439
8615
|
volumes,
|
|
8440
8616
|
duration,
|
|
8441
8617
|
doesVolumeChange,
|
|
8442
|
-
nonce,
|
|
8443
8618
|
displayName,
|
|
8444
8619
|
src,
|
|
8445
8620
|
startMediaFrom,
|
|
@@ -8465,13 +8640,12 @@ var useMediaInTimeline = ({
|
|
|
8465
8640
|
refForOutline,
|
|
8466
8641
|
muted
|
|
8467
8642
|
}) => {
|
|
8468
|
-
const parentSequence =
|
|
8643
|
+
const parentSequence = useContext26(SequenceContext);
|
|
8469
8644
|
const startsAt = useMediaStartsAt();
|
|
8470
|
-
const
|
|
8471
|
-
const sequenceRegistrationEnabled = useContext24(SequenceRegistrationContext);
|
|
8645
|
+
const sequenceRegistrationEnabled = useContext26(SequenceRegistrationContext);
|
|
8472
8646
|
const { durationInFrames } = useVideoConfig();
|
|
8473
8647
|
const mediaStartsAt = useMediaStartsAt();
|
|
8474
|
-
const { volumes, duration, doesVolumeChange,
|
|
8648
|
+
const { volumes, duration, doesVolumeChange, finalDisplayName } = useBasicMediaInTimeline({
|
|
8475
8649
|
volume,
|
|
8476
8650
|
mediaVolume,
|
|
8477
8651
|
mediaType,
|
|
@@ -8486,17 +8660,11 @@ var useMediaInTimeline = ({
|
|
|
8486
8660
|
muted
|
|
8487
8661
|
});
|
|
8488
8662
|
const { isStudio } = useRemotionEnvironment();
|
|
8489
|
-
|
|
8663
|
+
const getSequenceForRegistration = useCallback11(() => {
|
|
8490
8664
|
if (!src) {
|
|
8491
8665
|
throw new Error("No src passed");
|
|
8492
8666
|
}
|
|
8493
|
-
|
|
8494
|
-
return;
|
|
8495
|
-
}
|
|
8496
|
-
if (!showInTimeline) {
|
|
8497
|
-
return;
|
|
8498
|
-
}
|
|
8499
|
-
registerSequence({
|
|
8667
|
+
return {
|
|
8500
8668
|
effectRuntimeValues: null,
|
|
8501
8669
|
type: mediaType,
|
|
8502
8670
|
src,
|
|
@@ -8510,7 +8678,7 @@ var useMediaInTimeline = ({
|
|
|
8510
8678
|
volume: volumes,
|
|
8511
8679
|
muted,
|
|
8512
8680
|
showInTimeline: true,
|
|
8513
|
-
|
|
8681
|
+
timelineOrder: null,
|
|
8514
8682
|
startMediaFrom: 0 - startsAt,
|
|
8515
8683
|
mediaFrameAtSequenceZero: null,
|
|
8516
8684
|
doesVolumeChange,
|
|
@@ -8525,71 +8693,57 @@ var useMediaInTimeline = ({
|
|
|
8525
8693
|
isInsideSeries: false,
|
|
8526
8694
|
frozenFrame: null,
|
|
8527
8695
|
frozenMediaFrame: null
|
|
8528
|
-
});
|
|
8529
|
-
return () => {
|
|
8530
|
-
unregisterSequence(id);
|
|
8531
8696
|
};
|
|
8532
8697
|
}, [
|
|
8533
8698
|
duration,
|
|
8534
8699
|
id,
|
|
8535
8700
|
parentSequence,
|
|
8536
8701
|
src,
|
|
8537
|
-
registerSequence,
|
|
8538
|
-
unregisterSequence,
|
|
8539
8702
|
volumes,
|
|
8540
8703
|
doesVolumeChange,
|
|
8541
|
-
nonce,
|
|
8542
8704
|
mediaType,
|
|
8543
8705
|
startsAt,
|
|
8544
8706
|
playbackRate,
|
|
8545
8707
|
getStack,
|
|
8546
|
-
showInTimeline,
|
|
8547
8708
|
premountDisplay,
|
|
8548
8709
|
postmountDisplay,
|
|
8549
8710
|
loopDisplay,
|
|
8550
8711
|
documentationLink,
|
|
8551
8712
|
finalDisplayName,
|
|
8552
|
-
isStudio,
|
|
8553
|
-
sequenceRegistrationEnabled,
|
|
8554
8713
|
refForOutline,
|
|
8555
8714
|
muted
|
|
8556
8715
|
]);
|
|
8716
|
+
const registrationEnabled = isStudio || sequenceRegistrationEnabled || typeof window !== "undefined" && window.process?.env?.NODE_ENV === "test";
|
|
8717
|
+
useSequenceRegistration({
|
|
8718
|
+
getSequence: registrationEnabled && showInTimeline ? getSequenceForRegistration : null,
|
|
8719
|
+
id
|
|
8720
|
+
});
|
|
8557
8721
|
};
|
|
8558
8722
|
|
|
8559
8723
|
// src/use-media-playback.ts
|
|
8560
|
-
import {
|
|
8561
|
-
useCallback as useCallback13,
|
|
8562
|
-
useContext as useContext27,
|
|
8563
|
-
useEffect as useEffect12,
|
|
8564
|
-
useLayoutEffect as useLayoutEffect9,
|
|
8565
|
-
useRef as useRef19
|
|
8566
|
-
} from "react";
|
|
8724
|
+
import { useCallback as useCallback14, useEffect as useEffect13, useLayoutEffect as useLayoutEffect10, useRef as useRef18 } from "react";
|
|
8567
8725
|
|
|
8568
8726
|
// src/buffer-until-first-frame.ts
|
|
8569
|
-
import { useCallback as
|
|
8727
|
+
import { useCallback as useCallback13, useMemo as useMemo25, useRef as useRef16 } from "react";
|
|
8570
8728
|
|
|
8571
8729
|
// src/use-buffer-state.ts
|
|
8572
|
-
import { useContext as
|
|
8730
|
+
import { useContext as useContext28, useMemo as useMemo24 } from "react";
|
|
8573
8731
|
|
|
8574
8732
|
// src/buffering.tsx
|
|
8575
|
-
import
|
|
8576
|
-
useCallback as
|
|
8577
|
-
useContext as
|
|
8578
|
-
useEffect as
|
|
8579
|
-
useLayoutEffect as
|
|
8580
|
-
useMemo as
|
|
8581
|
-
|
|
8582
|
-
useState as useState12
|
|
8733
|
+
import React24, {
|
|
8734
|
+
useCallback as useCallback12,
|
|
8735
|
+
useContext as useContext27,
|
|
8736
|
+
useEffect as useEffect10,
|
|
8737
|
+
useLayoutEffect as useLayoutEffect9,
|
|
8738
|
+
useMemo as useMemo23,
|
|
8739
|
+
useState as useState13
|
|
8583
8740
|
} from "react";
|
|
8584
8741
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
8585
|
-
var useBufferManager = (logLevel, mountTime) => {
|
|
8586
|
-
const [
|
|
8587
|
-
const onBufferingCallbacks = useRef16([]);
|
|
8588
|
-
const onResumeCallbacks = useRef16([]);
|
|
8742
|
+
var useBufferManager = (logLevel, mountTime, setBuffering, isBuffering) => {
|
|
8743
|
+
const [blockCount, setBlockCount] = useState13(0);
|
|
8589
8744
|
const env = useRemotionEnvironment();
|
|
8590
8745
|
const rendering = env.isRendering;
|
|
8591
|
-
const
|
|
8592
|
-
const addBlock = useCallback11((block) => {
|
|
8746
|
+
const addBlock = useCallback12(() => {
|
|
8593
8747
|
if (rendering) {
|
|
8594
8748
|
return {
|
|
8595
8749
|
unblock: () => {
|
|
@@ -8598,49 +8752,23 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
8598
8752
|
};
|
|
8599
8753
|
}
|
|
8600
8754
|
let unblocked = false;
|
|
8601
|
-
|
|
8755
|
+
setBlockCount((count) => count + 1);
|
|
8602
8756
|
return {
|
|
8603
8757
|
unblock: () => {
|
|
8604
8758
|
if (unblocked) {
|
|
8605
8759
|
return;
|
|
8606
8760
|
}
|
|
8607
8761
|
unblocked = true;
|
|
8608
|
-
|
|
8609
|
-
const newArr = b2.filter((bx) => bx !== block);
|
|
8610
|
-
if (newArr.length === b2.length) {
|
|
8611
|
-
return b2;
|
|
8612
|
-
}
|
|
8613
|
-
return newArr;
|
|
8614
|
-
});
|
|
8762
|
+
setBlockCount((count) => count - 1);
|
|
8615
8763
|
}
|
|
8616
8764
|
};
|
|
8617
8765
|
}, [rendering]);
|
|
8618
|
-
|
|
8619
|
-
onBufferingCallbacks.current = [
|
|
8620
|
-
...onBufferingCallbacks.current,
|
|
8621
|
-
callback
|
|
8622
|
-
];
|
|
8623
|
-
return {
|
|
8624
|
-
remove: () => {
|
|
8625
|
-
onBufferingCallbacks.current = onBufferingCallbacks.current.filter((cb) => cb !== callback);
|
|
8626
|
-
}
|
|
8627
|
-
};
|
|
8628
|
-
}, []);
|
|
8629
|
-
const listenForResume = useCallback11((callback) => {
|
|
8630
|
-
onResumeCallbacks.current = [...onResumeCallbacks.current, callback];
|
|
8631
|
-
return {
|
|
8632
|
-
remove: () => {
|
|
8633
|
-
onResumeCallbacks.current = onResumeCallbacks.current.filter((cb) => cb !== callback);
|
|
8634
|
-
}
|
|
8635
|
-
};
|
|
8636
|
-
}, []);
|
|
8637
|
-
useEffect9(() => {
|
|
8766
|
+
useEffect10(() => {
|
|
8638
8767
|
if (rendering) {
|
|
8639
8768
|
return;
|
|
8640
8769
|
}
|
|
8641
|
-
if (
|
|
8642
|
-
|
|
8643
|
-
[...onBufferingCallbacks.current].forEach((c2) => c2());
|
|
8770
|
+
if (blockCount > 0 && !isBuffering()) {
|
|
8771
|
+
setBuffering(true);
|
|
8644
8772
|
playbackLogging({
|
|
8645
8773
|
logLevel,
|
|
8646
8774
|
message: "Player is entering buffer state",
|
|
@@ -8648,15 +8776,14 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
8648
8776
|
tag: "player"
|
|
8649
8777
|
});
|
|
8650
8778
|
}
|
|
8651
|
-
}, [
|
|
8779
|
+
}, [blockCount]);
|
|
8652
8780
|
if (typeof window !== "undefined") {
|
|
8653
|
-
|
|
8781
|
+
useLayoutEffect9(() => {
|
|
8654
8782
|
if (rendering) {
|
|
8655
8783
|
return;
|
|
8656
8784
|
}
|
|
8657
|
-
if (
|
|
8658
|
-
|
|
8659
|
-
[...onResumeCallbacks.current].forEach((c2) => c2());
|
|
8785
|
+
if (blockCount === 0 && isBuffering()) {
|
|
8786
|
+
setBuffering(false);
|
|
8660
8787
|
playbackLogging({
|
|
8661
8788
|
logLevel,
|
|
8662
8789
|
message: "Player is exiting buffer state",
|
|
@@ -8664,54 +8791,33 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
8664
8791
|
tag: "player"
|
|
8665
8792
|
});
|
|
8666
8793
|
}
|
|
8667
|
-
}, [
|
|
8794
|
+
}, [blockCount]);
|
|
8668
8795
|
}
|
|
8669
|
-
return
|
|
8670
|
-
return { addBlock, listenForBuffering, listenForResume, buffering };
|
|
8671
|
-
}, [addBlock, buffering, listenForBuffering, listenForResume]);
|
|
8796
|
+
return useMemo23(() => ({ addBlock }), [addBlock]);
|
|
8672
8797
|
};
|
|
8673
|
-
var BufferingContextReact =
|
|
8798
|
+
var BufferingContextReact = React24.createContext(null);
|
|
8674
8799
|
var BufferingProvider = ({ children }) => {
|
|
8675
|
-
const { logLevel, mountTime } =
|
|
8676
|
-
const
|
|
8800
|
+
const { logLevel, mountTime } = useContext27(LogLevelContext);
|
|
8801
|
+
const { isBuffering, setBuffering } = useContext27(SetTimelineContext);
|
|
8802
|
+
const bufferManager = useBufferManager(logLevel ?? "info", mountTime, setBuffering, isBuffering);
|
|
8677
8803
|
return /* @__PURE__ */ jsx21(BufferingContextReact.Provider, {
|
|
8678
8804
|
value: bufferManager,
|
|
8679
8805
|
children
|
|
8680
8806
|
});
|
|
8681
8807
|
};
|
|
8682
|
-
var useIsPlayerBuffering = (bufferManager) => {
|
|
8683
|
-
const [isBuffering, setIsBuffering] = useState12(bufferManager.buffering.current);
|
|
8684
|
-
useEffect9(() => {
|
|
8685
|
-
const onBuffer = () => {
|
|
8686
|
-
setIsBuffering(true);
|
|
8687
|
-
};
|
|
8688
|
-
const onResume = () => {
|
|
8689
|
-
setIsBuffering(false);
|
|
8690
|
-
};
|
|
8691
|
-
const buffer = bufferManager.listenForBuffering(onBuffer);
|
|
8692
|
-
const resume = bufferManager.listenForResume(onResume);
|
|
8693
|
-
return () => {
|
|
8694
|
-
buffer.remove();
|
|
8695
|
-
resume.remove();
|
|
8696
|
-
};
|
|
8697
|
-
}, [bufferManager]);
|
|
8698
|
-
return isBuffering;
|
|
8699
|
-
};
|
|
8700
8808
|
|
|
8701
8809
|
// src/use-buffer-state.ts
|
|
8702
8810
|
var useBufferState = () => {
|
|
8703
|
-
const buffer =
|
|
8811
|
+
const buffer = useContext28(BufferingContextReact);
|
|
8704
8812
|
const logLevel = useLogLevel();
|
|
8705
8813
|
const addBlock = buffer ? buffer.addBlock : null;
|
|
8706
|
-
return
|
|
8814
|
+
return useMemo24(() => ({
|
|
8707
8815
|
delayPlayback: () => {
|
|
8708
8816
|
if (!addBlock) {
|
|
8709
8817
|
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");
|
|
8710
8818
|
}
|
|
8711
8819
|
Log.trace({ logLevel, tag: "[buffer-state]" }, "Adding buffer handle", new Error().stack);
|
|
8712
|
-
const { unblock } = addBlock(
|
|
8713
|
-
id: String(Math.random())
|
|
8714
|
-
});
|
|
8820
|
+
const { unblock } = addBlock();
|
|
8715
8821
|
let unblocked = false;
|
|
8716
8822
|
return {
|
|
8717
8823
|
unblock: () => {
|
|
@@ -8740,9 +8846,9 @@ var useBufferUntilFirstFrame = ({
|
|
|
8740
8846
|
logLevel,
|
|
8741
8847
|
mountTime
|
|
8742
8848
|
}) => {
|
|
8743
|
-
const bufferingRef =
|
|
8849
|
+
const bufferingRef = useRef16(false);
|
|
8744
8850
|
const { delayPlayback } = useBufferState();
|
|
8745
|
-
const bufferUntilFirstFrame =
|
|
8851
|
+
const bufferUntilFirstFrame = useCallback13((requestedTime) => {
|
|
8746
8852
|
if (mediaType !== "video") {
|
|
8747
8853
|
return;
|
|
8748
8854
|
}
|
|
@@ -8813,7 +8919,7 @@ var useBufferUntilFirstFrame = ({
|
|
|
8813
8919
|
onVariableFpsVideoDetected,
|
|
8814
8920
|
pauseWhenBuffering
|
|
8815
8921
|
]);
|
|
8816
|
-
return
|
|
8922
|
+
return useMemo25(() => {
|
|
8817
8923
|
return {
|
|
8818
8924
|
isBuffering: () => bufferingRef.current,
|
|
8819
8925
|
bufferUntilFirstFrame
|
|
@@ -8890,9 +8996,9 @@ var getMediaSyncAction = (input) => {
|
|
|
8890
8996
|
};
|
|
8891
8997
|
|
|
8892
8998
|
// src/media-tag-current-time-timestamp.ts
|
|
8893
|
-
import
|
|
8999
|
+
import React25 from "react";
|
|
8894
9000
|
var useCurrentTimeOfMediaTagWithUpdateTimeStamp = (mediaRef) => {
|
|
8895
|
-
const lastUpdate =
|
|
9001
|
+
const lastUpdate = React25.useRef({
|
|
8896
9002
|
time: mediaRef.current?.currentTime ?? 0,
|
|
8897
9003
|
lastUpdate: performance.now()
|
|
8898
9004
|
});
|
|
@@ -8926,7 +9032,7 @@ var seek = ({
|
|
|
8926
9032
|
};
|
|
8927
9033
|
|
|
8928
9034
|
// src/use-media-buffering.ts
|
|
8929
|
-
import { useEffect as
|
|
9035
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
8930
9036
|
var useMediaBuffering = ({
|
|
8931
9037
|
element,
|
|
8932
9038
|
shouldBuffer,
|
|
@@ -8937,8 +9043,8 @@ var useMediaBuffering = ({
|
|
|
8937
9043
|
src
|
|
8938
9044
|
}) => {
|
|
8939
9045
|
const buffer = useBufferState();
|
|
8940
|
-
const [isBuffering, setIsBuffering] =
|
|
8941
|
-
|
|
9046
|
+
const [isBuffering, setIsBuffering] = useState14(false);
|
|
9047
|
+
useEffect11(() => {
|
|
8942
9048
|
let cleanupFns = [];
|
|
8943
9049
|
const { current } = element;
|
|
8944
9050
|
if (!current) {
|
|
@@ -9066,15 +9172,15 @@ var useMediaBuffering = ({
|
|
|
9066
9172
|
};
|
|
9067
9173
|
|
|
9068
9174
|
// src/use-request-video-callback-time.ts
|
|
9069
|
-
import { useEffect as
|
|
9175
|
+
import { useEffect as useEffect12, useRef as useRef17 } from "react";
|
|
9070
9176
|
var useRequestVideoCallbackTime = ({
|
|
9071
9177
|
mediaRef,
|
|
9072
9178
|
mediaType,
|
|
9073
9179
|
lastSeek,
|
|
9074
9180
|
onVariableFpsVideoDetected
|
|
9075
9181
|
}) => {
|
|
9076
|
-
const currentTime =
|
|
9077
|
-
|
|
9182
|
+
const currentTime = useRef17(null);
|
|
9183
|
+
useEffect12(() => {
|
|
9078
9184
|
const { current } = mediaRef;
|
|
9079
9185
|
if (current) {
|
|
9080
9186
|
currentTime.current = {
|
|
@@ -9189,6 +9295,23 @@ var warnAboutNonSeekableMedia = (ref, type) => {
|
|
|
9189
9295
|
};
|
|
9190
9296
|
|
|
9191
9297
|
// src/use-media-playback.ts
|
|
9298
|
+
var DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_AMPLIFICATION = 0.65;
|
|
9299
|
+
var getPauseReason = ({
|
|
9300
|
+
reason,
|
|
9301
|
+
isPremounting,
|
|
9302
|
+
isPostmounting
|
|
9303
|
+
}) => {
|
|
9304
|
+
if (reason === "buffering") {
|
|
9305
|
+
return "player is buffering but media tag is not";
|
|
9306
|
+
}
|
|
9307
|
+
if (isPremounting) {
|
|
9308
|
+
return "media is premounting";
|
|
9309
|
+
}
|
|
9310
|
+
if (isPostmounting) {
|
|
9311
|
+
return "media is postmounting";
|
|
9312
|
+
}
|
|
9313
|
+
return "Player is not playing";
|
|
9314
|
+
};
|
|
9192
9315
|
var useMediaPlayback = ({
|
|
9193
9316
|
mediaRef,
|
|
9194
9317
|
src,
|
|
@@ -9205,19 +9328,16 @@ var useMediaPlayback = ({
|
|
|
9205
9328
|
const { playbackRate: globalPlaybackRate } = usePlaybackRate();
|
|
9206
9329
|
const frame = useCurrentFrame();
|
|
9207
9330
|
const absoluteFrame = useTimelinePosition();
|
|
9208
|
-
const
|
|
9209
|
-
const
|
|
9331
|
+
const playing = usePlaying();
|
|
9332
|
+
const playerBuffering = useBuffering();
|
|
9210
9333
|
const { fps } = useVideoConfig();
|
|
9211
9334
|
const mediaStartsAt = useMediaStartsAt();
|
|
9212
|
-
const lastSeekDueToShift =
|
|
9213
|
-
const lastSeek =
|
|
9335
|
+
const lastSeekDueToShift = useRef18(null);
|
|
9336
|
+
const lastSeek = useRef18(null);
|
|
9214
9337
|
const logLevel = useLogLevel();
|
|
9215
9338
|
const mountTime = useMountTime();
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
}
|
|
9219
|
-
const isVariableFpsVideoMap = useRef19({});
|
|
9220
|
-
const onVariableFpsVideoDetected = useCallback13(() => {
|
|
9339
|
+
const isVariableFpsVideoMap = useRef18({});
|
|
9340
|
+
const onVariableFpsVideoDetected = useCallback14(() => {
|
|
9221
9341
|
if (!src) {
|
|
9222
9342
|
return;
|
|
9223
9343
|
}
|
|
@@ -9259,56 +9379,17 @@ var useMediaPlayback = ({
|
|
|
9259
9379
|
});
|
|
9260
9380
|
const playbackRate = localPlaybackRate * globalPlaybackRate;
|
|
9261
9381
|
const acceptableTimeShiftButLessThanDuration = (() => {
|
|
9262
|
-
const DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_NORMAL_PLAYBACK = 0.45;
|
|
9263
|
-
const DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_AMPLIFICATION = DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_NORMAL_PLAYBACK + 0.2;
|
|
9264
|
-
const defaultAcceptableTimeshift = DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_AMPLIFICATION;
|
|
9265
9382
|
if (mediaRef.current?.duration) {
|
|
9266
|
-
return Math.min(mediaRef.current.duration, acceptableTimeshift ??
|
|
9383
|
+
return Math.min(mediaRef.current.duration, acceptableTimeshift ?? DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_AMPLIFICATION);
|
|
9267
9384
|
}
|
|
9268
|
-
return acceptableTimeshift ??
|
|
9385
|
+
return acceptableTimeshift ?? DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_AMPLIFICATION;
|
|
9269
9386
|
})();
|
|
9270
|
-
const isPlayerBuffering = useIsPlayerBuffering(buffering);
|
|
9271
|
-
useEffect12(() => {
|
|
9272
|
-
if (mediaRef.current?.paused) {
|
|
9273
|
-
return;
|
|
9274
|
-
}
|
|
9275
|
-
if (!playing) {
|
|
9276
|
-
playbackLogging({
|
|
9277
|
-
logLevel,
|
|
9278
|
-
tag: "pause",
|
|
9279
|
-
message: `Pausing ${mediaRef.current?.src} because ${isPremounting ? "media is premounting" : isPostmounting ? "media is postmounting" : "Player is not playing"}`,
|
|
9280
|
-
mountTime
|
|
9281
|
-
});
|
|
9282
|
-
mediaRef.current?.pause();
|
|
9283
|
-
return;
|
|
9284
|
-
}
|
|
9285
|
-
const isMediaTagBufferingOrStalled = isMediaTagBuffering || isBuffering();
|
|
9286
|
-
const playerBufferingNotStateButLive = buffering.buffering.current;
|
|
9287
|
-
if (playerBufferingNotStateButLive && !isMediaTagBufferingOrStalled) {
|
|
9288
|
-
playbackLogging({
|
|
9289
|
-
logLevel,
|
|
9290
|
-
tag: "pause",
|
|
9291
|
-
message: `Pausing ${mediaRef.current?.src} because player is buffering but media tag is not`,
|
|
9292
|
-
mountTime
|
|
9293
|
-
});
|
|
9294
|
-
mediaRef.current?.pause();
|
|
9295
|
-
}
|
|
9296
|
-
}, [
|
|
9297
|
-
isBuffering,
|
|
9298
|
-
isMediaTagBuffering,
|
|
9299
|
-
buffering,
|
|
9300
|
-
isPlayerBuffering,
|
|
9301
|
-
isPremounting,
|
|
9302
|
-
logLevel,
|
|
9303
|
-
mediaRef,
|
|
9304
|
-
mediaType,
|
|
9305
|
-
mountTime,
|
|
9306
|
-
playing,
|
|
9307
|
-
isPostmounting
|
|
9308
|
-
]);
|
|
9309
9387
|
const env = useRemotionEnvironment();
|
|
9310
|
-
|
|
9388
|
+
useLayoutEffect10(() => {
|
|
9311
9389
|
const playbackRateToSet = Math.max(0, playbackRate);
|
|
9390
|
+
if (mediaRef.current && mediaRef.current.defaultPlaybackRate !== playbackRateToSet) {
|
|
9391
|
+
mediaRef.current.defaultPlaybackRate = playbackRateToSet;
|
|
9392
|
+
}
|
|
9312
9393
|
if (mediaRef.current && mediaRef.current.playbackRate !== playbackRateToSet) {
|
|
9313
9394
|
mediaRef.current.playbackRate = playbackRateToSet;
|
|
9314
9395
|
}
|
|
@@ -9316,7 +9397,7 @@ var useMediaPlayback = ({
|
|
|
9316
9397
|
mediaRef.current.preservesPitch = preservePitch;
|
|
9317
9398
|
}
|
|
9318
9399
|
}, [mediaRef, playbackRate, preservePitch]);
|
|
9319
|
-
|
|
9400
|
+
useEffect13(() => {
|
|
9320
9401
|
const tagName = mediaType === "audio" ? "<Html5Audio>" : "<Html5Video>";
|
|
9321
9402
|
if (!mediaRef.current) {
|
|
9322
9403
|
throw new Error(`No ${mediaType} ref found`);
|
|
@@ -9325,6 +9406,26 @@ var useMediaPlayback = ({
|
|
|
9325
9406
|
throw new Error(`No 'src' attribute was passed to the ${tagName} element.`);
|
|
9326
9407
|
}
|
|
9327
9408
|
const { current } = mediaRef;
|
|
9409
|
+
const isMediaTagBufferingOrStalled = isMediaTagBuffering || isBuffering();
|
|
9410
|
+
let pauseReason = null;
|
|
9411
|
+
if (!playing) {
|
|
9412
|
+
pauseReason = "not-playing";
|
|
9413
|
+
} else if (playerBuffering && !isMediaTagBufferingOrStalled) {
|
|
9414
|
+
pauseReason = "buffering";
|
|
9415
|
+
}
|
|
9416
|
+
if (!current.paused && pauseReason !== null) {
|
|
9417
|
+
playbackLogging({
|
|
9418
|
+
logLevel,
|
|
9419
|
+
tag: "pause",
|
|
9420
|
+
message: `Pausing ${current.src} because ${getPauseReason({
|
|
9421
|
+
reason: pauseReason,
|
|
9422
|
+
isPremounting,
|
|
9423
|
+
isPostmounting
|
|
9424
|
+
})}`,
|
|
9425
|
+
mountTime
|
|
9426
|
+
});
|
|
9427
|
+
current.pause();
|
|
9428
|
+
}
|
|
9328
9429
|
const action = getMediaSyncAction({
|
|
9329
9430
|
duration: current.duration,
|
|
9330
9431
|
currentTime: current.currentTime,
|
|
@@ -9340,8 +9441,8 @@ var useMediaPlayback = ({
|
|
|
9340
9441
|
lastSeekDueToShift: lastSeekDueToShift.current,
|
|
9341
9442
|
playing,
|
|
9342
9443
|
playbackRate,
|
|
9343
|
-
mediaTagBufferingOrStalled:
|
|
9344
|
-
playerBuffering
|
|
9444
|
+
mediaTagBufferingOrStalled: isMediaTagBufferingOrStalled,
|
|
9445
|
+
playerBuffering,
|
|
9345
9446
|
absoluteFrame,
|
|
9346
9447
|
onlyWarnForMediaSeekingError,
|
|
9347
9448
|
isPremounting,
|
|
@@ -9416,7 +9517,6 @@ var useMediaPlayback = ({
|
|
|
9416
9517
|
absoluteFrame,
|
|
9417
9518
|
acceptableTimeShiftButLessThanDuration,
|
|
9418
9519
|
bufferUntilFirstFrame,
|
|
9419
|
-
buffering.buffering,
|
|
9420
9520
|
rvcCurrentTime,
|
|
9421
9521
|
logLevel,
|
|
9422
9522
|
desiredUnclampedTime,
|
|
@@ -9426,6 +9526,7 @@ var useMediaPlayback = ({
|
|
|
9426
9526
|
mediaType,
|
|
9427
9527
|
onlyWarnForMediaSeekingError,
|
|
9428
9528
|
playbackRate,
|
|
9529
|
+
playerBuffering,
|
|
9429
9530
|
playing,
|
|
9430
9531
|
src,
|
|
9431
9532
|
onAutoPlayError,
|
|
@@ -9439,7 +9540,7 @@ var useMediaPlayback = ({
|
|
|
9439
9540
|
};
|
|
9440
9541
|
|
|
9441
9542
|
// src/use-media-tag.ts
|
|
9442
|
-
import { useEffect as
|
|
9543
|
+
import { useContext as useContext29, useEffect as useEffect14, useRef as useRef19 } from "react";
|
|
9443
9544
|
var useMediaTag = ({
|
|
9444
9545
|
mediaRef,
|
|
9445
9546
|
id,
|
|
@@ -9448,15 +9549,18 @@ var useMediaTag = ({
|
|
|
9448
9549
|
isPremounting,
|
|
9449
9550
|
isPostmounting
|
|
9450
9551
|
}) => {
|
|
9451
|
-
const { audioAndVideoTags,
|
|
9552
|
+
const { audioAndVideoTags, isPlaying } = useTimelineContext();
|
|
9553
|
+
const { subscribePlaying } = useContext29(SetTimelineContext);
|
|
9554
|
+
const isPlayingRef = useRef19(isPlaying);
|
|
9555
|
+
isPlayingRef.current = isPlaying;
|
|
9452
9556
|
const logLevel = useLogLevel();
|
|
9453
9557
|
const mountTime = useMountTime();
|
|
9454
9558
|
const env = useRemotionEnvironment();
|
|
9455
|
-
|
|
9559
|
+
useEffect14(() => {
|
|
9456
9560
|
const tag = {
|
|
9457
9561
|
id,
|
|
9458
9562
|
play: (reason) => {
|
|
9459
|
-
if (!
|
|
9563
|
+
if (!isPlayingRef.current()) {
|
|
9460
9564
|
return;
|
|
9461
9565
|
}
|
|
9462
9566
|
if (isPremounting || isPostmounting) {
|
|
@@ -9474,7 +9578,24 @@ var useMediaTag = ({
|
|
|
9474
9578
|
}
|
|
9475
9579
|
};
|
|
9476
9580
|
audioAndVideoTags.current.push(tag);
|
|
9581
|
+
const unsubscribe = subscribePlaying((state) => {
|
|
9582
|
+
if (state.playing) {
|
|
9583
|
+
return;
|
|
9584
|
+
}
|
|
9585
|
+
const media = mediaRef.current;
|
|
9586
|
+
if (!media || media.paused) {
|
|
9587
|
+
return;
|
|
9588
|
+
}
|
|
9589
|
+
playbackLogging({
|
|
9590
|
+
logLevel,
|
|
9591
|
+
tag: "pause",
|
|
9592
|
+
message: `Pausing ${media.src} because Player is not playing`,
|
|
9593
|
+
mountTime
|
|
9594
|
+
});
|
|
9595
|
+
media.pause();
|
|
9596
|
+
});
|
|
9477
9597
|
return () => {
|
|
9598
|
+
unsubscribe();
|
|
9478
9599
|
audioAndVideoTags.current = audioAndVideoTags.current.filter((a2) => a2.id !== id);
|
|
9479
9600
|
};
|
|
9480
9601
|
}, [
|
|
@@ -9483,22 +9604,22 @@ var useMediaTag = ({
|
|
|
9483
9604
|
mediaRef,
|
|
9484
9605
|
mediaType,
|
|
9485
9606
|
onAutoPlayError,
|
|
9486
|
-
imperativePlaying,
|
|
9487
9607
|
isPremounting,
|
|
9488
9608
|
isPostmounting,
|
|
9489
9609
|
logLevel,
|
|
9490
9610
|
mountTime,
|
|
9491
|
-
env.isPlayer
|
|
9611
|
+
env.isPlayer,
|
|
9612
|
+
subscribePlaying
|
|
9492
9613
|
]);
|
|
9493
9614
|
};
|
|
9494
9615
|
|
|
9495
9616
|
// src/volume-position-state.ts
|
|
9496
|
-
import { createContext as
|
|
9497
|
-
var MediaVolumeContext =
|
|
9617
|
+
import { createContext as createContext23, useContext as useContext30, useMemo as useMemo26 } from "react";
|
|
9618
|
+
var MediaVolumeContext = createContext23({
|
|
9498
9619
|
playerMuted: false,
|
|
9499
9620
|
mediaVolume: 1
|
|
9500
9621
|
});
|
|
9501
|
-
var SetMediaVolumeContext =
|
|
9622
|
+
var SetMediaVolumeContext = createContext23({
|
|
9502
9623
|
setPlayerMuted: () => {
|
|
9503
9624
|
throw new Error("default");
|
|
9504
9625
|
},
|
|
@@ -9507,16 +9628,16 @@ var SetMediaVolumeContext = createContext24({
|
|
|
9507
9628
|
}
|
|
9508
9629
|
});
|
|
9509
9630
|
var useMediaVolumeState = () => {
|
|
9510
|
-
const { mediaVolume } =
|
|
9511
|
-
const { setMediaVolume } =
|
|
9512
|
-
return
|
|
9631
|
+
const { mediaVolume } = useContext30(MediaVolumeContext);
|
|
9632
|
+
const { setMediaVolume } = useContext30(SetMediaVolumeContext);
|
|
9633
|
+
return useMemo26(() => {
|
|
9513
9634
|
return [mediaVolume, setMediaVolume];
|
|
9514
9635
|
}, [mediaVolume, setMediaVolume]);
|
|
9515
9636
|
};
|
|
9516
9637
|
var usePlayerMutedState = () => {
|
|
9517
|
-
const { playerMuted } =
|
|
9518
|
-
const { setPlayerMuted } =
|
|
9519
|
-
return
|
|
9638
|
+
const { playerMuted } = useContext30(MediaVolumeContext);
|
|
9639
|
+
const { setPlayerMuted } = useContext30(SetMediaVolumeContext);
|
|
9640
|
+
return useMemo26(() => {
|
|
9520
9641
|
return [playerMuted, setPlayerMuted];
|
|
9521
9642
|
}, [playerMuted, setPlayerMuted]);
|
|
9522
9643
|
};
|
|
@@ -9531,7 +9652,7 @@ var warnAboutTooHighVolume = (volume) => {
|
|
|
9531
9652
|
// src/audio/AudioForPreview.tsx
|
|
9532
9653
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
9533
9654
|
var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
9534
|
-
const [initialShouldPreMountAudioElements] =
|
|
9655
|
+
const [initialShouldPreMountAudioElements] = useState15(props.shouldPreMountAudioTags);
|
|
9535
9656
|
if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
|
|
9536
9657
|
throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");
|
|
9537
9658
|
}
|
|
@@ -9574,8 +9695,9 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
9574
9695
|
throw new TypeError("No 'src' was passed to <Html5Audio>.");
|
|
9575
9696
|
}
|
|
9576
9697
|
const preloadedSrc = usePreload(src);
|
|
9577
|
-
const sequenceContext =
|
|
9578
|
-
const
|
|
9698
|
+
const sequenceContext = useContext31(SequenceContext);
|
|
9699
|
+
const { isStudio } = useRemotionEnvironment();
|
|
9700
|
+
const [timelineId] = useState15(() => String(Math.random()));
|
|
9579
9701
|
const userPreferredVolume = evaluateVolume({
|
|
9580
9702
|
frame: volumePropFrame,
|
|
9581
9703
|
volume,
|
|
@@ -9587,7 +9709,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
9587
9709
|
requestsVideoFrame: false,
|
|
9588
9710
|
isClientSideRendering: false
|
|
9589
9711
|
});
|
|
9590
|
-
const propsToPass =
|
|
9712
|
+
const propsToPass = useMemo27(() => {
|
|
9591
9713
|
return {
|
|
9592
9714
|
muted: muted || playerMuted || userPreferredVolume <= 0,
|
|
9593
9715
|
src: preloadedSrc,
|
|
@@ -9604,7 +9726,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
9604
9726
|
userPreferredVolume,
|
|
9605
9727
|
crossOriginValue
|
|
9606
9728
|
]);
|
|
9607
|
-
const id =
|
|
9729
|
+
const id = useMemo27(() => `audio-${random(src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
|
|
9608
9730
|
src,
|
|
9609
9731
|
sequenceContext?.relativeFrom,
|
|
9610
9732
|
sequenceContext?.cumulatedFrom,
|
|
@@ -9622,7 +9744,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
9622
9744
|
premounting: Boolean(sequenceContext?.premounting),
|
|
9623
9745
|
postmounting: Boolean(sequenceContext?.postmounting)
|
|
9624
9746
|
});
|
|
9625
|
-
const getStack =
|
|
9747
|
+
const getStack = useCallback15(() => {
|
|
9626
9748
|
return _remotionInternalStack ?? null;
|
|
9627
9749
|
}, [_remotionInternalStack]);
|
|
9628
9750
|
useMediaInTimeline({
|
|
@@ -9670,7 +9792,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
9670
9792
|
volume: userPreferredVolume,
|
|
9671
9793
|
shouldUseWebAudioApi: useWebAudioApi ?? false
|
|
9672
9794
|
});
|
|
9673
|
-
const effectToUse =
|
|
9795
|
+
const effectToUse = React26.useInsertionEffect ?? React26.useLayoutEffect;
|
|
9674
9796
|
effectToUse(() => {
|
|
9675
9797
|
return () => {
|
|
9676
9798
|
requestAnimationFrame(() => {
|
|
@@ -9683,7 +9805,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
9683
9805
|
}, [audioRef]);
|
|
9684
9806
|
const currentOnDurationCallback = useRef20(onDuration);
|
|
9685
9807
|
currentOnDurationCallback.current = onDuration;
|
|
9686
|
-
|
|
9808
|
+
useEffect15(() => {
|
|
9687
9809
|
const { current } = audioRef;
|
|
9688
9810
|
if (!current) {
|
|
9689
9811
|
return;
|
|
@@ -9701,25 +9823,32 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
9701
9823
|
};
|
|
9702
9824
|
}, [audioRef, src]);
|
|
9703
9825
|
if (initialShouldPreMountAudioElements) {
|
|
9704
|
-
return
|
|
9826
|
+
return isStudio ? /* @__PURE__ */ jsx22(SequenceOrderMarker, {
|
|
9827
|
+
sequenceId: timelineId,
|
|
9828
|
+
children: null
|
|
9829
|
+
}) : null;
|
|
9705
9830
|
}
|
|
9706
|
-
|
|
9831
|
+
const audio = /* @__PURE__ */ jsx22("audio", {
|
|
9707
9832
|
ref: audioRef,
|
|
9708
9833
|
preload: "metadata",
|
|
9709
9834
|
crossOrigin: crossOriginValue,
|
|
9710
9835
|
...propsToPass
|
|
9711
9836
|
});
|
|
9837
|
+
return isStudio ? /* @__PURE__ */ jsx22(SequenceOrderMarker, {
|
|
9838
|
+
sequenceId: timelineId,
|
|
9839
|
+
children: audio
|
|
9840
|
+
}) : audio;
|
|
9712
9841
|
};
|
|
9713
9842
|
var AudioForPreview = forwardRef5(AudioForDevelopmentForwardRefFunction);
|
|
9714
9843
|
|
|
9715
9844
|
// src/audio/AudioForRendering.tsx
|
|
9716
9845
|
import {
|
|
9717
9846
|
forwardRef as forwardRef6,
|
|
9718
|
-
useContext as
|
|
9719
|
-
useEffect as
|
|
9847
|
+
useContext as useContext32,
|
|
9848
|
+
useEffect as useEffect16,
|
|
9720
9849
|
useImperativeHandle as useImperativeHandle5,
|
|
9721
|
-
useLayoutEffect as
|
|
9722
|
-
useMemo as
|
|
9850
|
+
useLayoutEffect as useLayoutEffect11,
|
|
9851
|
+
useMemo as useMemo28,
|
|
9723
9852
|
useRef as useRef21
|
|
9724
9853
|
} from "react";
|
|
9725
9854
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
@@ -9747,10 +9876,10 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
9747
9876
|
const absoluteFrame = useTimelinePosition();
|
|
9748
9877
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
9749
9878
|
const frame = useCurrentFrame();
|
|
9750
|
-
const sequenceContext =
|
|
9751
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
9879
|
+
const sequenceContext = useContext32(SequenceContext);
|
|
9880
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext32(RenderAssetManager);
|
|
9752
9881
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
9753
|
-
const id =
|
|
9882
|
+
const id = useMemo28(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
|
|
9754
9883
|
props.src,
|
|
9755
9884
|
sequenceContext?.relativeFrom,
|
|
9756
9885
|
sequenceContext?.cumulatedFrom,
|
|
@@ -9765,7 +9894,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
9765
9894
|
useImperativeHandle5(ref, () => {
|
|
9766
9895
|
return audioRef.current;
|
|
9767
9896
|
}, []);
|
|
9768
|
-
|
|
9897
|
+
useEffect16(() => {
|
|
9769
9898
|
if (!props.src) {
|
|
9770
9899
|
throw new Error("No src passed");
|
|
9771
9900
|
}
|
|
@@ -9809,7 +9938,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
9809
9938
|
]);
|
|
9810
9939
|
const { src } = props;
|
|
9811
9940
|
const needsToRenderAudioTag = ref || _remotionInternalNeedsDurationCalculation;
|
|
9812
|
-
|
|
9941
|
+
useLayoutEffect11(() => {
|
|
9813
9942
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
9814
9943
|
return;
|
|
9815
9944
|
}
|
|
@@ -9860,7 +9989,7 @@ var AudioForRendering = forwardRef6(AudioForRenderingRefForwardingFunction);
|
|
|
9860
9989
|
// src/audio/html5-audio.tsx
|
|
9861
9990
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
9862
9991
|
var AudioRefForwardingFunction = (props, ref) => {
|
|
9863
|
-
const audioTagsContext =
|
|
9992
|
+
const audioTagsContext = useContext33(SharedAudioTagsContext);
|
|
9864
9993
|
const propsWithFreeze = props;
|
|
9865
9994
|
const {
|
|
9866
9995
|
startFrom,
|
|
@@ -9885,12 +10014,12 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
9885
10014
|
if (typeof freeze !== "undefined") {
|
|
9886
10015
|
throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');
|
|
9887
10016
|
}
|
|
9888
|
-
const { durations, setDurations } =
|
|
10017
|
+
const { durations, setDurations } = useContext33(DurationsContext);
|
|
9889
10018
|
if (typeof props.src !== "string") {
|
|
9890
10019
|
throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
9891
10020
|
}
|
|
9892
10021
|
const preloadedSrc = usePreload(props.src);
|
|
9893
|
-
const onError =
|
|
10022
|
+
const onError = useCallback16((e) => {
|
|
9894
10023
|
console.log(e.currentTarget.error);
|
|
9895
10024
|
const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
|
|
9896
10025
|
if (loop) {
|
|
@@ -9904,7 +10033,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
9904
10033
|
console.warn(errMessage);
|
|
9905
10034
|
}
|
|
9906
10035
|
}, [loop, onRemotionError, preloadedSrc]);
|
|
9907
|
-
const onDuration =
|
|
10036
|
+
const onDuration = useCallback16((src, durationInSeconds) => {
|
|
9908
10037
|
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
9909
10038
|
}, [setDurations]);
|
|
9910
10039
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props.src)];
|
|
@@ -9987,12 +10116,12 @@ var Audio = Html5Audio;
|
|
|
9987
10116
|
// src/effects/Solid.tsx
|
|
9988
10117
|
import {
|
|
9989
10118
|
forwardRef as forwardRef8,
|
|
9990
|
-
useCallback as
|
|
9991
|
-
useEffect as
|
|
10119
|
+
useCallback as useCallback17,
|
|
10120
|
+
useEffect as useEffect17,
|
|
9992
10121
|
useImperativeHandle as useImperativeHandle6,
|
|
9993
|
-
useMemo as
|
|
10122
|
+
useMemo as useMemo29,
|
|
9994
10123
|
useRef as useRef22,
|
|
9995
|
-
useState as
|
|
10124
|
+
useState as useState16
|
|
9996
10125
|
} from "react";
|
|
9997
10126
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
9998
10127
|
var resolveSolidPixelDensity = (pixelDensity) => {
|
|
@@ -10057,12 +10186,12 @@ var SolidInner = ({
|
|
|
10057
10186
|
const resolvedPixelDensity = resolveSolidPixelDensity(pixelDensity);
|
|
10058
10187
|
const canvasWidth = Math.ceil(width * resolvedPixelDensity);
|
|
10059
10188
|
const canvasHeight = Math.ceil(height * resolvedPixelDensity);
|
|
10060
|
-
const [outputCanvas, setOutputCanvas] =
|
|
10189
|
+
const [outputCanvas, setOutputCanvas] = useState16(null);
|
|
10061
10190
|
const memoizedEffects = useMemoizedEffects({
|
|
10062
10191
|
effects,
|
|
10063
10192
|
overrideId: overrideId ?? null
|
|
10064
10193
|
});
|
|
10065
|
-
const sourceCanvas =
|
|
10194
|
+
const sourceCanvas = useMemo29(() => {
|
|
10066
10195
|
if (typeof document === "undefined") {
|
|
10067
10196
|
return null;
|
|
10068
10197
|
}
|
|
@@ -10072,7 +10201,7 @@ var SolidInner = ({
|
|
|
10072
10201
|
return canvas;
|
|
10073
10202
|
}, []);
|
|
10074
10203
|
const chainState = useEffectChainState();
|
|
10075
|
-
const canvasRef =
|
|
10204
|
+
const canvasRef = useCallback17((canvas) => {
|
|
10076
10205
|
setOutputCanvas(canvas);
|
|
10077
10206
|
if (typeof reference === "function") {
|
|
10078
10207
|
reference(canvas);
|
|
@@ -10080,7 +10209,7 @@ var SolidInner = ({
|
|
|
10080
10209
|
reference.current = canvas;
|
|
10081
10210
|
}
|
|
10082
10211
|
}, [reference]);
|
|
10083
|
-
|
|
10212
|
+
useEffect17(() => {
|
|
10084
10213
|
if (!outputCanvas || !sourceCanvas) {
|
|
10085
10214
|
return;
|
|
10086
10215
|
}
|
|
@@ -10130,7 +10259,7 @@ var SolidInner = ({
|
|
|
10130
10259
|
cancelRender2,
|
|
10131
10260
|
memoizedEffects
|
|
10132
10261
|
]);
|
|
10133
|
-
const canvasStyle =
|
|
10262
|
+
const canvasStyle = useMemo29(() => {
|
|
10134
10263
|
return {
|
|
10135
10264
|
width,
|
|
10136
10265
|
height,
|
|
@@ -10218,12 +10347,12 @@ Solid.displayName = "Solid";
|
|
|
10218
10347
|
addSequenceStackTraces(Solid);
|
|
10219
10348
|
// src/HtmlInCanvas.tsx
|
|
10220
10349
|
import {
|
|
10221
|
-
createContext as
|
|
10350
|
+
createContext as createContext24,
|
|
10222
10351
|
forwardRef as forwardRef9,
|
|
10223
|
-
useCallback as
|
|
10224
|
-
useContext as
|
|
10225
|
-
useLayoutEffect as
|
|
10226
|
-
useMemo as
|
|
10352
|
+
useCallback as useCallback18,
|
|
10353
|
+
useContext as useContext34,
|
|
10354
|
+
useLayoutEffect as useLayoutEffect12,
|
|
10355
|
+
useMemo as useMemo30,
|
|
10227
10356
|
useRef as useRef23
|
|
10228
10357
|
} from "react";
|
|
10229
10358
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
@@ -10300,7 +10429,7 @@ var defaultOnPaint = ({
|
|
|
10300
10429
|
const transform = ctx.drawElementImage(elementImage, 0, 0);
|
|
10301
10430
|
element.style.transform = transform.toString();
|
|
10302
10431
|
};
|
|
10303
|
-
var HtmlInCanvasAncestorContext =
|
|
10432
|
+
var HtmlInCanvasAncestorContext = createContext24(false);
|
|
10304
10433
|
var HtmlInCanvasContent = forwardRef9(({
|
|
10305
10434
|
width,
|
|
10306
10435
|
height,
|
|
@@ -10312,7 +10441,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
10312
10441
|
controls,
|
|
10313
10442
|
style
|
|
10314
10443
|
}, ref) => {
|
|
10315
|
-
const isInsideAncestorHtmlInCanvas =
|
|
10444
|
+
const isInsideAncestorHtmlInCanvas = useContext34(HtmlInCanvasAncestorContext);
|
|
10316
10445
|
assertHtmlInCanvasDimensions(width, height);
|
|
10317
10446
|
if (isInsideAncestorHtmlInCanvas) {
|
|
10318
10447
|
throw new Error("<HtmlInCanvas> components cannot be nested. Chrome does not reliably render nested HTML-in-canvas subtrees. Consider merging the effects into one <HtmlInCanvas> if you can.");
|
|
@@ -10331,7 +10460,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
10331
10460
|
const paintTargetRef = useRef23(null);
|
|
10332
10461
|
const divRef = useRef23(null);
|
|
10333
10462
|
const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}-${usesDirectLayoutCanvas ? "direct" : "offscreen"}`;
|
|
10334
|
-
const setLayoutCanvasRef =
|
|
10463
|
+
const setLayoutCanvasRef = useCallback18((node) => {
|
|
10335
10464
|
canvas2dRef.current = node;
|
|
10336
10465
|
if (typeof ref === "function") {
|
|
10337
10466
|
ref(node);
|
|
@@ -10353,7 +10482,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
10353
10482
|
const initializedRef = useRef23(false);
|
|
10354
10483
|
const onInitCleanupRef = useRef23(null);
|
|
10355
10484
|
const unmountedRef = useRef23(false);
|
|
10356
|
-
const onPaintCb =
|
|
10485
|
+
const onPaintCb = useCallback18(async () => {
|
|
10357
10486
|
const element = divRef.current;
|
|
10358
10487
|
if (!element) {
|
|
10359
10488
|
throw new Error("Canvas or scene element not found");
|
|
@@ -10476,7 +10605,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
10476
10605
|
resolvedPixelDensity,
|
|
10477
10606
|
canRetryMissingPaintRecord
|
|
10478
10607
|
]);
|
|
10479
|
-
|
|
10608
|
+
useLayoutEffect12(() => {
|
|
10480
10609
|
const placeholder = canvas2dRef.current;
|
|
10481
10610
|
if (!placeholder) {
|
|
10482
10611
|
throw new Error("Canvas not found");
|
|
@@ -10508,7 +10637,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
10508
10637
|
usesDirectLayoutCanvas
|
|
10509
10638
|
]);
|
|
10510
10639
|
const onPaintChangedRef = useRef23(false);
|
|
10511
|
-
|
|
10640
|
+
useLayoutEffect12(() => {
|
|
10512
10641
|
if (!onPaintChangedRef.current) {
|
|
10513
10642
|
onPaintChangedRef.current = true;
|
|
10514
10643
|
return;
|
|
@@ -10519,7 +10648,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
10519
10648
|
}
|
|
10520
10649
|
canvas.requestPaint?.();
|
|
10521
10650
|
}, [onPaint, memoizedEffects]);
|
|
10522
|
-
|
|
10651
|
+
useLayoutEffect12(() => {
|
|
10523
10652
|
const canvas = canvas2dRef.current;
|
|
10524
10653
|
if (!canvas) {
|
|
10525
10654
|
return;
|
|
@@ -10532,13 +10661,13 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
10532
10661
|
continueRender2(handle);
|
|
10533
10662
|
};
|
|
10534
10663
|
}, [width, height, continueRender2, delayRender2, canvasSizeKey]);
|
|
10535
|
-
const innerStyle =
|
|
10664
|
+
const innerStyle = useMemo30(() => {
|
|
10536
10665
|
return {
|
|
10537
10666
|
width,
|
|
10538
10667
|
height
|
|
10539
10668
|
};
|
|
10540
10669
|
}, [width, height]);
|
|
10541
|
-
const canvasStyle =
|
|
10670
|
+
const canvasStyle = useMemo30(() => {
|
|
10542
10671
|
return {
|
|
10543
10672
|
width,
|
|
10544
10673
|
height,
|
|
@@ -10581,7 +10710,7 @@ var HtmlInCanvasInner = forwardRef9(({
|
|
|
10581
10710
|
}, ref) => {
|
|
10582
10711
|
const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
|
|
10583
10712
|
const actualRef = useRef23(null);
|
|
10584
|
-
const setCanvasRef =
|
|
10713
|
+
const setCanvasRef = useCallback18((node) => {
|
|
10585
10714
|
actualRef.current = node;
|
|
10586
10715
|
if (typeof ref === "function") {
|
|
10587
10716
|
ref(node);
|
|
@@ -10653,13 +10782,13 @@ addSequenceStackTraces(HtmlInCanvas);
|
|
|
10653
10782
|
// src/canvas-image/CanvasImage.tsx
|
|
10654
10783
|
import {
|
|
10655
10784
|
forwardRef as forwardRef10,
|
|
10656
|
-
useCallback as
|
|
10657
|
-
useContext as
|
|
10785
|
+
useCallback as useCallback19,
|
|
10786
|
+
useContext as useContext35,
|
|
10658
10787
|
useImperativeHandle as useImperativeHandle7,
|
|
10659
|
-
useLayoutEffect as
|
|
10660
|
-
useMemo as
|
|
10788
|
+
useLayoutEffect as useLayoutEffect13,
|
|
10789
|
+
useMemo as useMemo31,
|
|
10661
10790
|
useRef as useRef24,
|
|
10662
|
-
useState as
|
|
10791
|
+
useState as useState17
|
|
10663
10792
|
} from "react";
|
|
10664
10793
|
|
|
10665
10794
|
// src/truncate-src-for-label.ts
|
|
@@ -10678,6 +10807,7 @@ import { jsx as jsx27 } from "react/jsx-runtime";
|
|
|
10678
10807
|
var canvasImageSchema = {
|
|
10679
10808
|
src: {
|
|
10680
10809
|
type: "asset",
|
|
10810
|
+
assetType: "image",
|
|
10681
10811
|
default: undefined,
|
|
10682
10812
|
description: "Source",
|
|
10683
10813
|
keyframable: false
|
|
@@ -10790,20 +10920,20 @@ var CanvasImageContent = forwardRef10(({
|
|
|
10790
10920
|
}, ref) => {
|
|
10791
10921
|
const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
|
|
10792
10922
|
const { delayPlayback } = useBufferState();
|
|
10793
|
-
const [outputCanvas, setOutputCanvas] =
|
|
10794
|
-
const [loadedImage, setLoadedImage] =
|
|
10923
|
+
const [outputCanvas, setOutputCanvas] = useState17(null);
|
|
10924
|
+
const [loadedImage, setLoadedImage] = useState17(null);
|
|
10795
10925
|
const actualSrc = usePreload(src);
|
|
10796
10926
|
const chainState = useEffectChainState();
|
|
10797
10927
|
const memoizedEffects = useMemoizedEffects({
|
|
10798
10928
|
effects,
|
|
10799
10929
|
overrideId: controls?.overrideId ?? null
|
|
10800
10930
|
});
|
|
10801
|
-
const sequenceContext =
|
|
10931
|
+
const sequenceContext = useContext35(SequenceContext);
|
|
10802
10932
|
const pendingLoadDelayRef = useRef24(null);
|
|
10803
|
-
const [isLoadPending, setIsLoadPending] =
|
|
10933
|
+
const [isLoadPending, setIsLoadPending] = useState17(false);
|
|
10804
10934
|
const isPremounting = Boolean(sequenceContext?.premounting);
|
|
10805
10935
|
const isPostmounting = Boolean(sequenceContext?.postmounting);
|
|
10806
|
-
const continuePendingLoadDelay =
|
|
10936
|
+
const continuePendingLoadDelay = useCallback19(({ markAsReady }) => {
|
|
10807
10937
|
const pending = pendingLoadDelayRef.current;
|
|
10808
10938
|
if (!pending || pending.continued) {
|
|
10809
10939
|
return;
|
|
@@ -10815,13 +10945,13 @@ var CanvasImageContent = forwardRef10(({
|
|
|
10815
10945
|
continueRender2(pending.handle);
|
|
10816
10946
|
pendingLoadDelayRef.current = null;
|
|
10817
10947
|
}, [continueRender2]);
|
|
10818
|
-
const sourceCanvas =
|
|
10948
|
+
const sourceCanvas = useMemo31(() => {
|
|
10819
10949
|
if (typeof document === "undefined") {
|
|
10820
10950
|
return null;
|
|
10821
10951
|
}
|
|
10822
10952
|
return document.createElement("canvas");
|
|
10823
10953
|
}, []);
|
|
10824
|
-
const canvasRef =
|
|
10954
|
+
const canvasRef = useCallback19((canvas) => {
|
|
10825
10955
|
setOutputCanvas(canvas);
|
|
10826
10956
|
if (refForOutline) {
|
|
10827
10957
|
refForOutline.current = canvas;
|
|
@@ -10832,7 +10962,7 @@ var CanvasImageContent = forwardRef10(({
|
|
|
10832
10962
|
ref.current = canvas;
|
|
10833
10963
|
}
|
|
10834
10964
|
}, [ref, refForOutline]);
|
|
10835
|
-
|
|
10965
|
+
useLayoutEffect13(() => {
|
|
10836
10966
|
if (!pauseWhenLoading || !isLoadPending || isPremounting || isPostmounting) {
|
|
10837
10967
|
return;
|
|
10838
10968
|
}
|
|
@@ -10844,7 +10974,7 @@ var CanvasImageContent = forwardRef10(({
|
|
|
10844
10974
|
isPremounting,
|
|
10845
10975
|
pauseWhenLoading
|
|
10846
10976
|
]);
|
|
10847
|
-
|
|
10977
|
+
useLayoutEffect13(() => {
|
|
10848
10978
|
const handle = delayRender2(`Rendering <CanvasImage> with src="${truncateSrcForLabel(actualSrc)}"`, {
|
|
10849
10979
|
retries: delayRenderRetries ?? undefined,
|
|
10850
10980
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
@@ -10906,7 +11036,7 @@ var CanvasImageContent = forwardRef10(({
|
|
|
10906
11036
|
maxRetries,
|
|
10907
11037
|
onError
|
|
10908
11038
|
]);
|
|
10909
|
-
|
|
11039
|
+
useLayoutEffect13(() => {
|
|
10910
11040
|
if (!loadedImage || !outputCanvas || !sourceCanvas) {
|
|
10911
11041
|
return;
|
|
10912
11042
|
}
|
|
@@ -11157,7 +11287,7 @@ var getStaticFiles = () => {
|
|
|
11157
11287
|
return window.remotion_staticFiles;
|
|
11158
11288
|
};
|
|
11159
11289
|
// src/IFrame.tsx
|
|
11160
|
-
import { forwardRef as forwardRef11, useCallback as
|
|
11290
|
+
import { forwardRef as forwardRef11, useCallback as useCallback20, useState as useState18 } from "react";
|
|
11161
11291
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
11162
11292
|
var IFrameRefForwarding = ({
|
|
11163
11293
|
onLoad,
|
|
@@ -11167,15 +11297,15 @@ var IFrameRefForwarding = ({
|
|
|
11167
11297
|
...props2
|
|
11168
11298
|
}, ref) => {
|
|
11169
11299
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
11170
|
-
const [handle] =
|
|
11300
|
+
const [handle] = useState18(() => delayRender2(`Loading <IFrame> with source ${props2.src}`, {
|
|
11171
11301
|
retries: delayRenderRetries ?? undefined,
|
|
11172
11302
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
11173
11303
|
}));
|
|
11174
|
-
const didLoad =
|
|
11304
|
+
const didLoad = useCallback20((e) => {
|
|
11175
11305
|
continueRender2(handle);
|
|
11176
11306
|
onLoad?.(e);
|
|
11177
11307
|
}, [handle, onLoad, continueRender2]);
|
|
11178
|
-
const didGetError =
|
|
11308
|
+
const didGetError = useCallback20((e) => {
|
|
11179
11309
|
continueRender2(handle);
|
|
11180
11310
|
if (onError) {
|
|
11181
11311
|
onError(e);
|
|
@@ -11194,11 +11324,11 @@ var IFrameRefForwarding = ({
|
|
|
11194
11324
|
var IFrame = forwardRef11(IFrameRefForwarding);
|
|
11195
11325
|
// src/Img.tsx
|
|
11196
11326
|
import {
|
|
11197
|
-
useCallback as
|
|
11198
|
-
useContext as
|
|
11199
|
-
useLayoutEffect as
|
|
11327
|
+
useCallback as useCallback21,
|
|
11328
|
+
useContext as useContext36,
|
|
11329
|
+
useLayoutEffect as useLayoutEffect14,
|
|
11200
11330
|
useRef as useRef25,
|
|
11201
|
-
useState as
|
|
11331
|
+
useState as useState19
|
|
11202
11332
|
} from "react";
|
|
11203
11333
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
11204
11334
|
function exponentialBackoff2(errorCount) {
|
|
@@ -11221,13 +11351,13 @@ var ImgContent = ({
|
|
|
11221
11351
|
const imageRef = useRef25(null);
|
|
11222
11352
|
const errors = useRef25({});
|
|
11223
11353
|
const { delayPlayback } = useBufferState();
|
|
11224
|
-
const sequenceContext =
|
|
11225
|
-
const [isLoading, setIsLoading] =
|
|
11354
|
+
const sequenceContext = useContext36(SequenceContext);
|
|
11355
|
+
const [isLoading, setIsLoading] = useState19(false);
|
|
11226
11356
|
const _propsValid = true;
|
|
11227
11357
|
if (!_propsValid) {
|
|
11228
11358
|
throw new Error("typecheck error");
|
|
11229
11359
|
}
|
|
11230
|
-
const imageCallbackRef =
|
|
11360
|
+
const imageCallbackRef = useCallback21((img) => {
|
|
11231
11361
|
imageRef.current = img;
|
|
11232
11362
|
refForOutline.current = img;
|
|
11233
11363
|
if (typeof ref === "function") {
|
|
@@ -11237,7 +11367,7 @@ var ImgContent = ({
|
|
|
11237
11367
|
}
|
|
11238
11368
|
}, [ref, refForOutline]);
|
|
11239
11369
|
const actualSrc = usePreload(src);
|
|
11240
|
-
const retryIn =
|
|
11370
|
+
const retryIn = useCallback21((timeout) => {
|
|
11241
11371
|
if (!imageRef.current) {
|
|
11242
11372
|
return;
|
|
11243
11373
|
}
|
|
@@ -11257,7 +11387,7 @@ var ImgContent = ({
|
|
|
11257
11387
|
const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
|
|
11258
11388
|
const isPremounting = Boolean(sequenceContext?.premounting);
|
|
11259
11389
|
const isPostmounting = Boolean(sequenceContext?.postmounting);
|
|
11260
|
-
const didGetError =
|
|
11390
|
+
const didGetError = useCallback21((e) => {
|
|
11261
11391
|
if (!errors.current) {
|
|
11262
11392
|
return;
|
|
11263
11393
|
}
|
|
@@ -11277,7 +11407,7 @@ var ImgContent = ({
|
|
|
11277
11407
|
} catch {}
|
|
11278
11408
|
}, [cancelRender2, maxRetries, onError, retryIn]);
|
|
11279
11409
|
if (typeof window !== "undefined") {
|
|
11280
|
-
|
|
11410
|
+
useLayoutEffect14(() => {
|
|
11281
11411
|
if (!pauseWhenLoading || !isLoading || isPremounting || isPostmounting) {
|
|
11282
11412
|
return;
|
|
11283
11413
|
}
|
|
@@ -11289,7 +11419,7 @@ var ImgContent = ({
|
|
|
11289
11419
|
isPremounting,
|
|
11290
11420
|
pauseWhenLoading
|
|
11291
11421
|
]);
|
|
11292
|
-
|
|
11422
|
+
useLayoutEffect14(() => {
|
|
11293
11423
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
11294
11424
|
if (imageRef.current) {
|
|
11295
11425
|
imageRef.current.src = actualSrc;
|
|
@@ -11446,6 +11576,7 @@ var CanvasImageWithPrivateProps = CanvasImage;
|
|
|
11446
11576
|
var imgSchema = {
|
|
11447
11577
|
src: {
|
|
11448
11578
|
type: "asset",
|
|
11579
|
+
assetType: "image",
|
|
11449
11580
|
default: undefined,
|
|
11450
11581
|
description: "Source",
|
|
11451
11582
|
keyframable: false
|
|
@@ -11623,7 +11754,7 @@ var Img = withInteractivitySchema({
|
|
|
11623
11754
|
});
|
|
11624
11755
|
addSequenceStackTraces(Img);
|
|
11625
11756
|
// src/Interactive.tsx
|
|
11626
|
-
import
|
|
11757
|
+
import React33, { forwardRef as forwardRef12, useCallback as useCallback22, useRef as useRef26 } from "react";
|
|
11627
11758
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
11628
11759
|
var sourcePathToIdentityPrefix = (packageName) => {
|
|
11629
11760
|
if (packageName === "remotion") {
|
|
@@ -11717,7 +11848,7 @@ var makeInteractiveElement = (tag, displayName, schema) => {
|
|
|
11717
11848
|
componentName: displayName
|
|
11718
11849
|
});
|
|
11719
11850
|
const refForOutline = useRef26(null);
|
|
11720
|
-
const callbackRef =
|
|
11851
|
+
const callbackRef = useCallback22((element) => {
|
|
11721
11852
|
refForOutline.current = element;
|
|
11722
11853
|
setRef2(ref, element);
|
|
11723
11854
|
}, [ref]);
|
|
@@ -11733,7 +11864,7 @@ var makeInteractiveElement = (tag, displayName, schema) => {
|
|
|
11733
11864
|
controls,
|
|
11734
11865
|
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive",
|
|
11735
11866
|
outlineRef: refForOutline,
|
|
11736
|
-
children:
|
|
11867
|
+
children: React33.createElement(tag, {
|
|
11737
11868
|
...props2,
|
|
11738
11869
|
style: croppedStyle ?? undefined,
|
|
11739
11870
|
ref: callbackRef
|
|
@@ -11849,18 +11980,21 @@ var getAnimatedImageDurationInSeconds = async ({
|
|
|
11849
11980
|
};
|
|
11850
11981
|
|
|
11851
11982
|
// src/CompositionManager.tsx
|
|
11852
|
-
import
|
|
11853
|
-
var compositionsRef =
|
|
11983
|
+
import React34 from "react";
|
|
11984
|
+
var compositionsRef = React34.createRef();
|
|
11854
11985
|
|
|
11855
11986
|
// src/CompositionManagerProvider.tsx
|
|
11856
11987
|
import {
|
|
11857
|
-
useCallback as
|
|
11988
|
+
useCallback as useCallback23,
|
|
11989
|
+
useEffect as useEffect18,
|
|
11858
11990
|
useImperativeHandle as useImperativeHandle8,
|
|
11859
|
-
|
|
11991
|
+
useLayoutEffect as useLayoutEffect15,
|
|
11992
|
+
useMemo as useMemo32,
|
|
11860
11993
|
useRef as useRef27,
|
|
11861
|
-
useState as
|
|
11994
|
+
useState as useState20
|
|
11862
11995
|
} from "react";
|
|
11863
11996
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
11997
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? useEffect18 : useLayoutEffect15;
|
|
11864
11998
|
var CompositionManagerProvider = ({
|
|
11865
11999
|
children,
|
|
11866
12000
|
onlyRenderComposition,
|
|
@@ -11868,55 +12002,157 @@ var CompositionManagerProvider = ({
|
|
|
11868
12002
|
initialCompositions,
|
|
11869
12003
|
initialCanvasContent
|
|
11870
12004
|
}) => {
|
|
11871
|
-
const
|
|
11872
|
-
const [
|
|
11873
|
-
const
|
|
11874
|
-
const
|
|
12005
|
+
const { isStudio } = useRemotionEnvironment();
|
|
12006
|
+
const [compositionManagerId] = useState20(() => String(Math.random()));
|
|
12007
|
+
const committedOrderRef = useRef27(null);
|
|
12008
|
+
const committedOrderIdsRef = useRef27(null);
|
|
12009
|
+
const internalOrderRef = useRef27(new Map(initialCompositions.map((composition, index) => [
|
|
12010
|
+
getCompositionAndFolderOrderKey({
|
|
12011
|
+
type: "composition",
|
|
12012
|
+
id: composition.id
|
|
12013
|
+
}),
|
|
12014
|
+
index
|
|
12015
|
+
])));
|
|
12016
|
+
const nextInternalOrderRef = useRef27(initialCompositions.length);
|
|
12017
|
+
const [folders, setFolders] = useState20([]);
|
|
12018
|
+
const [canvasContent, setCanvasContent] = useState20(initialCanvasContent);
|
|
12019
|
+
const [currentAssetMetadata, setCurrentAssetMetadata] = useState20(null);
|
|
12020
|
+
const [compositions, setCompositions] = useState20(() => initialCompositions.map((composition, order) => ({ ...composition, order })));
|
|
11875
12021
|
const currentcompositionsRef = useRef27(compositions);
|
|
11876
|
-
const updateCompositions =
|
|
12022
|
+
const updateCompositions = useCallback23((updateComps) => {
|
|
11877
12023
|
setCompositions((comps) => {
|
|
11878
12024
|
const updated = updateComps(comps);
|
|
11879
12025
|
currentcompositionsRef.current = updated;
|
|
11880
12026
|
return updated;
|
|
11881
12027
|
});
|
|
11882
12028
|
}, []);
|
|
11883
|
-
const registerComposition =
|
|
12029
|
+
const registerComposition = useCallback23((comp) => {
|
|
12030
|
+
const orderKey = getCompositionAndFolderOrderKey({
|
|
12031
|
+
type: "composition",
|
|
12032
|
+
id: comp.id
|
|
12033
|
+
});
|
|
12034
|
+
const internalOrder = nextInternalOrderRef.current++;
|
|
12035
|
+
internalOrderRef.current.set(orderKey, internalOrder);
|
|
11884
12036
|
updateCompositions((comps) => {
|
|
11885
12037
|
if (comps.find((c2) => c2.id === comp.id)) {
|
|
11886
12038
|
throw new Error(`Multiple composition with id ${comp.id} are registered.`);
|
|
11887
12039
|
}
|
|
11888
|
-
return [
|
|
12040
|
+
return [
|
|
12041
|
+
...comps,
|
|
12042
|
+
{
|
|
12043
|
+
...comp,
|
|
12044
|
+
order: committedOrderRef.current?.get(orderKey) ?? internalOrder
|
|
12045
|
+
}
|
|
12046
|
+
];
|
|
11889
12047
|
});
|
|
11890
12048
|
}, [updateCompositions]);
|
|
11891
|
-
const unregisterComposition =
|
|
12049
|
+
const unregisterComposition = useCallback23((id) => {
|
|
12050
|
+
internalOrderRef.current.delete(getCompositionAndFolderOrderKey({ type: "composition", id }));
|
|
11892
12051
|
setCompositions((comps) => {
|
|
11893
12052
|
return comps.filter((c2) => c2.id !== id);
|
|
11894
12053
|
});
|
|
11895
12054
|
}, []);
|
|
11896
|
-
const registerFolder =
|
|
12055
|
+
const registerFolder = useCallback23((name, parent, stack) => {
|
|
12056
|
+
const orderKey = getCompositionAndFolderOrderKey({
|
|
12057
|
+
type: "folder",
|
|
12058
|
+
id: getFolderOrderId({ name, parent })
|
|
12059
|
+
});
|
|
12060
|
+
const internalOrder = nextInternalOrderRef.current++;
|
|
12061
|
+
internalOrderRef.current.set(orderKey, internalOrder);
|
|
11897
12062
|
setFolders((prevFolders) => {
|
|
11898
12063
|
return [
|
|
11899
12064
|
...prevFolders,
|
|
11900
12065
|
{
|
|
11901
12066
|
name,
|
|
11902
12067
|
parent,
|
|
11903
|
-
|
|
12068
|
+
order: committedOrderRef.current?.get(orderKey) ?? internalOrder,
|
|
11904
12069
|
stack
|
|
11905
12070
|
}
|
|
11906
12071
|
];
|
|
11907
12072
|
});
|
|
11908
12073
|
}, []);
|
|
11909
|
-
const unregisterFolder =
|
|
12074
|
+
const unregisterFolder = useCallback23((name, parent) => {
|
|
12075
|
+
internalOrderRef.current.delete(getCompositionAndFolderOrderKey({
|
|
12076
|
+
type: "folder",
|
|
12077
|
+
id: getFolderOrderId({ name, parent })
|
|
12078
|
+
}));
|
|
11910
12079
|
setFolders((prevFolders) => {
|
|
11911
12080
|
return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
|
|
11912
12081
|
});
|
|
11913
12082
|
}, []);
|
|
12083
|
+
useIsomorphicLayoutEffect2(() => {
|
|
12084
|
+
if (!isStudio) {
|
|
12085
|
+
return;
|
|
12086
|
+
}
|
|
12087
|
+
let unmounted = false;
|
|
12088
|
+
const onCommitOrder = (event) => {
|
|
12089
|
+
const { detail } = event;
|
|
12090
|
+
const managerOrder = detail.compositionManagers.find((item) => item.managerId === compositionManagerId);
|
|
12091
|
+
if (!managerOrder) {
|
|
12092
|
+
return;
|
|
12093
|
+
}
|
|
12094
|
+
const orderIds = managerOrder.compositionAndFolderOrder.map(getCompositionAndFolderOrderKey);
|
|
12095
|
+
const previousOrder = committedOrderIdsRef.current;
|
|
12096
|
+
if (previousOrder !== null && previousOrder.length === orderIds.length && previousOrder.every((id, index) => id === orderIds[index])) {
|
|
12097
|
+
return;
|
|
12098
|
+
}
|
|
12099
|
+
const order = new Map(orderIds.map((id, index) => [id, index]));
|
|
12100
|
+
committedOrderIdsRef.current = orderIds;
|
|
12101
|
+
committedOrderRef.current = order;
|
|
12102
|
+
queueMicrotask(() => {
|
|
12103
|
+
if (unmounted) {
|
|
12104
|
+
return;
|
|
12105
|
+
}
|
|
12106
|
+
updateCompositions((currentCompositions) => {
|
|
12107
|
+
let changed = false;
|
|
12108
|
+
const nextCompositions = currentCompositions.map((composition) => {
|
|
12109
|
+
const nextOrder = order.get(getCompositionAndFolderOrderKey({
|
|
12110
|
+
type: "composition",
|
|
12111
|
+
id: composition.id
|
|
12112
|
+
})) ?? internalOrderRef.current.get(getCompositionAndFolderOrderKey({
|
|
12113
|
+
type: "composition",
|
|
12114
|
+
id: composition.id
|
|
12115
|
+
})) ?? composition.order;
|
|
12116
|
+
if (nextOrder === composition.order) {
|
|
12117
|
+
return composition;
|
|
12118
|
+
}
|
|
12119
|
+
changed = true;
|
|
12120
|
+
return { ...composition, order: nextOrder };
|
|
12121
|
+
});
|
|
12122
|
+
return changed ? nextCompositions : currentCompositions;
|
|
12123
|
+
});
|
|
12124
|
+
setFolders((currentFolders) => {
|
|
12125
|
+
let changed = false;
|
|
12126
|
+
const nextFolders = currentFolders.map((folder) => {
|
|
12127
|
+
const nextOrder = order.get(getCompositionAndFolderOrderKey({
|
|
12128
|
+
type: "folder",
|
|
12129
|
+
id: getFolderOrderId(folder)
|
|
12130
|
+
})) ?? internalOrderRef.current.get(getCompositionAndFolderOrderKey({
|
|
12131
|
+
type: "folder",
|
|
12132
|
+
id: getFolderOrderId(folder)
|
|
12133
|
+
})) ?? folder.order;
|
|
12134
|
+
if (nextOrder === folder.order) {
|
|
12135
|
+
return folder;
|
|
12136
|
+
}
|
|
12137
|
+
changed = true;
|
|
12138
|
+
return { ...folder, order: nextOrder };
|
|
12139
|
+
});
|
|
12140
|
+
return changed ? nextFolders : currentFolders;
|
|
12141
|
+
});
|
|
12142
|
+
});
|
|
12143
|
+
};
|
|
12144
|
+
window.addEventListener(COMMIT_ORDER_EVENT, onCommitOrder);
|
|
12145
|
+
return () => {
|
|
12146
|
+
unmounted = true;
|
|
12147
|
+
window.removeEventListener(COMMIT_ORDER_EVENT, onCommitOrder);
|
|
12148
|
+
};
|
|
12149
|
+
}, [compositionManagerId, isStudio, updateCompositions]);
|
|
11914
12150
|
useImperativeHandle8(compositionsRef, () => {
|
|
11915
12151
|
return {
|
|
11916
12152
|
getCompositions: () => currentcompositionsRef.current
|
|
11917
12153
|
};
|
|
11918
12154
|
}, []);
|
|
11919
|
-
const compositionManagerSetters =
|
|
12155
|
+
const compositionManagerSetters = useMemo32(() => {
|
|
11920
12156
|
return {
|
|
11921
12157
|
registerComposition,
|
|
11922
12158
|
unregisterComposition,
|
|
@@ -11933,7 +12169,7 @@ var CompositionManagerProvider = ({
|
|
|
11933
12169
|
unregisterFolder,
|
|
11934
12170
|
onlyRenderComposition
|
|
11935
12171
|
]);
|
|
11936
|
-
const compositionManagerContextValue =
|
|
12172
|
+
const compositionManagerContextValue = useMemo32(() => {
|
|
11937
12173
|
return {
|
|
11938
12174
|
compositions,
|
|
11939
12175
|
folders,
|
|
@@ -11948,13 +12184,17 @@ var CompositionManagerProvider = ({
|
|
|
11948
12184
|
currentAssetMetadata,
|
|
11949
12185
|
canvasContent
|
|
11950
12186
|
]);
|
|
11951
|
-
|
|
12187
|
+
const providers = /* @__PURE__ */ jsx31(CompositionManager.Provider, {
|
|
11952
12188
|
value: compositionManagerContextValue,
|
|
11953
12189
|
children: /* @__PURE__ */ jsx31(CompositionSetters.Provider, {
|
|
11954
12190
|
value: compositionManagerSetters,
|
|
11955
12191
|
children
|
|
11956
12192
|
})
|
|
11957
12193
|
});
|
|
12194
|
+
return isStudio ? /* @__PURE__ */ jsx31(CompositionManagerOrderMarker, {
|
|
12195
|
+
managerId: compositionManagerId,
|
|
12196
|
+
children: providers
|
|
12197
|
+
}) : providers;
|
|
11958
12198
|
};
|
|
11959
12199
|
|
|
11960
12200
|
// src/default-css.ts
|
|
@@ -12024,8 +12264,8 @@ var getPreviewDomElement = () => {
|
|
|
12024
12264
|
};
|
|
12025
12265
|
|
|
12026
12266
|
// src/max-video-cache-size.ts
|
|
12027
|
-
import
|
|
12028
|
-
var MaxMediaCacheSizeContext =
|
|
12267
|
+
import React35 from "react";
|
|
12268
|
+
var MaxMediaCacheSizeContext = React35.createContext(null);
|
|
12029
12269
|
|
|
12030
12270
|
// src/media-resource-manager.ts
|
|
12031
12271
|
var disposeResource = (resource) => {
|
|
@@ -12174,14 +12414,14 @@ var waitForRoot = (fn) => {
|
|
|
12174
12414
|
};
|
|
12175
12415
|
|
|
12176
12416
|
// src/RemotionRoot.tsx
|
|
12177
|
-
import { useMemo as
|
|
12417
|
+
import { useMemo as useMemo34 } from "react";
|
|
12178
12418
|
|
|
12179
12419
|
// src/use-media-enabled.tsx
|
|
12180
|
-
import { createContext as
|
|
12420
|
+
import { createContext as createContext25, useContext as useContext37, useMemo as useMemo33 } from "react";
|
|
12181
12421
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
12182
|
-
var MediaEnabledContext =
|
|
12422
|
+
var MediaEnabledContext = createContext25(null);
|
|
12183
12423
|
var useVideoEnabled = () => {
|
|
12184
|
-
const context =
|
|
12424
|
+
const context = useContext37(MediaEnabledContext);
|
|
12185
12425
|
if (!context) {
|
|
12186
12426
|
return window.remotion_videoEnabled;
|
|
12187
12427
|
}
|
|
@@ -12191,7 +12431,7 @@ var useVideoEnabled = () => {
|
|
|
12191
12431
|
return context.videoEnabled;
|
|
12192
12432
|
};
|
|
12193
12433
|
var useAudioEnabled = () => {
|
|
12194
|
-
const context =
|
|
12434
|
+
const context = useContext37(MediaEnabledContext);
|
|
12195
12435
|
if (!context) {
|
|
12196
12436
|
return window.remotion_audioEnabled;
|
|
12197
12437
|
}
|
|
@@ -12205,7 +12445,7 @@ var MediaEnabledProvider = ({
|
|
|
12205
12445
|
videoEnabled,
|
|
12206
12446
|
audioEnabled
|
|
12207
12447
|
}) => {
|
|
12208
|
-
const value =
|
|
12448
|
+
const value = useMemo33(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
|
|
12209
12449
|
return /* @__PURE__ */ jsx32(MediaEnabledContext.Provider, {
|
|
12210
12450
|
value,
|
|
12211
12451
|
children
|
|
@@ -12225,38 +12465,29 @@ var RemotionRootContexts = ({
|
|
|
12225
12465
|
frameState,
|
|
12226
12466
|
_experimentalKeepAudioContextAlive
|
|
12227
12467
|
}) => {
|
|
12228
|
-
const
|
|
12229
|
-
let counter = 0;
|
|
12230
|
-
return {
|
|
12231
|
-
getNonce: () => counter++
|
|
12232
|
-
};
|
|
12233
|
-
}, []);
|
|
12234
|
-
const logging = useMemo36(() => {
|
|
12468
|
+
const logging = useMemo34(() => {
|
|
12235
12469
|
return { logLevel, mountTime: Date.now() };
|
|
12236
12470
|
}, [logLevel]);
|
|
12237
12471
|
return /* @__PURE__ */ jsx33(LogLevelContext.Provider, {
|
|
12238
12472
|
value: logging,
|
|
12239
|
-
children: /* @__PURE__ */ jsx33(
|
|
12240
|
-
|
|
12241
|
-
children: /* @__PURE__ */ jsx33(
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
children
|
|
12257
|
-
numberOfAudioTags,
|
|
12258
|
-
children
|
|
12259
|
-
})
|
|
12473
|
+
children: /* @__PURE__ */ jsx33(TimelineContextProvider, {
|
|
12474
|
+
frameState,
|
|
12475
|
+
children: /* @__PURE__ */ jsx33(MediaEnabledProvider, {
|
|
12476
|
+
videoEnabled,
|
|
12477
|
+
audioEnabled,
|
|
12478
|
+
children: /* @__PURE__ */ jsx33(EditorPropsProvider, {
|
|
12479
|
+
children: /* @__PURE__ */ jsx33(PrefetchProvider, {
|
|
12480
|
+
children: /* @__PURE__ */ jsx33(SequenceManagerProvider, {
|
|
12481
|
+
children: /* @__PURE__ */ jsx33(DurationsContextProvider, {
|
|
12482
|
+
children: /* @__PURE__ */ jsx33(BufferingProvider, {
|
|
12483
|
+
children: /* @__PURE__ */ jsx33(SharedAudioContextProvider, {
|
|
12484
|
+
audioLatencyHint,
|
|
12485
|
+
audioEnabled,
|
|
12486
|
+
previewSampleRate,
|
|
12487
|
+
_experimentalKeepAudioContextAlive,
|
|
12488
|
+
children: /* @__PURE__ */ jsx33(SharedAudioTagsContextProvider, {
|
|
12489
|
+
numberOfAudioTags,
|
|
12490
|
+
children
|
|
12260
12491
|
})
|
|
12261
12492
|
})
|
|
12262
12493
|
})
|
|
@@ -12270,7 +12501,7 @@ var RemotionRootContexts = ({
|
|
|
12270
12501
|
};
|
|
12271
12502
|
|
|
12272
12503
|
// src/render-resource-manager.ts
|
|
12273
|
-
import
|
|
12504
|
+
import React37 from "react";
|
|
12274
12505
|
var makeRenderResourceManager = () => {
|
|
12275
12506
|
const resources = new Map;
|
|
12276
12507
|
let disposed = false;
|
|
@@ -12311,7 +12542,7 @@ var makeRenderResourceManager = () => {
|
|
|
12311
12542
|
}
|
|
12312
12543
|
};
|
|
12313
12544
|
};
|
|
12314
|
-
var RenderResourceManagerContext =
|
|
12545
|
+
var RenderResourceManagerContext = React37.createContext(null);
|
|
12315
12546
|
|
|
12316
12547
|
// src/codec.ts
|
|
12317
12548
|
var validCodecs = [
|
|
@@ -12502,8 +12733,8 @@ var resolveVideoConfigOrCatch = (params) => {
|
|
|
12502
12733
|
};
|
|
12503
12734
|
|
|
12504
12735
|
// src/sequence-stack-traces.ts
|
|
12505
|
-
import
|
|
12506
|
-
var SequenceStackTracesUpdateContext =
|
|
12736
|
+
import React38 from "react";
|
|
12737
|
+
var SequenceStackTracesUpdateContext = React38.createContext(() => {});
|
|
12507
12738
|
|
|
12508
12739
|
// src/setup-env-variables.ts
|
|
12509
12740
|
var getEnvVariables = () => {
|
|
@@ -12533,8 +12764,8 @@ var setupEnvVariables = () => {
|
|
|
12533
12764
|
};
|
|
12534
12765
|
|
|
12535
12766
|
// src/use-pixel-density.ts
|
|
12536
|
-
import
|
|
12537
|
-
var PixelDensityContext =
|
|
12767
|
+
import React39, { useContext as useContext38 } from "react";
|
|
12768
|
+
var PixelDensityContext = React39.createContext(null);
|
|
12538
12769
|
var getBrowserPixelDensity = () => {
|
|
12539
12770
|
if (typeof window === "undefined") {
|
|
12540
12771
|
return 1;
|
|
@@ -12542,8 +12773,8 @@ var getBrowserPixelDensity = () => {
|
|
|
12542
12773
|
return window.devicePixelRatio || 1;
|
|
12543
12774
|
};
|
|
12544
12775
|
var usePixelDensity = (options) => {
|
|
12545
|
-
const pixelDensity =
|
|
12546
|
-
const canUseRemotionHooks =
|
|
12776
|
+
const pixelDensity = useContext38(PixelDensityContext);
|
|
12777
|
+
const canUseRemotionHooks = useContext38(CanUseRemotionHooks);
|
|
12547
12778
|
if (pixelDensity !== null) {
|
|
12548
12779
|
return pixelDensity;
|
|
12549
12780
|
}
|
|
@@ -12560,16 +12791,16 @@ var usePixelDensity = (options) => {
|
|
|
12560
12791
|
};
|
|
12561
12792
|
|
|
12562
12793
|
// src/video/OffthreadVideo.tsx
|
|
12563
|
-
import { useCallback as
|
|
12794
|
+
import { useCallback as useCallback26 } from "react";
|
|
12564
12795
|
|
|
12565
12796
|
// src/video/OffthreadVideoForRendering.tsx
|
|
12566
12797
|
import {
|
|
12567
|
-
useCallback as
|
|
12568
|
-
useContext as
|
|
12569
|
-
useEffect as
|
|
12570
|
-
useLayoutEffect as
|
|
12571
|
-
useMemo as
|
|
12572
|
-
useState as
|
|
12798
|
+
useCallback as useCallback24,
|
|
12799
|
+
useContext as useContext39,
|
|
12800
|
+
useEffect as useEffect19,
|
|
12801
|
+
useLayoutEffect as useLayoutEffect16,
|
|
12802
|
+
useMemo as useMemo35,
|
|
12803
|
+
useState as useState21
|
|
12573
12804
|
} from "react";
|
|
12574
12805
|
|
|
12575
12806
|
// src/video/offthread-video-source.ts
|
|
@@ -12608,13 +12839,13 @@ var OffthreadVideoForRendering = ({
|
|
|
12608
12839
|
const frame = useCurrentFrame();
|
|
12609
12840
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior);
|
|
12610
12841
|
const videoConfig = useUnsafeVideoConfig();
|
|
12611
|
-
const sequenceContext =
|
|
12842
|
+
const sequenceContext = useContext39(SequenceContext);
|
|
12612
12843
|
const mediaStartsAt = useMediaStartsAt();
|
|
12613
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
12844
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext39(RenderAssetManager);
|
|
12614
12845
|
if (!src) {
|
|
12615
12846
|
throw new TypeError("No `src` was passed to <OffthreadVideo>.");
|
|
12616
12847
|
}
|
|
12617
|
-
const id =
|
|
12848
|
+
const id = useMemo35(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
12618
12849
|
src,
|
|
12619
12850
|
sequenceContext?.cumulatedFrom,
|
|
12620
12851
|
sequenceContext?.relativeFrom,
|
|
@@ -12629,7 +12860,7 @@ var OffthreadVideoForRendering = ({
|
|
|
12629
12860
|
mediaVolume: 1
|
|
12630
12861
|
});
|
|
12631
12862
|
warnAboutTooHighVolume(volume);
|
|
12632
|
-
|
|
12863
|
+
useEffect19(() => {
|
|
12633
12864
|
if (!src) {
|
|
12634
12865
|
throw new Error("No src passed");
|
|
12635
12866
|
}
|
|
@@ -12669,14 +12900,14 @@ var OffthreadVideoForRendering = ({
|
|
|
12669
12900
|
sequenceContext?.cumulatedNegativeFrom,
|
|
12670
12901
|
audioStreamIndex
|
|
12671
12902
|
]);
|
|
12672
|
-
const currentTime =
|
|
12903
|
+
const currentTime = useMemo35(() => {
|
|
12673
12904
|
return getExpectedMediaFrameUncorrected({
|
|
12674
12905
|
frame,
|
|
12675
12906
|
playbackRate: playbackRate || 1,
|
|
12676
12907
|
startFrom: -mediaStartsAt
|
|
12677
12908
|
}) / videoConfig.fps;
|
|
12678
12909
|
}, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
|
|
12679
|
-
const actualSrc =
|
|
12910
|
+
const actualSrc = useMemo35(() => {
|
|
12680
12911
|
return getOffthreadVideoSource({
|
|
12681
12912
|
src,
|
|
12682
12913
|
currentTime,
|
|
@@ -12684,9 +12915,9 @@ var OffthreadVideoForRendering = ({
|
|
|
12684
12915
|
toneMapped
|
|
12685
12916
|
});
|
|
12686
12917
|
}, [toneMapped, currentTime, src, transparent]);
|
|
12687
|
-
const [imageSrc, setImageSrc] =
|
|
12918
|
+
const [imageSrc, setImageSrc] = useState21(null);
|
|
12688
12919
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
12689
|
-
|
|
12920
|
+
useLayoutEffect16(() => {
|
|
12690
12921
|
if (!window.remotion_videoEnabled) {
|
|
12691
12922
|
return;
|
|
12692
12923
|
}
|
|
@@ -12757,17 +12988,17 @@ var OffthreadVideoForRendering = ({
|
|
|
12757
12988
|
continueRender2,
|
|
12758
12989
|
delayRender2
|
|
12759
12990
|
]);
|
|
12760
|
-
const onErr =
|
|
12991
|
+
const onErr = useCallback24(() => {
|
|
12761
12992
|
if (onError) {
|
|
12762
12993
|
onError?.(new Error("Failed to load image with src " + imageSrc));
|
|
12763
12994
|
} else {
|
|
12764
12995
|
cancelRender("Failed to load image with src " + imageSrc);
|
|
12765
12996
|
}
|
|
12766
12997
|
}, [imageSrc, onError]);
|
|
12767
|
-
const className =
|
|
12998
|
+
const className = useMemo35(() => {
|
|
12768
12999
|
return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
|
|
12769
13000
|
}, [props2.className]);
|
|
12770
|
-
const onImageFrame =
|
|
13001
|
+
const onImageFrame = useCallback24((img) => {
|
|
12771
13002
|
if (onVideoFrame) {
|
|
12772
13003
|
onVideoFrame(img);
|
|
12773
13004
|
}
|
|
@@ -12788,24 +13019,24 @@ var OffthreadVideoForRendering = ({
|
|
|
12788
13019
|
};
|
|
12789
13020
|
|
|
12790
13021
|
// src/video/VideoForPreview.tsx
|
|
12791
|
-
import
|
|
13022
|
+
import React41, {
|
|
12792
13023
|
forwardRef as forwardRef13,
|
|
12793
|
-
useCallback as
|
|
12794
|
-
useContext as
|
|
12795
|
-
useEffect as
|
|
13024
|
+
useCallback as useCallback25,
|
|
13025
|
+
useContext as useContext40,
|
|
13026
|
+
useEffect as useEffect21,
|
|
12796
13027
|
useImperativeHandle as useImperativeHandle9,
|
|
12797
|
-
useMemo as
|
|
13028
|
+
useMemo as useMemo36,
|
|
12798
13029
|
useRef as useRef28,
|
|
12799
|
-
useState as
|
|
13030
|
+
useState as useState22
|
|
12800
13031
|
} from "react";
|
|
12801
13032
|
|
|
12802
13033
|
// src/video/emit-video-frame.ts
|
|
12803
|
-
import { useEffect as
|
|
13034
|
+
import { useEffect as useEffect20 } from "react";
|
|
12804
13035
|
var useEmitVideoFrame = ({
|
|
12805
13036
|
ref,
|
|
12806
13037
|
onVideoFrame
|
|
12807
13038
|
}) => {
|
|
12808
|
-
|
|
13039
|
+
useEffect20(() => {
|
|
12809
13040
|
const { current } = ref;
|
|
12810
13041
|
if (!current) {
|
|
12811
13042
|
return;
|
|
@@ -12847,12 +13078,12 @@ class MediaPlaybackError extends Error {
|
|
|
12847
13078
|
// src/video/VideoForPreview.tsx
|
|
12848
13079
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
12849
13080
|
var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
12850
|
-
const context =
|
|
13081
|
+
const context = useContext40(SharedAudioContext);
|
|
12851
13082
|
if (!context) {
|
|
12852
13083
|
throw new Error("SharedAudioContext not found");
|
|
12853
13084
|
}
|
|
12854
13085
|
const videoRef = useRef28(null);
|
|
12855
|
-
const sharedSource =
|
|
13086
|
+
const sharedSource = useMemo36(() => {
|
|
12856
13087
|
if (!context.audioContext) {
|
|
12857
13088
|
return null;
|
|
12858
13089
|
}
|
|
@@ -12861,7 +13092,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
12861
13092
|
ref: videoRef
|
|
12862
13093
|
});
|
|
12863
13094
|
}, [context.audioContext]);
|
|
12864
|
-
const effectToUse =
|
|
13095
|
+
const effectToUse = React41.useInsertionEffect ?? React41.useLayoutEffect;
|
|
12865
13096
|
effectToUse(() => {
|
|
12866
13097
|
return () => {
|
|
12867
13098
|
requestAnimationFrame(() => {
|
|
@@ -12904,10 +13135,11 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
12904
13135
|
}
|
|
12905
13136
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
12906
13137
|
const { fps, durationInFrames } = useVideoConfig();
|
|
12907
|
-
const parentSequence =
|
|
13138
|
+
const parentSequence = useContext40(SequenceContext);
|
|
13139
|
+
const { isStudio } = useRemotionEnvironment();
|
|
12908
13140
|
const logLevel = useLogLevel();
|
|
12909
13141
|
const mountTime = useMountTime();
|
|
12910
|
-
const [timelineId] =
|
|
13142
|
+
const [timelineId] = useState22(() => String(Math.random()));
|
|
12911
13143
|
if (typeof acceptableTimeShift !== "undefined") {
|
|
12912
13144
|
throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
|
|
12913
13145
|
}
|
|
@@ -12919,7 +13151,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
12919
13151
|
mediaVolume
|
|
12920
13152
|
});
|
|
12921
13153
|
warnAboutTooHighVolume(userPreferredVolume);
|
|
12922
|
-
const getStack =
|
|
13154
|
+
const getStack = useCallback25(() => {
|
|
12923
13155
|
return _remotionInternalStack ?? null;
|
|
12924
13156
|
}, [_remotionInternalStack]);
|
|
12925
13157
|
useMediaInTimeline({
|
|
@@ -12979,13 +13211,13 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
12979
13211
|
useImperativeHandle9(ref, () => {
|
|
12980
13212
|
return videoRef.current;
|
|
12981
13213
|
}, []);
|
|
12982
|
-
|
|
13214
|
+
useState22(() => playbackLogging({
|
|
12983
13215
|
logLevel,
|
|
12984
13216
|
message: `Mounting video with source = ${actualSrc}, v=${VERSION}, user agent=${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
|
|
12985
13217
|
tag: "video",
|
|
12986
13218
|
mountTime
|
|
12987
13219
|
}));
|
|
12988
|
-
|
|
13220
|
+
useEffect21(() => {
|
|
12989
13221
|
const { current } = videoRef;
|
|
12990
13222
|
if (!current) {
|
|
12991
13223
|
return;
|
|
@@ -13028,7 +13260,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
13028
13260
|
const currentOnDurationCallback = useRef28(onDuration);
|
|
13029
13261
|
currentOnDurationCallback.current = onDuration;
|
|
13030
13262
|
useEmitVideoFrame({ ref: videoRef, onVideoFrame });
|
|
13031
|
-
|
|
13263
|
+
useEffect21(() => {
|
|
13032
13264
|
const { current } = videoRef;
|
|
13033
13265
|
if (!current) {
|
|
13034
13266
|
return;
|
|
@@ -13045,7 +13277,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
13045
13277
|
current.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
13046
13278
|
};
|
|
13047
13279
|
}, [src]);
|
|
13048
|
-
|
|
13280
|
+
useEffect21(() => {
|
|
13049
13281
|
const { current } = videoRef;
|
|
13050
13282
|
if (!current) {
|
|
13051
13283
|
return;
|
|
@@ -13056,7 +13288,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
13056
13288
|
current.preload = "auto";
|
|
13057
13289
|
}
|
|
13058
13290
|
}, []);
|
|
13059
|
-
const actualStyle =
|
|
13291
|
+
const actualStyle = useMemo36(() => {
|
|
13060
13292
|
return {
|
|
13061
13293
|
...style
|
|
13062
13294
|
};
|
|
@@ -13066,7 +13298,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
13066
13298
|
requestsVideoFrame: Boolean(onVideoFrame),
|
|
13067
13299
|
isClientSideRendering: false
|
|
13068
13300
|
});
|
|
13069
|
-
|
|
13301
|
+
const video = /* @__PURE__ */ jsx35("video", {
|
|
13070
13302
|
...nativeProps,
|
|
13071
13303
|
ref: videoRef,
|
|
13072
13304
|
muted: muted || playerMuted || userPreferredVolume <= 0,
|
|
@@ -13078,6 +13310,10 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
13078
13310
|
crossOrigin: crossOriginValue,
|
|
13079
13311
|
controls: false
|
|
13080
13312
|
});
|
|
13313
|
+
return isStudio ? /* @__PURE__ */ jsx35(SequenceOrderMarker, {
|
|
13314
|
+
sequenceId: timelineId,
|
|
13315
|
+
children: video
|
|
13316
|
+
}) : video;
|
|
13081
13317
|
};
|
|
13082
13318
|
var VideoForPreview = forwardRef13(VideoForDevelopmentRefForwardingFunction);
|
|
13083
13319
|
|
|
@@ -13100,7 +13336,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
13100
13336
|
if (environment.isClientSideRendering) {
|
|
13101
13337
|
throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
|
|
13102
13338
|
}
|
|
13103
|
-
const onDuration =
|
|
13339
|
+
const onDuration = useCallback26(() => {
|
|
13104
13340
|
return;
|
|
13105
13341
|
}, []);
|
|
13106
13342
|
if (typeof props2.src !== "string") {
|
|
@@ -13279,31 +13515,27 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
13279
13515
|
};
|
|
13280
13516
|
|
|
13281
13517
|
// src/wrap-remotion-context.tsx
|
|
13282
|
-
import
|
|
13518
|
+
import React43, { useMemo as useMemo37 } from "react";
|
|
13283
13519
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
13284
13520
|
function useRemotionContexts() {
|
|
13285
|
-
const compositionManagerCtx =
|
|
13286
|
-
const timelineContext =
|
|
13287
|
-
const
|
|
13288
|
-
const
|
|
13289
|
-
const
|
|
13290
|
-
const
|
|
13291
|
-
const
|
|
13292
|
-
const
|
|
13293
|
-
const
|
|
13294
|
-
const
|
|
13295
|
-
const
|
|
13296
|
-
const
|
|
13297
|
-
const
|
|
13298
|
-
|
|
13299
|
-
const logLevelContext = React42.useContext(LogLevelContext);
|
|
13300
|
-
return useMemo39(() => ({
|
|
13521
|
+
const compositionManagerCtx = React43.useContext(CompositionManager);
|
|
13522
|
+
const timelineContext = React43.useContext(TimelineContext);
|
|
13523
|
+
const setTimelineContext = React43.useContext(SetTimelineContext);
|
|
13524
|
+
const sequenceContext = React43.useContext(SequenceContext);
|
|
13525
|
+
const canUseRemotionHooksContext = React43.useContext(CanUseRemotionHooks);
|
|
13526
|
+
const preloadContext = React43.useContext(PreloadContext);
|
|
13527
|
+
const resolveCompositionContext = React43.useContext(ResolveCompositionContext);
|
|
13528
|
+
const renderAssetManagerContext = React43.useContext(RenderAssetManager);
|
|
13529
|
+
const sequenceManagerContext = React43.useContext(SequenceManager);
|
|
13530
|
+
const sequenceManagerRefContext = React43.useContext(SequenceManagerRefContext);
|
|
13531
|
+
const visualModePropStatusesRefContext = React43.useContext(VisualModePropStatusesRefContext);
|
|
13532
|
+
const bufferManagerContext = React43.useContext(BufferingContextReact);
|
|
13533
|
+
const logLevelContext = React43.useContext(LogLevelContext);
|
|
13534
|
+
return useMemo37(() => ({
|
|
13301
13535
|
compositionManagerCtx,
|
|
13302
13536
|
timelineContext,
|
|
13303
|
-
timelineImperativeContext,
|
|
13304
13537
|
setTimelineContext,
|
|
13305
13538
|
sequenceContext,
|
|
13306
|
-
nonceContext,
|
|
13307
13539
|
canUseRemotionHooksContext,
|
|
13308
13540
|
preloadContext,
|
|
13309
13541
|
resolveCompositionContext,
|
|
@@ -13315,11 +13547,9 @@ function useRemotionContexts() {
|
|
|
13315
13547
|
logLevelContext
|
|
13316
13548
|
}), [
|
|
13317
13549
|
compositionManagerCtx,
|
|
13318
|
-
nonceContext,
|
|
13319
13550
|
sequenceContext,
|
|
13320
13551
|
setTimelineContext,
|
|
13321
13552
|
timelineContext,
|
|
13322
|
-
timelineImperativeContext,
|
|
13323
13553
|
canUseRemotionHooksContext,
|
|
13324
13554
|
preloadContext,
|
|
13325
13555
|
resolveCompositionContext,
|
|
@@ -13337,35 +13567,29 @@ var RemotionContextProvider = (props2) => {
|
|
|
13337
13567
|
value: contexts.logLevelContext,
|
|
13338
13568
|
children: /* @__PURE__ */ jsx37(CanUseRemotionHooks.Provider, {
|
|
13339
13569
|
value: contexts.canUseRemotionHooksContext,
|
|
13340
|
-
children: /* @__PURE__ */ jsx37(
|
|
13341
|
-
value: contexts.
|
|
13342
|
-
children: /* @__PURE__ */ jsx37(
|
|
13343
|
-
value: contexts.
|
|
13344
|
-
children: /* @__PURE__ */ jsx37(
|
|
13345
|
-
value: contexts.
|
|
13346
|
-
children: /* @__PURE__ */ jsx37(
|
|
13347
|
-
value: contexts.
|
|
13348
|
-
children: /* @__PURE__ */ jsx37(
|
|
13349
|
-
value: contexts.
|
|
13350
|
-
children: /* @__PURE__ */ jsx37(
|
|
13351
|
-
value: contexts.
|
|
13352
|
-
children: /* @__PURE__ */ jsx37(
|
|
13353
|
-
value: contexts.
|
|
13354
|
-
children: /* @__PURE__ */ jsx37(
|
|
13355
|
-
value: contexts.
|
|
13356
|
-
children: /* @__PURE__ */ jsx37(
|
|
13357
|
-
value: contexts.
|
|
13358
|
-
children: /* @__PURE__ */ jsx37(
|
|
13359
|
-
value: contexts.
|
|
13360
|
-
children: /* @__PURE__ */ jsx37(
|
|
13361
|
-
value: contexts.
|
|
13362
|
-
children
|
|
13363
|
-
value: contexts.sequenceContext,
|
|
13364
|
-
children: /* @__PURE__ */ jsx37(BufferingContextReact.Provider, {
|
|
13365
|
-
value: contexts.bufferManagerContext,
|
|
13366
|
-
children
|
|
13367
|
-
})
|
|
13368
|
-
})
|
|
13570
|
+
children: /* @__PURE__ */ jsx37(PreloadContext.Provider, {
|
|
13571
|
+
value: contexts.preloadContext,
|
|
13572
|
+
children: /* @__PURE__ */ jsx37(CompositionManager.Provider, {
|
|
13573
|
+
value: contexts.compositionManagerCtx,
|
|
13574
|
+
children: /* @__PURE__ */ jsx37(SequenceManagerRefContext.Provider, {
|
|
13575
|
+
value: contexts.sequenceManagerRefContext,
|
|
13576
|
+
children: /* @__PURE__ */ jsx37(SequenceManager.Provider, {
|
|
13577
|
+
value: contexts.sequenceManagerContext,
|
|
13578
|
+
children: /* @__PURE__ */ jsx37(VisualModePropStatusesRefContext.Provider, {
|
|
13579
|
+
value: contexts.visualModePropStatusesRefContext,
|
|
13580
|
+
children: /* @__PURE__ */ jsx37(RenderAssetManager.Provider, {
|
|
13581
|
+
value: contexts.renderAssetManagerContext,
|
|
13582
|
+
children: /* @__PURE__ */ jsx37(ResolveCompositionContext.Provider, {
|
|
13583
|
+
value: contexts.resolveCompositionContext,
|
|
13584
|
+
children: /* @__PURE__ */ jsx37(TimelineContext.Provider, {
|
|
13585
|
+
value: contexts.timelineContext,
|
|
13586
|
+
children: /* @__PURE__ */ jsx37(SetTimelineContext.Provider, {
|
|
13587
|
+
value: contexts.setTimelineContext,
|
|
13588
|
+
children: /* @__PURE__ */ jsx37(SequenceContext.Provider, {
|
|
13589
|
+
value: contexts.sequenceContext,
|
|
13590
|
+
children: /* @__PURE__ */ jsx37(BufferingContextReact.Provider, {
|
|
13591
|
+
value: contexts.bufferManagerContext,
|
|
13592
|
+
children
|
|
13369
13593
|
})
|
|
13370
13594
|
})
|
|
13371
13595
|
})
|
|
@@ -13392,6 +13616,7 @@ var Internals = {
|
|
|
13392
13616
|
MEDIABUNNY_DURATION_VALUE_KEY,
|
|
13393
13617
|
makeRenderResourceManager,
|
|
13394
13618
|
RenderResourceManagerContext,
|
|
13619
|
+
createRuntimeValueStore,
|
|
13395
13620
|
useUnsafeVideoConfig,
|
|
13396
13621
|
useFrameForVolumeProp,
|
|
13397
13622
|
useTimelinePosition,
|
|
@@ -13415,6 +13640,7 @@ var Internals = {
|
|
|
13415
13640
|
SequenceManagerProvider,
|
|
13416
13641
|
SequenceManagerRefContext,
|
|
13417
13642
|
SequenceRegistrationContext,
|
|
13643
|
+
CommitOrderInternals,
|
|
13418
13644
|
SequenceStackTracesUpdateContext,
|
|
13419
13645
|
baseSchema,
|
|
13420
13646
|
sequenceSchema,
|
|
@@ -13472,7 +13698,6 @@ var Internals = {
|
|
|
13472
13698
|
EditorPropsProvider,
|
|
13473
13699
|
EditorPropsContext,
|
|
13474
13700
|
usePreload,
|
|
13475
|
-
NonceContext,
|
|
13476
13701
|
resolveVideoConfig,
|
|
13477
13702
|
resolveVideoConfigOrCatch,
|
|
13478
13703
|
resolveVideoConfigWithMetadataOrCatch,
|
|
@@ -13518,11 +13743,11 @@ var Internals = {
|
|
|
13518
13743
|
setInputPropsOverride,
|
|
13519
13744
|
useVideoEnabled,
|
|
13520
13745
|
useAudioEnabled,
|
|
13521
|
-
|
|
13746
|
+
useBuffering,
|
|
13522
13747
|
TimelinePosition: exports_timeline_position_state,
|
|
13523
13748
|
DelayRenderContextType,
|
|
13524
13749
|
TimelineContext,
|
|
13525
|
-
|
|
13750
|
+
usePlaying,
|
|
13526
13751
|
PlaybackRateContext,
|
|
13527
13752
|
AbsoluteTimeContext,
|
|
13528
13753
|
RenderAssetManagerProvider,
|
|
@@ -13556,18 +13781,19 @@ var Internals = {
|
|
|
13556
13781
|
resolveSequenceCrop,
|
|
13557
13782
|
useCropStyle
|
|
13558
13783
|
};
|
|
13784
|
+
Object.assign(Internals, { useSyncExternalStore: useSyncExternalStore2 });
|
|
13559
13785
|
// src/series/index.tsx
|
|
13560
|
-
import
|
|
13786
|
+
import React45, {
|
|
13561
13787
|
forwardRef as forwardRef14,
|
|
13562
|
-
useMemo as
|
|
13788
|
+
useMemo as useMemo38
|
|
13563
13789
|
} from "react";
|
|
13564
13790
|
|
|
13565
13791
|
// src/series/flatten-children.tsx
|
|
13566
|
-
import
|
|
13792
|
+
import React44 from "react";
|
|
13567
13793
|
var flattenChildren = (children) => {
|
|
13568
|
-
const childrenArray =
|
|
13794
|
+
const childrenArray = React44.Children.toArray(children);
|
|
13569
13795
|
return childrenArray.reduce((flatChildren, child) => {
|
|
13570
|
-
if (child.type ===
|
|
13796
|
+
if (child.type === React44.Fragment) {
|
|
13571
13797
|
return flatChildren.concat(flattenChildren(child.props.children));
|
|
13572
13798
|
}
|
|
13573
13799
|
flatChildren.push(child);
|
|
@@ -13629,7 +13855,7 @@ var validateSeriesSequenceProps = ({
|
|
|
13629
13855
|
return offset;
|
|
13630
13856
|
};
|
|
13631
13857
|
var SeriesInner = (props2) => {
|
|
13632
|
-
const childrenValue =
|
|
13858
|
+
const childrenValue = useMemo38(() => {
|
|
13633
13859
|
const flattenedChildren = flattenChildren(props2.children);
|
|
13634
13860
|
const renderChildren = (i, startFrame) => {
|
|
13635
13861
|
if (i === flattenedChildren.length) {
|
|
@@ -13653,7 +13879,7 @@ var SeriesInner = (props2) => {
|
|
|
13653
13879
|
index: i,
|
|
13654
13880
|
childrenLength: flattenedChildren.length
|
|
13655
13881
|
});
|
|
13656
|
-
return
|
|
13882
|
+
return React45.cloneElement(castedElement, {
|
|
13657
13883
|
_remotionInternalRender: (resolvedProps, ref) => {
|
|
13658
13884
|
const durationInFramesProp = resolvedProps.durationInFrames;
|
|
13659
13885
|
const {
|
|
@@ -13812,27 +14038,27 @@ var staticFile = (path) => {
|
|
|
13812
14038
|
return preparsed;
|
|
13813
14039
|
};
|
|
13814
14040
|
// src/Still.tsx
|
|
13815
|
-
import
|
|
14041
|
+
import React46 from "react";
|
|
13816
14042
|
var Still = (props2) => {
|
|
13817
14043
|
const newProps = {
|
|
13818
14044
|
...props2,
|
|
13819
14045
|
durationInFrames: 1,
|
|
13820
14046
|
fps: 1
|
|
13821
14047
|
};
|
|
13822
|
-
return
|
|
14048
|
+
return React46.createElement(Composition, newProps);
|
|
13823
14049
|
};
|
|
13824
14050
|
addSequenceStackTraces(Still);
|
|
13825
14051
|
// src/video/html5-video.tsx
|
|
13826
|
-
import { forwardRef as forwardRef16, useCallback as
|
|
14052
|
+
import { forwardRef as forwardRef16, useCallback as useCallback27, useContext as useContext42 } from "react";
|
|
13827
14053
|
|
|
13828
14054
|
// src/video/VideoForRendering.tsx
|
|
13829
14055
|
import {
|
|
13830
14056
|
forwardRef as forwardRef15,
|
|
13831
|
-
useContext as
|
|
13832
|
-
useEffect as
|
|
14057
|
+
useContext as useContext41,
|
|
14058
|
+
useEffect as useEffect22,
|
|
13833
14059
|
useImperativeHandle as useImperativeHandle10,
|
|
13834
|
-
useLayoutEffect as
|
|
13835
|
-
useMemo as
|
|
14060
|
+
useLayoutEffect as useLayoutEffect17,
|
|
14061
|
+
useMemo as useMemo39,
|
|
13836
14062
|
useRef as useRef29
|
|
13837
14063
|
} from "react";
|
|
13838
14064
|
|
|
@@ -13984,14 +14210,14 @@ var VideoForRenderingForwardFunction = ({
|
|
|
13984
14210
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
13985
14211
|
const videoConfig = useUnsafeVideoConfig();
|
|
13986
14212
|
const videoRef = useRef29(null);
|
|
13987
|
-
const sequenceContext =
|
|
14213
|
+
const sequenceContext = useContext41(SequenceContext);
|
|
13988
14214
|
const mediaStartsAt = useMediaStartsAt();
|
|
13989
14215
|
const environment = useRemotionEnvironment();
|
|
13990
14216
|
const logLevel = useLogLevel();
|
|
13991
14217
|
const mountTime = useMountTime();
|
|
13992
14218
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
13993
|
-
const { registerRenderAsset, unregisterRenderAsset } =
|
|
13994
|
-
const id =
|
|
14219
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext41(RenderAssetManager);
|
|
14220
|
+
const id = useMemo39(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
13995
14221
|
props2.src,
|
|
13996
14222
|
sequenceContext?.cumulatedFrom,
|
|
13997
14223
|
sequenceContext?.relativeFrom,
|
|
@@ -14006,7 +14232,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
14006
14232
|
mediaVolume: 1
|
|
14007
14233
|
});
|
|
14008
14234
|
warnAboutTooHighVolume(volume);
|
|
14009
|
-
|
|
14235
|
+
useEffect22(() => {
|
|
14010
14236
|
if (!props2.src) {
|
|
14011
14237
|
throw new Error("No src passed");
|
|
14012
14238
|
}
|
|
@@ -14050,7 +14276,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
14050
14276
|
return videoRef.current;
|
|
14051
14277
|
}, []);
|
|
14052
14278
|
useEmitVideoFrame({ ref: videoRef, onVideoFrame });
|
|
14053
|
-
|
|
14279
|
+
useEffect22(() => {
|
|
14054
14280
|
if (!window.remotion_videoEnabled) {
|
|
14055
14281
|
return;
|
|
14056
14282
|
}
|
|
@@ -14140,7 +14366,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
14140
14366
|
]);
|
|
14141
14367
|
const { src } = props2;
|
|
14142
14368
|
if (environment.isRendering) {
|
|
14143
|
-
|
|
14369
|
+
useLayoutEffect17(() => {
|
|
14144
14370
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
14145
14371
|
return;
|
|
14146
14372
|
}
|
|
@@ -14206,7 +14432,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
14206
14432
|
if (environment.isClientSideRendering) {
|
|
14207
14433
|
throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
|
|
14208
14434
|
}
|
|
14209
|
-
const { durations, setDurations } =
|
|
14435
|
+
const { durations, setDurations } = useContext42(DurationsContext);
|
|
14210
14436
|
if (typeof ref === "string") {
|
|
14211
14437
|
throw new Error("string refs are not supported");
|
|
14212
14438
|
}
|
|
@@ -14214,7 +14440,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
14214
14440
|
throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props2.src)} instead.`);
|
|
14215
14441
|
}
|
|
14216
14442
|
const preloadedSrc = usePreload(props2.src);
|
|
14217
|
-
const onDuration =
|
|
14443
|
+
const onDuration = useCallback27((src, durationInSeconds) => {
|
|
14218
14444
|
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
14219
14445
|
}, [setDurations]);
|
|
14220
14446
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props2.src)];
|