remotion 4.0.537 → 4.0.539
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AbsoluteFill.d.ts +62 -62
- package/dist/cjs/AbsoluteFill.js +3 -3
- package/dist/cjs/AbsoluteFillElement.d.ts +1 -1
- package/dist/cjs/AbsoluteFillElement.js +43 -5
- package/dist/cjs/CanUseRemotionHooks.js +1 -1
- package/dist/cjs/Composition.js +5 -11
- package/dist/cjs/CompositionErrorBoundary.js +5 -2
- package/dist/cjs/CompositionManager.d.ts +1 -0
- package/dist/cjs/CompositionManagerProvider.d.ts +1 -1
- package/dist/cjs/CompositionManagerProvider.js +1 -1
- package/dist/cjs/CompositionRegistryProvider.d.ts +1 -1
- package/dist/cjs/CompositionRegistryProvider.js +1 -1
- package/dist/cjs/EditorProps.d.ts +2 -2
- package/dist/cjs/EditorProps.js +1 -1
- package/dist/cjs/Folder.js +1 -1
- package/dist/cjs/HtmlInCanvas.d.ts +58 -67
- package/dist/cjs/HtmlInCanvas.js +22 -9
- package/dist/cjs/HtmlInCanvasFallback.d.ts +6 -0
- package/dist/cjs/HtmlInCanvasFallback.js +39 -0
- package/dist/cjs/IFrame.d.ts +2 -2
- package/dist/cjs/IFrame.js +1 -1
- package/dist/cjs/Img.d.ts +62 -62
- package/dist/cjs/Img.js +160 -132
- package/dist/cjs/Interactive.d.ts +147 -145
- package/dist/cjs/Interactive.js +2 -2
- package/dist/cjs/RemotionRoot.js +1 -1
- package/dist/cjs/RenderAssetManager.js +1 -1
- package/dist/cjs/Sequence.js +37 -27
- package/dist/cjs/SequenceActivityBoundary.js +1 -1
- package/dist/cjs/SequenceActivityBudget.js +1 -1
- package/dist/cjs/SequenceActivitySuspensionProvider.js +1 -1
- package/dist/cjs/SequenceManager.d.ts +6 -0
- package/dist/cjs/SequenceManager.js +71 -27
- package/dist/cjs/SequenceRegistryProvider.js +16 -3
- package/dist/cjs/TimelineContext.js +1 -1
- package/dist/cjs/Track.js +2 -2
- package/dist/cjs/animated-image/AnimatedImage.d.ts +69 -69
- package/dist/cjs/animated-image/AnimatedImage.js +6 -6
- package/dist/cjs/animated-image/canvas.d.ts +6 -5
- package/dist/cjs/animated-image/canvas.js +1 -1
- package/dist/cjs/animated-image/create-image-decoder.d.ts +1 -1
- package/dist/cjs/animated-image/decode-image.d.ts +1 -1
- package/dist/cjs/animated-image/decode-image.js +2 -0
- package/dist/cjs/animated-image/get-duration-in-seconds.d.ts +1 -1
- package/dist/cjs/animated-image/index.js +1 -1
- package/dist/cjs/audio/AudioForPreview.js +5 -28
- package/dist/cjs/audio/AudioForRendering.d.ts +5 -20
- package/dist/cjs/audio/AudioForRendering.js +44 -5
- package/dist/cjs/audio/html5-audio.d.ts +36 -36
- package/dist/cjs/audio/html5-audio.js +8 -10
- package/dist/cjs/audio/index.js +1 -1
- package/dist/cjs/audio/shared-audio-tags.js +10 -16
- package/dist/cjs/audio/shared-element-source-node.d.ts +1 -1
- package/dist/cjs/audio/use-audio-context.d.ts +2 -1
- package/dist/cjs/audio/wait-until-actually-resumed.d.ts +2 -1
- package/dist/cjs/buffer-until-first-frame.d.ts +4 -3
- package/dist/cjs/buffering.js +1 -1
- package/dist/cjs/cancel-render.js +3 -0
- package/dist/cjs/canvas-image/CanvasImage.d.ts +71 -71
- package/dist/cjs/canvas-image/CanvasImage.js +27 -24
- package/dist/cjs/canvas-image/index.js +1 -1
- package/dist/cjs/codec.d.ts +1 -1
- package/dist/cjs/committed-metadata.d.ts +4 -2
- package/dist/cjs/composition-registry-fallback.d.ts +4 -2
- package/dist/cjs/composition-registry-fallback.js +12 -10
- package/dist/cjs/create-element-source-proxy.js +46 -6
- package/dist/cjs/default-css.d.ts +1 -1
- package/dist/cjs/delay-render.d.ts +2 -1
- package/dist/cjs/delay-render.js +4 -2
- package/dist/cjs/easing.js +3 -1
- package/dist/cjs/effects/Solid.d.ts +60 -60
- package/dist/cjs/effects/Solid.js +2 -2
- package/dist/cjs/effects/canvas-pool.js +6 -9
- package/dist/cjs/effects/create-curve-sampler.d.ts +1 -0
- package/dist/cjs/effects/create-curve-sampler.js +100 -0
- package/dist/cjs/effects/effect-source-observer.d.ts +13 -0
- package/dist/cjs/effects/effect-source-observer.js +177 -0
- package/dist/cjs/effects/index.js +1 -1
- package/dist/cjs/effects/run-effect-chain.js +3 -0
- package/dist/cjs/effects/use-memoized-effects.d.ts +2 -1
- package/dist/cjs/effects/use-memoized-effects.js +29 -13
- package/dist/cjs/freeze.js +2 -2
- package/dist/cjs/get-cross-origin-value.d.ts +1 -1
- package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -2
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +32 -32
- package/dist/cjs/interactivity-schema.d.ts +286 -286
- package/dist/cjs/internals.d.ts +412 -595
- package/dist/cjs/internals.js +11 -0
- package/dist/cjs/interpolate-colors.d.ts +1 -1
- package/dist/cjs/interpolate-colors.js +28 -23
- package/dist/cjs/interpolate.d.ts +2 -9
- package/dist/cjs/interpolate.js +37 -33
- package/dist/cjs/is-player.js +1 -1
- package/dist/cjs/loading-indicator.js +2 -6
- package/dist/cjs/log-level-context.d.ts +1 -1
- package/dist/cjs/log.d.ts +12 -7
- package/dist/cjs/loop/index.js +1 -1
- package/dist/cjs/media-resource-manager.d.ts +1 -1
- package/dist/cjs/media-tag-current-time-timestamp.d.ts +1 -1
- package/dist/cjs/no-react.d.ts +85 -91
- package/dist/cjs/no-react.js +2 -2
- package/dist/cjs/nonce.d.ts +11 -0
- package/dist/cjs/nonce.js +42 -0
- package/dist/cjs/play-and-handle-not-allowed-error.d.ts +5 -4
- package/dist/cjs/playback-logging.d.ts +2 -1
- package/dist/cjs/playback-pitch-context.d.ts +1 -0
- package/dist/cjs/playback-pitch-context.js +5 -0
- package/dist/cjs/prefetch-state.js +1 -1
- package/dist/cjs/prefetch.d.ts +7 -6
- package/dist/cjs/prefetch.js +30 -5
- package/dist/cjs/props-if-has-props.d.ts +2 -1
- package/dist/cjs/prores-profile.d.ts +1 -1
- package/dist/cjs/register-root.d.ts +2 -2
- package/dist/cjs/render-resource-manager.d.ts +1 -1
- package/dist/cjs/render-types.d.ts +2 -2
- package/dist/cjs/resolve-video-config.d.ts +8 -8
- package/dist/cjs/runtime-value-store.d.ts +1 -1
- package/dist/cjs/scale-value.d.ts +1 -1
- package/dist/cjs/seek.d.ts +3 -2
- package/dist/cjs/sequence-activity-context.js +1 -1
- package/dist/cjs/sequence-crop.js +1 -4
- package/dist/cjs/sequence-order-marker.d.ts +58 -0
- package/dist/cjs/sequence-order-marker.js +44 -0
- package/dist/cjs/series/flatten-children.d.ts +3 -1
- package/dist/cjs/series/index.js +4 -5
- package/dist/cjs/series/is-inside-series.js +2 -2
- package/dist/cjs/spring/index.d.ts +1 -1
- package/dist/cjs/spring/index.js +2 -4
- package/dist/cjs/spring/measure-spring.d.ts +1 -1
- package/dist/cjs/spring/spring-utils.d.ts +1 -1
- package/dist/cjs/spring/spring-utils.js +11 -5
- package/dist/cjs/timeline-position-state.d.ts +1 -1
- package/dist/cjs/timeline-position-state.js +2 -2
- package/dist/cjs/use-amplification.d.ts +4 -7
- package/dist/cjs/use-current-scale.d.ts +2 -2
- package/dist/cjs/use-delay-render.d.ts +2 -1
- package/dist/cjs/use-lazy-component.d.ts +1 -1
- package/dist/cjs/use-lazy-component.js +20 -9
- package/dist/cjs/use-media-buffering.d.ts +3 -2
- package/dist/cjs/use-media-duration.d.ts +4 -0
- package/dist/cjs/use-media-duration.js +36 -0
- package/dist/cjs/use-media-enabled.d.ts +1 -1
- package/dist/cjs/use-media-enabled.js +1 -1
- package/dist/cjs/use-media-in-timeline.d.ts +1 -1
- package/dist/cjs/use-media-playback.d.ts +3 -3
- package/dist/cjs/use-media-tag.d.ts +2 -2
- package/dist/cjs/use-pixel-density.d.ts +1 -1
- package/dist/cjs/use-premounting.d.ts +1 -1
- package/dist/cjs/use-premounting.js +6 -2
- package/dist/cjs/use-request-video-callback-time.d.ts +3 -3
- package/dist/cjs/use-schema.d.ts +4 -4
- package/dist/cjs/use-video.js +1 -1
- package/dist/cjs/validate-media-props.d.ts +1 -1
- package/dist/cjs/validation/validate-default-props.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/MediaPlaybackError.js +0 -1
- package/dist/cjs/video/OffthreadVideo.js +5 -5
- package/dist/cjs/video/OffthreadVideoForRendering.js +9 -7
- package/dist/cjs/video/VideoForPreview.js +6 -28
- package/dist/cjs/video/VideoForRendering.d.ts +5 -3
- package/dist/cjs/video/VideoForRendering.js +4 -2
- package/dist/cjs/video/duration-state.d.ts +1 -0
- package/dist/cjs/video/duration-state.js +8 -2
- package/dist/cjs/video/emit-video-frame.d.ts +1 -1
- package/dist/cjs/video/html5-video.d.ts +36 -36
- package/dist/cjs/video/html5-video.js +8 -10
- package/dist/cjs/video/index.js +2 -2
- package/dist/cjs/video/seek-until-right.d.ts +3 -2
- package/dist/cjs/warn-about-non-seekable-media.d.ts +1 -1
- package/dist/cjs/with-interactivity-schema.d.ts +1 -1
- package/dist/cjs/with-interactivity-schema.js +3 -8
- package/dist/cjs/wrap-remotion-context.d.ts +4 -4
- package/dist/cjs/wrap-remotion-context.js +2 -2
- package/dist/esm/index.mjs +1304 -819
- package/dist/esm/no-react.mjs +74 -52
- package/dist/esm/version.mjs +1 -1
- package/package.json +4 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -64,13 +64,7 @@ var Clipper = () => {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
// src/Composition.tsx
|
|
67
|
-
import {
|
|
68
|
-
Suspense,
|
|
69
|
-
useCallback as useCallback3,
|
|
70
|
-
useContext as useContext10,
|
|
71
|
-
useEffect as useEffect4,
|
|
72
|
-
useMemo as useMemo8
|
|
73
|
-
} from "react";
|
|
67
|
+
import { Suspense, useContext as useContext10, useEffect as useEffect4, useMemo as useMemo8 } from "react";
|
|
74
68
|
import { createPortal } from "react-dom";
|
|
75
69
|
|
|
76
70
|
// src/CanUseRemotionHooks.tsx
|
|
@@ -175,6 +169,15 @@ import {
|
|
|
175
169
|
} from "react";
|
|
176
170
|
var CompositionRegistryFallbackContext = createContext5(null);
|
|
177
171
|
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
172
|
+
var createEntryCleanup = (registry, identity) => {
|
|
173
|
+
if (registry === null) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
return () => {
|
|
177
|
+
registry.entries.delete(identity);
|
|
178
|
+
registry.notifyCommit();
|
|
179
|
+
};
|
|
180
|
+
};
|
|
178
181
|
var useCommittedCompositionEntry = (entry) => {
|
|
179
182
|
const registry = useContext(CompositionRegistryFallbackContext);
|
|
180
183
|
const key = useRef({});
|
|
@@ -189,16 +192,7 @@ var useCommittedCompositionEntry = (entry) => {
|
|
|
189
192
|
}
|
|
190
193
|
registry.notifyCommit();
|
|
191
194
|
}, [entry, registry]);
|
|
192
|
-
useIsomorphicLayoutEffect(()
|
|
193
|
-
if (registry === null) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const identity = key.current;
|
|
197
|
-
return () => {
|
|
198
|
-
registry.entries.delete(identity);
|
|
199
|
-
registry.notifyCommit();
|
|
200
|
-
};
|
|
201
|
-
}, [registry]);
|
|
195
|
+
useIsomorphicLayoutEffect(createEntryCleanup.bind(null, registry, key.current), [registry]);
|
|
202
196
|
};
|
|
203
197
|
|
|
204
198
|
// src/composition-render-error-context.ts
|
|
@@ -475,7 +469,7 @@ var useIsPlayer = () => {
|
|
|
475
469
|
};
|
|
476
470
|
|
|
477
471
|
// src/AbsoluteFillElement.tsx
|
|
478
|
-
import { forwardRef, useMemo as useMemo2 } from "react";
|
|
472
|
+
import React6, { forwardRef, useMemo as useMemo2 } from "react";
|
|
479
473
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
480
474
|
var hasTailwindClassName = ({
|
|
481
475
|
className,
|
|
@@ -499,7 +493,7 @@ var hasTailwindClassName = ({
|
|
|
499
493
|
};
|
|
500
494
|
var AbsoluteFillElementRefForwarding = (props, ref) => {
|
|
501
495
|
const { style, ...other } = props;
|
|
502
|
-
const
|
|
496
|
+
const defaultStyle = useMemo2(() => {
|
|
503
497
|
return {
|
|
504
498
|
position: "absolute",
|
|
505
499
|
top: hasTailwindClassName({
|
|
@@ -558,17 +552,22 @@ var AbsoluteFillElementRefForwarding = (props, ref) => {
|
|
|
558
552
|
"flex-col-reverse"
|
|
559
553
|
],
|
|
560
554
|
type: "exact"
|
|
561
|
-
}) ? undefined : "column"
|
|
555
|
+
}) ? undefined : "column"
|
|
556
|
+
};
|
|
557
|
+
}, [other.className]);
|
|
558
|
+
const actualStyle = useMemo2(() => {
|
|
559
|
+
return {
|
|
560
|
+
...defaultStyle,
|
|
562
561
|
...style
|
|
563
562
|
};
|
|
564
|
-
}, [
|
|
563
|
+
}, [defaultStyle, style]);
|
|
565
564
|
return /* @__PURE__ */ jsx5("div", {
|
|
566
565
|
ref,
|
|
567
566
|
style: actualStyle,
|
|
568
567
|
...other
|
|
569
568
|
});
|
|
570
569
|
};
|
|
571
|
-
var AbsoluteFillElement = forwardRef(AbsoluteFillElementRefForwarding);
|
|
570
|
+
var AbsoluteFillElement = React6.memo(forwardRef(AbsoluteFillElementRefForwarding));
|
|
572
571
|
|
|
573
572
|
// src/use-current-scale.ts
|
|
574
573
|
import React10, { createContext as createContext14 } from "react";
|
|
@@ -1169,6 +1168,7 @@ function cancelRenderInternal(scope, err) {
|
|
|
1169
1168
|
error = Error("Rendering was cancelled");
|
|
1170
1169
|
}
|
|
1171
1170
|
if (scope) {
|
|
1171
|
+
scope.remotion_cancelledErrorObject = error;
|
|
1172
1172
|
scope.remotion_cancelledError = getErrorStackWithMessage(error);
|
|
1173
1173
|
}
|
|
1174
1174
|
throw error;
|
|
@@ -1274,7 +1274,9 @@ var delayRenderInternal = ({
|
|
|
1274
1274
|
called
|
|
1275
1275
|
].filter(truthy).join(" ");
|
|
1276
1276
|
if (environment.isClientSideRendering) {
|
|
1277
|
-
|
|
1277
|
+
const error = Error(message);
|
|
1278
|
+
scope.remotion_cancelledErrorObject = error;
|
|
1279
|
+
scope.remotion_cancelledError = getErrorStackWithMessage(error);
|
|
1278
1280
|
} else {
|
|
1279
1281
|
cancelRenderInternal(scope, Error(message));
|
|
1280
1282
|
}
|
|
@@ -1497,6 +1499,13 @@ var useSyncExternalStore2 = React12.useSyncExternalStore ?? shim;
|
|
|
1497
1499
|
|
|
1498
1500
|
// src/use-lazy-component.ts
|
|
1499
1501
|
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? useEffect3 : useLayoutEffect3;
|
|
1502
|
+
var createComponentWrapper = (componentStore) => {
|
|
1503
|
+
const Wrapper = (props) => {
|
|
1504
|
+
const Comp = useSyncExternalStore2(componentStore.subscribe, componentStore.getSnapshot, componentStore.getSnapshot);
|
|
1505
|
+
return React13.createElement(Comp, props);
|
|
1506
|
+
};
|
|
1507
|
+
return Wrapper;
|
|
1508
|
+
};
|
|
1500
1509
|
var useLazyComponent = ({
|
|
1501
1510
|
compProps,
|
|
1502
1511
|
componentName,
|
|
@@ -1513,15 +1522,12 @@ var useLazyComponent = ({
|
|
|
1513
1522
|
componentStore.setSnapshot(() => componentFromProps);
|
|
1514
1523
|
}
|
|
1515
1524
|
}, [componentFromProps, componentStore]);
|
|
1525
|
+
const createWrapper = createComponentWrapper;
|
|
1526
|
+
const Wrapper = useMemo7(createWrapper.bind(null, componentStore), [
|
|
1527
|
+
componentStore
|
|
1528
|
+
]);
|
|
1516
1529
|
const lazy = useMemo7(() => {
|
|
1517
1530
|
if ("component" in compProps) {
|
|
1518
|
-
if (typeof document === "undefined" || noSuspense) {
|
|
1519
|
-
return compProps.component;
|
|
1520
|
-
}
|
|
1521
|
-
const Wrapper = (props) => {
|
|
1522
|
-
const Comp = useSyncExternalStore2(componentStore.subscribe, componentStore.getSnapshot, componentStore.getSnapshot);
|
|
1523
|
-
return React13.createElement(Comp, props);
|
|
1524
|
-
};
|
|
1525
1531
|
return Wrapper;
|
|
1526
1532
|
}
|
|
1527
1533
|
if ("lazyComponent" in compProps && typeof compProps.lazyComponent !== "undefined") {
|
|
@@ -1531,7 +1537,10 @@ var useLazyComponent = ({
|
|
|
1531
1537
|
return React13.lazy(compProps.lazyComponent);
|
|
1532
1538
|
}
|
|
1533
1539
|
throw new Error("You must pass either 'component' or 'lazyComponent'");
|
|
1534
|
-
}, [lazyComponentFromProps, componentStore]);
|
|
1540
|
+
}, [lazyComponentFromProps, componentStore, Wrapper]);
|
|
1541
|
+
if ("component" in compProps && (typeof document === "undefined" || noSuspense)) {
|
|
1542
|
+
return compProps.component;
|
|
1543
|
+
}
|
|
1535
1544
|
return lazy;
|
|
1536
1545
|
};
|
|
1537
1546
|
|
|
@@ -1639,13 +1648,7 @@ var InnerComposition = ({
|
|
|
1639
1648
|
const metadata = useMemo8(() => ({ type: "composition", id, value: registration }), [id, registration]);
|
|
1640
1649
|
useCommittedCompositionEntry(metadata);
|
|
1641
1650
|
const resolved = useResolvedVideoConfig(id);
|
|
1642
|
-
const { setError, clearError } = useContext10(CompositionRenderErrorContext);
|
|
1643
|
-
const onError = useCallback3((error) => {
|
|
1644
|
-
setError(error);
|
|
1645
|
-
}, [setError]);
|
|
1646
|
-
const onClear = useCallback3(() => {
|
|
1647
|
-
clearError();
|
|
1648
|
-
}, [clearError]);
|
|
1651
|
+
const { setError: onError, clearError: onClear } = useContext10(CompositionRenderErrorContext);
|
|
1649
1652
|
const wrapRegistration = (content) => /* @__PURE__ */ jsx9(CommittedMetadataProvider, {
|
|
1650
1653
|
value: null,
|
|
1651
1654
|
_remotionCommitMetadata: metadata,
|
|
@@ -1744,7 +1747,7 @@ var getStackForControls = (controls) => {
|
|
|
1744
1747
|
};
|
|
1745
1748
|
|
|
1746
1749
|
// src/version.ts
|
|
1747
|
-
var VERSION = "4.0.
|
|
1750
|
+
var VERSION = "4.0.539";
|
|
1748
1751
|
|
|
1749
1752
|
// src/multiple-versions-warning.ts
|
|
1750
1753
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -1781,15 +1784,14 @@ var Null = () => {
|
|
|
1781
1784
|
};
|
|
1782
1785
|
|
|
1783
1786
|
// src/Sequence.tsx
|
|
1784
|
-
import
|
|
1787
|
+
import React27, {
|
|
1785
1788
|
createContext as createContext28,
|
|
1786
1789
|
forwardRef as forwardRef3,
|
|
1787
|
-
useCallback as useCallback7,
|
|
1788
1790
|
useContext as useContext28,
|
|
1789
|
-
useLayoutEffect as
|
|
1790
|
-
useMemo as
|
|
1791
|
+
useLayoutEffect as useLayoutEffect9,
|
|
1792
|
+
useMemo as useMemo21,
|
|
1791
1793
|
useRef as useRef8,
|
|
1792
|
-
useState as
|
|
1794
|
+
useState as useState10
|
|
1793
1795
|
} from "react";
|
|
1794
1796
|
|
|
1795
1797
|
// src/DefaultPremountContext.ts
|
|
@@ -1833,7 +1835,7 @@ import { createContext as createContext20, useContext as useContext14 } from "re
|
|
|
1833
1835
|
// src/TimelineContext.tsx
|
|
1834
1836
|
import {
|
|
1835
1837
|
createContext as createContext19,
|
|
1836
|
-
useCallback as
|
|
1838
|
+
useCallback as useCallback3,
|
|
1837
1839
|
useLayoutEffect as useLayoutEffect4,
|
|
1838
1840
|
useMemo as useMemo10,
|
|
1839
1841
|
useRef as useRef3,
|
|
@@ -1926,8 +1928,8 @@ var TimelineContextProvider = ({ children, frameState }) => {
|
|
|
1926
1928
|
const frame = frameState ?? _frame;
|
|
1927
1929
|
const frameRef = useRef3(frame);
|
|
1928
1930
|
frameRef.current = frame;
|
|
1929
|
-
const readIsPlaying =
|
|
1930
|
-
const readIsBuffering =
|
|
1931
|
+
const readIsPlaying = useCallback3(() => playingStore.store.getSnapshot().playing, [playingStore]);
|
|
1932
|
+
const readIsBuffering = useCallback3(() => bufferingStore.store.getSnapshot().buffering, [bufferingStore]);
|
|
1931
1933
|
const { delayRender, continueRender } = useDelayRender();
|
|
1932
1934
|
if (typeof window !== "undefined") {
|
|
1933
1935
|
useLayoutEffect4(() => {
|
|
@@ -2991,7 +2993,7 @@ var useSequenceActivityAdmission = (candidate) => {
|
|
|
2991
2993
|
};
|
|
2992
2994
|
|
|
2993
2995
|
// src/SequenceManager.tsx
|
|
2994
|
-
import React23, { useCallback as
|
|
2996
|
+
import React23, { useCallback as useCallback5, useContext as useContext23, useMemo as useMemo15, useRef as useRef5, useState as useState7 } from "react";
|
|
2995
2997
|
|
|
2996
2998
|
// src/sequence-registry-context.tsx
|
|
2997
2999
|
import React20, { useContext as useContext20 } from "react";
|
|
@@ -3070,12 +3072,13 @@ var SequenceActivitySuspensionProvider = ({ children }) => {
|
|
|
3070
3072
|
};
|
|
3071
3073
|
|
|
3072
3074
|
// src/SequenceRegistryProvider.tsx
|
|
3073
|
-
import React22, { useCallback as
|
|
3075
|
+
import React22, { useCallback as useCallback4, useContext as useContext22, useMemo as useMemo14, useRef as useRef4, useState as useState6 } from "react";
|
|
3074
3076
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
3075
3077
|
var useIsomorphicLayoutEffect3 = typeof window === "undefined" ? React22.useEffect : React22.useLayoutEffect;
|
|
3076
3078
|
var SequenceManagerRefProvider = withCommittedMetadata(SequenceManagerRefContext.Provider);
|
|
3077
3079
|
var SequenceRegistryProvider = ({ children }) => {
|
|
3078
3080
|
const { isStudio } = useRemotionEnvironment();
|
|
3081
|
+
const logLevel = useLogLevel();
|
|
3079
3082
|
const sequenceRegistrationEnabled = useContext22(SequenceRegistrationContext);
|
|
3080
3083
|
const shouldObserveCommits = isStudio || sequenceRegistrationEnabled;
|
|
3081
3084
|
const [sequenceManagerId] = useState6(() => String(Math.random()));
|
|
@@ -3099,7 +3102,7 @@ var SequenceRegistryProvider = ({ children }) => {
|
|
|
3099
3102
|
return registry.getSnapshot();
|
|
3100
3103
|
}
|
|
3101
3104
|
}), [registry]);
|
|
3102
|
-
const onCommitSequences =
|
|
3105
|
+
const onCommitSequences = useCallback4((scopeId, snapshot, sequenceIds) => {
|
|
3103
3106
|
if (registrationObserverFailedRef.current || registrationUnmountedRef.current) {
|
|
3104
3107
|
return;
|
|
3105
3108
|
}
|
|
@@ -3139,6 +3142,13 @@ var SequenceRegistryProvider = ({ children }) => {
|
|
|
3139
3142
|
committedOrderIdsRef.current = ids;
|
|
3140
3143
|
committedOrderRef.current = order;
|
|
3141
3144
|
committedRegistrationIdsRef.current = nextIds;
|
|
3145
|
+
if (isStudio && logLevel === "trace") {
|
|
3146
|
+
for (const sequence of sequences) {
|
|
3147
|
+
if (!previousIds.has(sequence.id)) {
|
|
3148
|
+
Log.trace({ logLevel, tag: null }, `[Sequence registration] Registered "${sequence.displayName}" (${sequence.id}) after commit`, sequence);
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3142
3152
|
setSequences((current) => reconcileRegistryEntries({
|
|
3143
3153
|
current,
|
|
3144
3154
|
entries: sequences,
|
|
@@ -3150,8 +3160,8 @@ var SequenceRegistryProvider = ({ children }) => {
|
|
|
3150
3160
|
orderProperty: "timelineOrder"
|
|
3151
3161
|
}));
|
|
3152
3162
|
});
|
|
3153
|
-
}, [sequenceManagerId, setSequences]);
|
|
3154
|
-
const onCommitRootSequences =
|
|
3163
|
+
}, [isStudio, logLevel, sequenceManagerId, setSequences]);
|
|
3164
|
+
const onCommitRootSequences = useCallback4((sequences, sequenceIds) => {
|
|
3155
3165
|
if (!rootObservationFailedRef.current) {
|
|
3156
3166
|
observedCommitRef.current = true;
|
|
3157
3167
|
onCommitSequences(sequenceManagerId, sequences, sequenceIds);
|
|
@@ -3246,7 +3256,10 @@ var SequenceRegistryProvider = ({ children }) => {
|
|
|
3246
3256
|
commitRegistrationEnabled,
|
|
3247
3257
|
onCommitSequences
|
|
3248
3258
|
]);
|
|
3249
|
-
const registerSequence =
|
|
3259
|
+
const registerSequence = useCallback4((seq) => {
|
|
3260
|
+
if (isStudio) {
|
|
3261
|
+
Log.trace({ logLevel, tag: null }, `[Sequence registration] Registered "${seq.displayName}" (${seq.id}) after commit`, seq);
|
|
3262
|
+
}
|
|
3250
3263
|
setSequences((seqs) => {
|
|
3251
3264
|
return [
|
|
3252
3265
|
...seqs,
|
|
@@ -3256,8 +3269,8 @@ var SequenceRegistryProvider = ({ children }) => {
|
|
|
3256
3269
|
}
|
|
3257
3270
|
];
|
|
3258
3271
|
});
|
|
3259
|
-
}, [setSequences]);
|
|
3260
|
-
const updateSequence =
|
|
3272
|
+
}, [isStudio, logLevel, setSequences]);
|
|
3273
|
+
const updateSequence = useCallback4((seq) => {
|
|
3261
3274
|
setSequences((seqs) => {
|
|
3262
3275
|
const index = seqs.findIndex((item) => item.id === seq.id);
|
|
3263
3276
|
if (index === -1) {
|
|
@@ -3275,7 +3288,7 @@ var SequenceRegistryProvider = ({ children }) => {
|
|
|
3275
3288
|
return next;
|
|
3276
3289
|
});
|
|
3277
3290
|
}, [setSequences]);
|
|
3278
|
-
const unregisterSequence =
|
|
3291
|
+
const unregisterSequence = useCallback4((seq) => {
|
|
3279
3292
|
setSequences((seqs) => seqs.filter((s) => s.id !== seq));
|
|
3280
3293
|
}, [setSequences]);
|
|
3281
3294
|
const actions = useMemo14(() => {
|
|
@@ -3354,6 +3367,12 @@ var VisualModePropStatusesContext = React23.createContext({
|
|
|
3354
3367
|
var VisualModePropStatusesRefContext = React23.createContext({
|
|
3355
3368
|
current: {}
|
|
3356
3369
|
});
|
|
3370
|
+
var VisualModePropStatusesSubscriptionContext = React23.createContext({
|
|
3371
|
+
subscribe: () => () => {
|
|
3372
|
+
return;
|
|
3373
|
+
},
|
|
3374
|
+
getSnapshot: () => null
|
|
3375
|
+
});
|
|
3357
3376
|
var defaultVisualModeDragOverrides = {
|
|
3358
3377
|
getDragOverrides: () => {
|
|
3359
3378
|
throw new Error("VisualModeDragOverridesContext not initialized");
|
|
@@ -3364,7 +3383,7 @@ var defaultVisualModeDragOverrides = {
|
|
|
3364
3383
|
};
|
|
3365
3384
|
var VisualModeDragOverridesContext = React23.createContext(defaultVisualModeDragOverrides);
|
|
3366
3385
|
var VisualModeDragOverridesRefContext = React23.createContext({ current: defaultVisualModeDragOverrides });
|
|
3367
|
-
var
|
|
3386
|
+
var useVisualModeSnapshot = (subscribe, getSnapshot) => {
|
|
3368
3387
|
const dormant = useContext23(SequenceActivityDormantContext);
|
|
3369
3388
|
const [, forceUpdate] = useState7(0);
|
|
3370
3389
|
const snapshot = useSyncExternalStore2(subscribe, getSnapshot, getSnapshot);
|
|
@@ -3381,11 +3400,18 @@ var useDragOverridesForNodePath = (nodePath) => {
|
|
|
3381
3400
|
const manager = useContext23(SequenceManagerActionsContext);
|
|
3382
3401
|
const scopedSubscription = subscription?.manager === manager ? subscription : null;
|
|
3383
3402
|
const key = nodePath === null ? null : makeSequencePropsSubscriptionKey(nodePath);
|
|
3384
|
-
const subscribe =
|
|
3403
|
+
const subscribe = useCallback5((listener) => scopedSubscription?.subscribe(key, listener) ?? (() => {
|
|
3385
3404
|
return;
|
|
3386
3405
|
}), [key, scopedSubscription]);
|
|
3387
|
-
const getSnapshot =
|
|
3388
|
-
return
|
|
3406
|
+
const getSnapshot = useCallback5(() => scopedSubscription?.getSnapshot(key) ?? emptyDragOverrides, [key, scopedSubscription]);
|
|
3407
|
+
return useVisualModeSnapshot(subscribe, getSnapshot);
|
|
3408
|
+
};
|
|
3409
|
+
var usePropStatusForNodePath = (nodePath) => {
|
|
3410
|
+
const subscription = useContext23(VisualModePropStatusesSubscriptionContext);
|
|
3411
|
+
const key = nodePath === null ? null : makeSequencePropsSubscriptionKey(nodePath);
|
|
3412
|
+
const subscribe = useCallback5((listener) => subscription.subscribe(key, listener), [key, subscription]);
|
|
3413
|
+
const getSnapshot = useCallback5(() => subscription.getSnapshot(key), [key, subscription]);
|
|
3414
|
+
return useVisualModeSnapshot(subscribe, getSnapshot);
|
|
3389
3415
|
};
|
|
3390
3416
|
var useActiveFromDragOverrideKeys = () => {
|
|
3391
3417
|
const snapshot = useContext23(ActiveFromDragOverrideKeysContext);
|
|
@@ -3397,11 +3423,11 @@ var useEffectDragOverridesForNodePath = (nodePath) => {
|
|
|
3397
3423
|
const manager = useContext23(SequenceManagerActionsContext);
|
|
3398
3424
|
const scopedSubscription = subscription?.manager === manager ? subscription : null;
|
|
3399
3425
|
const key = nodePath === null ? null : makeSequencePropsSubscriptionKey(nodePath);
|
|
3400
|
-
const subscribe =
|
|
3426
|
+
const subscribe = useCallback5((listener) => scopedSubscription?.subscribeEffects(key, listener) ?? (() => {
|
|
3401
3427
|
return;
|
|
3402
3428
|
}), [key, scopedSubscription]);
|
|
3403
|
-
const getSnapshot =
|
|
3404
|
-
return
|
|
3429
|
+
const getSnapshot = useCallback5(() => scopedSubscription?.getEffectSnapshot(key) ?? emptyEffectDragOverrides, [key, scopedSubscription]);
|
|
3430
|
+
return useVisualModeSnapshot(subscribe, getSnapshot);
|
|
3405
3431
|
};
|
|
3406
3432
|
var VisualModeSettersContext = React23.createContext({
|
|
3407
3433
|
setDragOverrides: () => {
|
|
@@ -3443,10 +3469,20 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3443
3469
|
});
|
|
3444
3470
|
const [propStatuses, setPropStatusesMapState] = useState7({});
|
|
3445
3471
|
const propStatusesRef = useRef5(propStatuses);
|
|
3472
|
+
const requestedPropStatusesRef = useRef5(propStatuses);
|
|
3473
|
+
const propStatusListeners = useRef5(new Map);
|
|
3446
3474
|
useIsomorphicLayoutEffect4(() => {
|
|
3475
|
+
const previous = propStatusesRef.current;
|
|
3447
3476
|
propStatusesRef.current = propStatuses;
|
|
3477
|
+
for (const [key, listeners] of propStatusListeners.current) {
|
|
3478
|
+
if (previous[key] !== propStatuses[key]) {
|
|
3479
|
+
for (const listener of listeners) {
|
|
3480
|
+
listener();
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3448
3484
|
}, [propStatuses]);
|
|
3449
|
-
const setDragOverridesBatch =
|
|
3485
|
+
const setDragOverridesBatch = useCallback5((overrides) => {
|
|
3450
3486
|
setDragOverrideState((prevState) => {
|
|
3451
3487
|
const prev = prevState.overrides;
|
|
3452
3488
|
let next = null;
|
|
@@ -3472,8 +3508,8 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3472
3508
|
return next === null ? prevState : { overrides: next, fromKeys: nextFromKeys };
|
|
3473
3509
|
});
|
|
3474
3510
|
}, []);
|
|
3475
|
-
const setDragOverrides =
|
|
3476
|
-
const subscribeDragOverrides =
|
|
3511
|
+
const setDragOverrides = useCallback5((nodePath, key, value) => setDragOverridesBatch([{ nodePath, key, value }]), [setDragOverridesBatch]);
|
|
3512
|
+
const subscribeDragOverrides = useCallback5((key, listener) => {
|
|
3477
3513
|
if (key === null) {
|
|
3478
3514
|
return () => {
|
|
3479
3515
|
return;
|
|
@@ -3492,7 +3528,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3492
3528
|
}
|
|
3493
3529
|
};
|
|
3494
3530
|
}, []);
|
|
3495
|
-
const getDragOverridesSnapshot =
|
|
3531
|
+
const getDragOverridesSnapshot = useCallback5((key) => {
|
|
3496
3532
|
return key === null ? emptyDragOverrides : dragOverridesStore.current.snapshot[key] ?? emptyDragOverrides;
|
|
3497
3533
|
}, []);
|
|
3498
3534
|
useIsomorphicLayoutEffect4(() => {
|
|
@@ -3509,7 +3545,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3509
3545
|
}
|
|
3510
3546
|
}
|
|
3511
3547
|
}, [dragOverrides]);
|
|
3512
|
-
const subscribeEffectDragOverrides =
|
|
3548
|
+
const subscribeEffectDragOverrides = useCallback5((key, listener) => {
|
|
3513
3549
|
if (key === null) {
|
|
3514
3550
|
return () => {
|
|
3515
3551
|
return;
|
|
@@ -3528,7 +3564,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3528
3564
|
}
|
|
3529
3565
|
};
|
|
3530
3566
|
}, []);
|
|
3531
|
-
const getEffectDragOverridesSnapshot =
|
|
3567
|
+
const getEffectDragOverridesSnapshot = useCallback5((key) => {
|
|
3532
3568
|
return key === null ? emptyEffectDragOverrides : effectDragOverridesStore.current.byNode.get(key) ?? emptyEffectDragOverrides;
|
|
3533
3569
|
}, []);
|
|
3534
3570
|
useIsomorphicLayoutEffect4(() => {
|
|
@@ -3572,7 +3608,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3572
3608
|
}
|
|
3573
3609
|
}
|
|
3574
3610
|
}, [effectDragOverridesState]);
|
|
3575
|
-
const clearDragOverrides =
|
|
3611
|
+
const clearDragOverrides = useCallback5((nodePath) => {
|
|
3576
3612
|
setDragOverrideState((prevState) => {
|
|
3577
3613
|
const prev = prevState.overrides;
|
|
3578
3614
|
const key = makeSequencePropsSubscriptionKey(nodePath);
|
|
@@ -3586,7 +3622,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3586
3622
|
return { overrides: next, fromKeys: nextFromKeys };
|
|
3587
3623
|
});
|
|
3588
3624
|
}, []);
|
|
3589
|
-
const setEffectDragOverridesBatch =
|
|
3625
|
+
const setEffectDragOverridesBatch = useCallback5((overrides) => {
|
|
3590
3626
|
setEffectDragOverridesState((prev) => {
|
|
3591
3627
|
let next = null;
|
|
3592
3628
|
for (const { nodePath, effectIndex, key, value } of overrides) {
|
|
@@ -3606,8 +3642,8 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3606
3642
|
return next ?? prev;
|
|
3607
3643
|
});
|
|
3608
3644
|
}, []);
|
|
3609
|
-
const setEffectDragOverrides =
|
|
3610
|
-
const clearEffectDragOverrides =
|
|
3645
|
+
const setEffectDragOverrides = useCallback5((nodePath, effectIndex, key, value) => setEffectDragOverridesBatch([{ nodePath, effectIndex, key, value }]), [setEffectDragOverridesBatch]);
|
|
3646
|
+
const clearEffectDragOverrides = useCallback5((nodePath, effectIndex) => {
|
|
3611
3647
|
setEffectDragOverridesState((prev) => {
|
|
3612
3648
|
const mapKey = effectDragOverridesKey(nodePath, effectIndex);
|
|
3613
3649
|
if (!prev[mapKey]) {
|
|
@@ -3618,8 +3654,17 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3618
3654
|
return next;
|
|
3619
3655
|
});
|
|
3620
3656
|
}, []);
|
|
3621
|
-
const
|
|
3622
|
-
|
|
3657
|
+
const updatePropStatuses = useCallback5((update) => {
|
|
3658
|
+
const previous = requestedPropStatusesRef.current;
|
|
3659
|
+
const next = update(previous);
|
|
3660
|
+
if (next === previous) {
|
|
3661
|
+
return;
|
|
3662
|
+
}
|
|
3663
|
+
requestedPropStatusesRef.current = next;
|
|
3664
|
+
setPropStatusesMapState(next);
|
|
3665
|
+
}, []);
|
|
3666
|
+
const setPropStatuses = useCallback5((nodePath, values) => {
|
|
3667
|
+
updatePropStatuses((prev) => {
|
|
3623
3668
|
const key = makeSequencePropsSubscriptionKey(nodePath);
|
|
3624
3669
|
const prevKey = prev[key];
|
|
3625
3670
|
const newKey = values(prevKey);
|
|
@@ -3628,9 +3673,9 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3628
3673
|
}
|
|
3629
3674
|
return { ...prev, [key]: newKey };
|
|
3630
3675
|
});
|
|
3631
|
-
}, []);
|
|
3632
|
-
const remapPropStatuses =
|
|
3633
|
-
|
|
3676
|
+
}, [updatePropStatuses]);
|
|
3677
|
+
const remapPropStatuses = useCallback5((remappings) => {
|
|
3678
|
+
updatePropStatuses((prev) => {
|
|
3634
3679
|
const next = { ...prev };
|
|
3635
3680
|
for (const remapping of remappings) {
|
|
3636
3681
|
delete next[makeSequencePropsSubscriptionKey(remapping.previousNodePath)];
|
|
@@ -3642,7 +3687,7 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3642
3687
|
}
|
|
3643
3688
|
return next;
|
|
3644
3689
|
});
|
|
3645
|
-
}, []);
|
|
3690
|
+
}, [updatePropStatuses]);
|
|
3646
3691
|
const dragOverridesSubscription = useMemo15(() => ({
|
|
3647
3692
|
subscribe: subscribeDragOverrides,
|
|
3648
3693
|
getSnapshot: getDragOverridesSnapshot,
|
|
@@ -3654,10 +3699,10 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3654
3699
|
subscribeDragOverrides,
|
|
3655
3700
|
subscribeEffectDragOverrides
|
|
3656
3701
|
]);
|
|
3657
|
-
const getDragOverrides =
|
|
3702
|
+
const getDragOverrides = useCallback5((nodePath) => {
|
|
3658
3703
|
return dragOverrides[makeSequencePropsSubscriptionKey(nodePath)] ?? {};
|
|
3659
3704
|
}, [dragOverrides]);
|
|
3660
|
-
const getEffectDragOverrides =
|
|
3705
|
+
const getEffectDragOverrides = useCallback5((nodePath, effectIndex) => {
|
|
3661
3706
|
return effectDragOverridesState[effectDragOverridesKey(nodePath, effectIndex)] ?? {};
|
|
3662
3707
|
}, [effectDragOverridesState]);
|
|
3663
3708
|
const propStatusesContext = useMemo15(() => {
|
|
@@ -3665,6 +3710,28 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3665
3710
|
propStatuses
|
|
3666
3711
|
};
|
|
3667
3712
|
}, [propStatuses]);
|
|
3713
|
+
const propStatusesSubscription = useMemo15(() => ({
|
|
3714
|
+
subscribe: (key, listener) => {
|
|
3715
|
+
if (key === null) {
|
|
3716
|
+
return () => {
|
|
3717
|
+
return;
|
|
3718
|
+
};
|
|
3719
|
+
}
|
|
3720
|
+
let listeners = propStatusListeners.current.get(key);
|
|
3721
|
+
if (!listeners) {
|
|
3722
|
+
listeners = new Set;
|
|
3723
|
+
propStatusListeners.current.set(key, listeners);
|
|
3724
|
+
}
|
|
3725
|
+
listeners.add(listener);
|
|
3726
|
+
return () => {
|
|
3727
|
+
listeners.delete(listener);
|
|
3728
|
+
if (listeners.size === 0) {
|
|
3729
|
+
propStatusListeners.current.delete(key);
|
|
3730
|
+
}
|
|
3731
|
+
};
|
|
3732
|
+
},
|
|
3733
|
+
getSnapshot: (key) => key === null ? null : requestedPropStatusesRef.current[key] ?? null
|
|
3734
|
+
}), []);
|
|
3668
3735
|
const dragOverridesContext = useMemo15(() => {
|
|
3669
3736
|
return {
|
|
3670
3737
|
getDragOverrides,
|
|
@@ -3696,20 +3763,23 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
3696
3763
|
return /* @__PURE__ */ jsx16(SequenceRegistryProvider, {
|
|
3697
3764
|
children: /* @__PURE__ */ jsx16(VisualModePropStatusesRefContext.Provider, {
|
|
3698
3765
|
value: propStatusesRef,
|
|
3699
|
-
children: /* @__PURE__ */ jsx16(
|
|
3700
|
-
value:
|
|
3701
|
-
children: /* @__PURE__ */ jsx16(
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
children: /* @__PURE__ */ jsx16(
|
|
3707
|
-
value:
|
|
3708
|
-
children: /* @__PURE__ */ jsx16(
|
|
3709
|
-
value:
|
|
3710
|
-
children: /* @__PURE__ */ jsx16(
|
|
3711
|
-
value:
|
|
3712
|
-
children
|
|
3766
|
+
children: /* @__PURE__ */ jsx16(VisualModePropStatusesSubscriptionContext.Provider, {
|
|
3767
|
+
value: propStatusesSubscription,
|
|
3768
|
+
children: /* @__PURE__ */ jsx16(VisualModePropStatusesContext.Provider, {
|
|
3769
|
+
value: propStatusesContext,
|
|
3770
|
+
children: /* @__PURE__ */ jsx16(SequenceManagerScopeProviders, {
|
|
3771
|
+
dragOverridesSubscription,
|
|
3772
|
+
fromKeys: dragOverrideState.fromKeys,
|
|
3773
|
+
children: /* @__PURE__ */ jsx16(VisualModeDragOverridesContext.Provider, {
|
|
3774
|
+
value: dragOverridesContext,
|
|
3775
|
+
children: /* @__PURE__ */ jsx16(VisualModeDragOverridesRefContext.Provider, {
|
|
3776
|
+
value: dragOverridesRef,
|
|
3777
|
+
children: /* @__PURE__ */ jsx16(VisualModeSettersContext.Provider, {
|
|
3778
|
+
value: settersContext,
|
|
3779
|
+
children: /* @__PURE__ */ jsx16(VisualModeBatchSettersContext.Provider, {
|
|
3780
|
+
value: batchSettersContext,
|
|
3781
|
+
children
|
|
3782
|
+
})
|
|
3713
3783
|
})
|
|
3714
3784
|
})
|
|
3715
3785
|
})
|
|
@@ -3745,16 +3815,17 @@ var usePremounting = ({
|
|
|
3745
3815
|
hideWhilePremounted
|
|
3746
3816
|
}) => {
|
|
3747
3817
|
const parentPremountContext = useContext24(PremountContext);
|
|
3748
|
-
const frame = useCurrentFrame() - parentPremountContext.premountFramesRemaining;
|
|
3749
3818
|
const environment = useRemotionEnvironment();
|
|
3750
3819
|
const { fps } = useVideoConfig();
|
|
3751
3820
|
const defaultPremountInSeconds = useContext24(DefaultPremountContext);
|
|
3752
3821
|
const effectivePremountFor = premountFor ?? Math.round(defaultPremountInSeconds * fps);
|
|
3753
3822
|
const effectivePostmountFor = postmountFor ?? 0;
|
|
3823
|
+
const needsFrame = !environment.isRendering && (effectivePremountFor !== 0 || effectivePostmountFor !== 0);
|
|
3824
|
+
const frame = useCurrentFrameWithOptionalSubscription(needsFrame) - parentPremountContext.premountFramesRemaining;
|
|
3754
3825
|
const endExclusive = from + durationInFrames;
|
|
3755
3826
|
const sequenceContext = useContext24(SequenceContext);
|
|
3756
3827
|
const boundaryTolerance = getSequenceBoundaryTolerance({
|
|
3757
|
-
absoluteFrame:
|
|
3828
|
+
absoluteFrame: useTimelinePositionWithOptionalSubscription(needsFrame),
|
|
3758
3829
|
cumulatedFrom: sequenceContext ? sequenceContext.cumulatedFrom + sequenceContext.relativeFrom : 0,
|
|
3759
3830
|
from,
|
|
3760
3831
|
parentPlaybackRate: sequenceContext?.playbackRate ?? 1,
|
|
@@ -3843,13 +3914,13 @@ var useSequenceRegistration = ({
|
|
|
3843
3914
|
};
|
|
3844
3915
|
|
|
3845
3916
|
// src/with-interactivity-schema.ts
|
|
3846
|
-
import
|
|
3917
|
+
import React26, {
|
|
3847
3918
|
createContext as createContext27,
|
|
3848
3919
|
forwardRef as forwardRef2,
|
|
3849
3920
|
useContext as useContext27,
|
|
3850
|
-
useLayoutEffect as
|
|
3851
|
-
useMemo as
|
|
3852
|
-
useState as
|
|
3921
|
+
useLayoutEffect as useLayoutEffect8,
|
|
3922
|
+
useMemo as useMemo20,
|
|
3923
|
+
useState as useState9
|
|
3853
3924
|
} from "react";
|
|
3854
3925
|
|
|
3855
3926
|
// src/delete-nested-key.ts
|
|
@@ -3886,7 +3957,7 @@ var deleteNestedKey = (obj, keysToRemove) => {
|
|
|
3886
3957
|
};
|
|
3887
3958
|
|
|
3888
3959
|
// src/effects/use-memoized-effects.ts
|
|
3889
|
-
import
|
|
3960
|
+
import React25, { useContext as useContext26, useLayoutEffect as useLayoutEffect7, useMemo as useMemo19, useRef as useRef7 } from "react";
|
|
3890
3961
|
|
|
3891
3962
|
// src/evaluate-source-expressions.ts
|
|
3892
3963
|
var evaluateSourceNumericValue = (expression, config) => {
|
|
@@ -4494,6 +4565,20 @@ var interpolateSegment = ({
|
|
|
4494
4565
|
output
|
|
4495
4566
|
});
|
|
4496
4567
|
};
|
|
4568
|
+
var getInputForInterpolation = ({
|
|
4569
|
+
input,
|
|
4570
|
+
inputRange,
|
|
4571
|
+
options
|
|
4572
|
+
}) => {
|
|
4573
|
+
const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
|
|
4574
|
+
const inputMin = inputRange[0];
|
|
4575
|
+
const inputMax = inputRange[inputRange.length - 1];
|
|
4576
|
+
if (inputRange.length === 1 || !(posterizedInput < inputMin && options?.extrapolateLeft === "wrap" || posterizedInput > inputMax && options?.extrapolateRight === "wrap")) {
|
|
4577
|
+
return posterizedInput;
|
|
4578
|
+
}
|
|
4579
|
+
const range = inputMax - inputMin;
|
|
4580
|
+
return ((posterizedInput - inputMin) % range + range) % range + inputMin;
|
|
4581
|
+
};
|
|
4497
4582
|
var interpolateNumber = ({
|
|
4498
4583
|
input,
|
|
4499
4584
|
inputRange,
|
|
@@ -4513,14 +4598,18 @@ var interpolateNumber = ({
|
|
|
4513
4598
|
if (options?.extrapolateRight !== undefined) {
|
|
4514
4599
|
extrapolateRight = options.extrapolateRight;
|
|
4515
4600
|
}
|
|
4516
|
-
const
|
|
4517
|
-
|
|
4601
|
+
const resolvedInput = getInputForInterpolation({
|
|
4602
|
+
input,
|
|
4603
|
+
inputRange,
|
|
4604
|
+
options: options ?? null
|
|
4605
|
+
});
|
|
4606
|
+
const range = findRange(resolvedInput, inputRange);
|
|
4518
4607
|
const easing = resolveEasingForSegment({
|
|
4519
4608
|
easing: easingOption,
|
|
4520
4609
|
segmentIndex: range
|
|
4521
4610
|
});
|
|
4522
4611
|
let result = interpolateSegment({
|
|
4523
|
-
input:
|
|
4612
|
+
input: resolvedInput,
|
|
4524
4613
|
inputRange: [inputRange[range], inputRange[range + 1]],
|
|
4525
4614
|
outputRange: [outputRange[range], outputRange[range + 1]],
|
|
4526
4615
|
easing,
|
|
@@ -4537,11 +4626,11 @@ var interpolateNumber = ({
|
|
|
4537
4626
|
continue;
|
|
4538
4627
|
}
|
|
4539
4628
|
const previousSegmentEnd = inputRange[segmentIndex + 1];
|
|
4540
|
-
if (
|
|
4629
|
+
if (resolvedInput <= previousSegmentEnd) {
|
|
4541
4630
|
continue;
|
|
4542
4631
|
}
|
|
4543
4632
|
const continuedSegmentValue = interpolateSegment({
|
|
4544
|
-
input:
|
|
4633
|
+
input: resolvedInput,
|
|
4545
4634
|
inputRange: [inputRange[segmentIndex], previousSegmentEnd],
|
|
4546
4635
|
outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
|
|
4547
4636
|
easing: previousEasing,
|
|
@@ -4562,8 +4651,12 @@ var interpolateString = ({
|
|
|
4562
4651
|
}) => {
|
|
4563
4652
|
const initiallyParsedOutputRange = outputRange.map((output) => parseStringInterpolationValue(output, outputType));
|
|
4564
4653
|
const hasAxisRotation = initiallyParsedOutputRange.some((parsed) => parsed.axisRotation);
|
|
4565
|
-
const
|
|
4566
|
-
|
|
4654
|
+
const resolvedInput = getInputForInterpolation({
|
|
4655
|
+
input,
|
|
4656
|
+
inputRange,
|
|
4657
|
+
options: options ?? null
|
|
4658
|
+
});
|
|
4659
|
+
const segmentIndex = inputRange.length === 1 ? 0 : findRange(resolvedInput, inputRange);
|
|
4567
4660
|
const parsedOutputRange = hasAxisRotation ? initiallyParsedOutputRange.map((parsed, index) => {
|
|
4568
4661
|
if (parsed.kind !== "rotate") {
|
|
4569
4662
|
return parsed;
|
|
@@ -4687,31 +4780,24 @@ var interpolateDiscreteValue = ({
|
|
|
4687
4780
|
throw new TypeError(typeof outputRange[0] === "boolean" ? "Booleans can only be interpolated using Easing.step1" : "Non-numeric strings can only be interpolated using Easing.step1");
|
|
4688
4781
|
}
|
|
4689
4782
|
}
|
|
4690
|
-
const
|
|
4783
|
+
const resolvedInput = getInputForInterpolation({
|
|
4784
|
+
input,
|
|
4785
|
+
inputRange,
|
|
4786
|
+
options: options ?? null
|
|
4787
|
+
});
|
|
4691
4788
|
const inputMin = inputRange[0];
|
|
4692
4789
|
const inputMax = inputRange[inputRange.length - 1];
|
|
4693
|
-
let resolvedInput = posterizedInput;
|
|
4694
4790
|
if (resolvedInput < inputMin) {
|
|
4695
4791
|
if (options?.extrapolateLeft === "identity") {
|
|
4696
4792
|
throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateLeft: "identity" is not supported for booleans' : 'extrapolateLeft: "identity" is not supported for non-numeric strings');
|
|
4697
4793
|
}
|
|
4698
|
-
|
|
4699
|
-
const wrapRange = inputMax - inputMin;
|
|
4700
|
-
resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
|
|
4701
|
-
} else {
|
|
4702
|
-
return outputRange[0];
|
|
4703
|
-
}
|
|
4794
|
+
return outputRange[0];
|
|
4704
4795
|
}
|
|
4705
4796
|
if (resolvedInput > inputMax) {
|
|
4706
4797
|
if (options?.extrapolateRight === "identity") {
|
|
4707
4798
|
throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateRight: "identity" is not supported for booleans' : 'extrapolateRight: "identity" is not supported for non-numeric strings');
|
|
4708
4799
|
}
|
|
4709
|
-
|
|
4710
|
-
const wrapRange = inputMax - inputMin;
|
|
4711
|
-
resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
|
|
4712
|
-
} else {
|
|
4713
|
-
return outputRange[outputRange.length - 1];
|
|
4714
|
-
}
|
|
4800
|
+
return outputRange[outputRange.length - 1];
|
|
4715
4801
|
}
|
|
4716
4802
|
const range = findRange(resolvedInput, inputRange);
|
|
4717
4803
|
return resolvedInput >= inputRange[range + 1] ? outputRange[range + 1] : outputRange[range];
|
|
@@ -5033,27 +5119,30 @@ function springCalculation({
|
|
|
5033
5119
|
stiffness: config.stiffness ?? defaultSpringConfig.stiffness,
|
|
5034
5120
|
overshootClamping: config.overshootClamping ?? defaultSpringConfig.overshootClamping
|
|
5035
5121
|
};
|
|
5036
|
-
const
|
|
5037
|
-
frame,
|
|
5122
|
+
const configKey = [
|
|
5038
5123
|
fps,
|
|
5039
5124
|
resolvedConfig.damping,
|
|
5040
5125
|
resolvedConfig.mass,
|
|
5041
5126
|
resolvedConfig.overshootClamping,
|
|
5042
5127
|
resolvedConfig.stiffness
|
|
5043
5128
|
].join("-");
|
|
5129
|
+
const cacheKey = `${frame}-${configKey}`;
|
|
5044
5130
|
if (calculationCache[cacheKey]) {
|
|
5045
5131
|
return calculationCache[cacheKey];
|
|
5046
5132
|
}
|
|
5047
|
-
|
|
5133
|
+
const frameClamped = Math.max(0, frame);
|
|
5134
|
+
const previousFrame = Math.ceil(frameClamped) - 1;
|
|
5135
|
+
const previousAnimation = previousFrame >= 0 ? calculationCache[`${previousFrame}-${configKey}`] : undefined;
|
|
5136
|
+
let animation = previousAnimation ?? {
|
|
5048
5137
|
lastTimestamp: 0,
|
|
5049
5138
|
current: from,
|
|
5050
5139
|
toValue: to,
|
|
5051
5140
|
velocity: 0,
|
|
5052
5141
|
prevPosition: 0
|
|
5053
5142
|
};
|
|
5054
|
-
const frameClamped = Math.max(0, frame);
|
|
5055
5143
|
const unevenRest = frameClamped % 1;
|
|
5056
|
-
|
|
5144
|
+
const startFrame = previousAnimation ? previousFrame + 1 : 0;
|
|
5145
|
+
for (let f = startFrame;f <= Math.floor(frameClamped); f++) {
|
|
5057
5146
|
const time = f / fps * 1000;
|
|
5058
5147
|
animation = advance({
|
|
5059
5148
|
animation,
|
|
@@ -5185,7 +5274,7 @@ function spring({
|
|
|
5185
5274
|
frame: durationProcessed,
|
|
5186
5275
|
config
|
|
5187
5276
|
});
|
|
5188
|
-
const inner = config.overshootClamping ?
|
|
5277
|
+
const inner = config.overshootClamping ? Math.min(spr.current, 1) : spr.current;
|
|
5189
5278
|
const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
|
|
5190
5279
|
return interpolated;
|
|
5191
5280
|
}
|
|
@@ -5193,6 +5282,7 @@ function spring({
|
|
|
5193
5282
|
// src/easing.ts
|
|
5194
5283
|
var clampUnit = (t) => Math.min(1, Math.max(0, t));
|
|
5195
5284
|
var springEasingDurationInFrames = 30;
|
|
5285
|
+
var easeBezier = null;
|
|
5196
5286
|
|
|
5197
5287
|
class Easing {
|
|
5198
5288
|
static step0(n) {
|
|
@@ -5205,7 +5295,8 @@ class Easing {
|
|
|
5205
5295
|
return t;
|
|
5206
5296
|
}
|
|
5207
5297
|
static ease(t) {
|
|
5208
|
-
|
|
5298
|
+
easeBezier ??= Easing.bezier(0.42, 0, 1, 1);
|
|
5299
|
+
return easeBezier(t);
|
|
5209
5300
|
}
|
|
5210
5301
|
static quad(t) {
|
|
5211
5302
|
return t * t;
|
|
@@ -5313,23 +5404,23 @@ var MODERN_VALUE = "(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";
|
|
|
5313
5404
|
function modernColorCall(name) {
|
|
5314
5405
|
return new RegExp(name + "\\(\\s*(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")(?:\\s*\\/\\s*(" + MODERN_VALUE + "))?\\s*\\)");
|
|
5315
5406
|
}
|
|
5407
|
+
var cachedMatchers = {
|
|
5408
|
+
rgb: undefined,
|
|
5409
|
+
rgba: undefined,
|
|
5410
|
+
hsl: undefined,
|
|
5411
|
+
hsla: undefined,
|
|
5412
|
+
hex3: undefined,
|
|
5413
|
+
hex4: undefined,
|
|
5414
|
+
hex5: undefined,
|
|
5415
|
+
hex6: undefined,
|
|
5416
|
+
hex8: undefined,
|
|
5417
|
+
oklch: undefined,
|
|
5418
|
+
oklab: undefined,
|
|
5419
|
+
lab: undefined,
|
|
5420
|
+
lch: undefined,
|
|
5421
|
+
hwb: undefined
|
|
5422
|
+
};
|
|
5316
5423
|
function getMatchers() {
|
|
5317
|
-
const cachedMatchers = {
|
|
5318
|
-
rgb: undefined,
|
|
5319
|
-
rgba: undefined,
|
|
5320
|
-
hsl: undefined,
|
|
5321
|
-
hsla: undefined,
|
|
5322
|
-
hex3: undefined,
|
|
5323
|
-
hex4: undefined,
|
|
5324
|
-
hex5: undefined,
|
|
5325
|
-
hex6: undefined,
|
|
5326
|
-
hex8: undefined,
|
|
5327
|
-
oklch: undefined,
|
|
5328
|
-
oklab: undefined,
|
|
5329
|
-
lab: undefined,
|
|
5330
|
-
lch: undefined,
|
|
5331
|
-
hwb: undefined
|
|
5332
|
-
};
|
|
5333
5424
|
if (cachedMatchers.rgb === undefined) {
|
|
5334
5425
|
cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
|
|
5335
5426
|
cachedMatchers.rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
@@ -5418,14 +5509,16 @@ function parseModernComponent(str, percentScale) {
|
|
|
5418
5509
|
function parseHueAngle(str) {
|
|
5419
5510
|
if (str === "none")
|
|
5420
5511
|
return 0;
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
if (str.endsWith("
|
|
5425
|
-
|
|
5426
|
-
if (str.endsWith("turn"))
|
|
5427
|
-
|
|
5428
|
-
|
|
5512
|
+
let degrees = Number.parseFloat(str);
|
|
5513
|
+
if (str.endsWith("grad")) {
|
|
5514
|
+
degrees *= 0.9;
|
|
5515
|
+
} else if (str.endsWith("rad")) {
|
|
5516
|
+
degrees = degrees * 180 / Math.PI;
|
|
5517
|
+
} else if (str.endsWith("turn")) {
|
|
5518
|
+
degrees *= 360;
|
|
5519
|
+
}
|
|
5520
|
+
const normalized = degrees % 360;
|
|
5521
|
+
return normalized < 0 ? (normalized + 360) % 360 : normalized;
|
|
5429
5522
|
}
|
|
5430
5523
|
function parseModernAlpha(str) {
|
|
5431
5524
|
if (str === undefined || str === "none")
|
|
@@ -6002,9 +6095,131 @@ var OverrideIdsToNodePathsSettersContext = createContext26({
|
|
|
6002
6095
|
}
|
|
6003
6096
|
});
|
|
6004
6097
|
|
|
6098
|
+
// src/effects/effect-source-observer.ts
|
|
6099
|
+
import React24, { useLayoutEffect as useLayoutEffect6, useMemo as useMemo18, useState as useState8 } from "react";
|
|
6100
|
+
var observers = new Map;
|
|
6101
|
+
var redrawListeners = new Map;
|
|
6102
|
+
var identities = new WeakMap;
|
|
6103
|
+
var inspectedChains = new WeakMap;
|
|
6104
|
+
var sourceChainOwners = new Map;
|
|
6105
|
+
var useIdentityCommitEffect = React24.useInsertionEffect ?? useLayoutEffect6;
|
|
6106
|
+
var subscribeToEffectSource = ({
|
|
6107
|
+
sequenceKey,
|
|
6108
|
+
effectIndex,
|
|
6109
|
+
onSource
|
|
6110
|
+
}) => {
|
|
6111
|
+
let sequence = observers.get(sequenceKey);
|
|
6112
|
+
if (!sequence) {
|
|
6113
|
+
sequence = new Map;
|
|
6114
|
+
observers.set(sequenceKey, sequence);
|
|
6115
|
+
}
|
|
6116
|
+
let listeners = sequence.get(effectIndex);
|
|
6117
|
+
if (!listeners) {
|
|
6118
|
+
listeners = new Set;
|
|
6119
|
+
sequence.set(effectIndex, listeners);
|
|
6120
|
+
}
|
|
6121
|
+
listeners.add(onSource);
|
|
6122
|
+
redrawListeners.get(sequenceKey)?.forEach((redraw) => redraw());
|
|
6123
|
+
return () => {
|
|
6124
|
+
listeners.delete(onSource);
|
|
6125
|
+
if (listeners.size === 0) {
|
|
6126
|
+
sequence.delete(effectIndex);
|
|
6127
|
+
}
|
|
6128
|
+
if (sequence.size === 0) {
|
|
6129
|
+
observers.delete(sequenceKey);
|
|
6130
|
+
}
|
|
6131
|
+
};
|
|
6132
|
+
};
|
|
6133
|
+
var publishEffectSource = (effect, source, chain) => {
|
|
6134
|
+
if (observers.size === 0) {
|
|
6135
|
+
return;
|
|
6136
|
+
}
|
|
6137
|
+
const identity = identities.get(effect);
|
|
6138
|
+
if (!identity) {
|
|
6139
|
+
return;
|
|
6140
|
+
}
|
|
6141
|
+
const listeners = observers.get(identity.sequenceKey)?.get(identity.effectIndex);
|
|
6142
|
+
if (!listeners || listeners.size === 0) {
|
|
6143
|
+
return;
|
|
6144
|
+
}
|
|
6145
|
+
let inspected = inspectedChains.get(chain);
|
|
6146
|
+
if (!inspected) {
|
|
6147
|
+
inspected = new Map;
|
|
6148
|
+
inspectedChains.set(chain, inspected);
|
|
6149
|
+
}
|
|
6150
|
+
const key = `${identity.sequenceKey}\x00${identity.effectIndex}`;
|
|
6151
|
+
inspected.set(key, identity);
|
|
6152
|
+
sourceChainOwners.set(key, chain);
|
|
6153
|
+
listeners.forEach((listener) => {
|
|
6154
|
+
try {
|
|
6155
|
+
listener(source);
|
|
6156
|
+
} catch {}
|
|
6157
|
+
});
|
|
6158
|
+
};
|
|
6159
|
+
var invalidateEffectChainSources = (chain) => {
|
|
6160
|
+
const inspected = inspectedChains.get(chain);
|
|
6161
|
+
inspectedChains.delete(chain);
|
|
6162
|
+
inspected?.forEach((identity, key) => {
|
|
6163
|
+
if (sourceChainOwners.get(key) !== chain) {
|
|
6164
|
+
return;
|
|
6165
|
+
}
|
|
6166
|
+
sourceChainOwners.delete(key);
|
|
6167
|
+
observers.get(identity.sequenceKey)?.get(identity.effectIndex)?.forEach((listener) => {
|
|
6168
|
+
try {
|
|
6169
|
+
listener(null);
|
|
6170
|
+
} catch {}
|
|
6171
|
+
});
|
|
6172
|
+
});
|
|
6173
|
+
};
|
|
6174
|
+
var useEffectSourceInspection = (effects, sequenceKey) => {
|
|
6175
|
+
const [revision, setRevision] = useState8(0);
|
|
6176
|
+
useLayoutEffect6(() => {
|
|
6177
|
+
if (sequenceKey === null) {
|
|
6178
|
+
return;
|
|
6179
|
+
}
|
|
6180
|
+
let listeners = redrawListeners.get(sequenceKey);
|
|
6181
|
+
if (!listeners) {
|
|
6182
|
+
listeners = new Set;
|
|
6183
|
+
redrawListeners.set(sequenceKey, listeners);
|
|
6184
|
+
}
|
|
6185
|
+
const redraw = () => setRevision((previous) => previous + 1);
|
|
6186
|
+
listeners.add(redraw);
|
|
6187
|
+
if (observers.has(sequenceKey)) {
|
|
6188
|
+
redraw();
|
|
6189
|
+
}
|
|
6190
|
+
return () => {
|
|
6191
|
+
listeners.delete(redraw);
|
|
6192
|
+
if (listeners.size === 0) {
|
|
6193
|
+
redrawListeners.delete(sequenceKey);
|
|
6194
|
+
observers.get(sequenceKey)?.forEach((sourceListeners) => {
|
|
6195
|
+
sourceListeners.forEach((listener) => {
|
|
6196
|
+
try {
|
|
6197
|
+
listener(null);
|
|
6198
|
+
} catch {}
|
|
6199
|
+
});
|
|
6200
|
+
});
|
|
6201
|
+
}
|
|
6202
|
+
};
|
|
6203
|
+
}, [sequenceKey]);
|
|
6204
|
+
useIdentityCommitEffect(() => {
|
|
6205
|
+
if (sequenceKey === null) {
|
|
6206
|
+
return;
|
|
6207
|
+
}
|
|
6208
|
+
effects.forEach((effect, effectIndex) => {
|
|
6209
|
+
identities.set(effect, { sequenceKey, effectIndex });
|
|
6210
|
+
});
|
|
6211
|
+
return () => {
|
|
6212
|
+
effects.forEach((effect) => identities.delete(effect));
|
|
6213
|
+
};
|
|
6214
|
+
}, [effects, sequenceKey]);
|
|
6215
|
+
return useMemo18(() => {
|
|
6216
|
+
return sequenceKey === null || revision === 0 ? effects : effects.slice();
|
|
6217
|
+
}, [effects, revision, sequenceKey]);
|
|
6218
|
+
};
|
|
6219
|
+
|
|
6005
6220
|
// src/effects/use-memoized-effects.ts
|
|
6006
6221
|
var emptyDragOverrides2 = {};
|
|
6007
|
-
var useCacheCommitEffect =
|
|
6222
|
+
var useCacheCommitEffect = React25.useInsertionEffect ?? useLayoutEffect7;
|
|
6008
6223
|
var areEffectParamsEqual = (previous, next) => {
|
|
6009
6224
|
if (Object.is(previous, next)) {
|
|
6010
6225
|
return true;
|
|
@@ -6110,7 +6325,7 @@ var useMemoizedEffectDefinitions = (effects) => {
|
|
|
6110
6325
|
cancelled = true;
|
|
6111
6326
|
};
|
|
6112
6327
|
}, [activityDormant, controllers, effects, stableDefinitions]);
|
|
6113
|
-
|
|
6328
|
+
useLayoutEffect7(() => {
|
|
6114
6329
|
stableDefinitions.forEach((_definition, index) => {
|
|
6115
6330
|
const snapshot = effects[index]?.params;
|
|
6116
6331
|
if (!areEffectParamsEqual(controllers[index].store.getSnapshot(), snapshot)) {
|
|
@@ -6120,12 +6335,11 @@ var useMemoizedEffectDefinitions = (effects) => {
|
|
|
6120
6335
|
}, [controllers, effects, stableDefinitions]);
|
|
6121
6336
|
return stableDefinitions;
|
|
6122
6337
|
};
|
|
6123
|
-
var
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6338
|
+
var getEffectStatusForSequenceStatus = ({
|
|
6339
|
+
status,
|
|
6340
|
+
effectIndex,
|
|
6341
|
+
videoConfigValues
|
|
6127
6342
|
}) => {
|
|
6128
|
-
const status = propStatuses[makeSequencePropsSubscriptionKey(nodePath)];
|
|
6129
6343
|
if (!status) {
|
|
6130
6344
|
return { type: "cannot-update-sequence", reason: "not-found" };
|
|
6131
6345
|
}
|
|
@@ -6141,18 +6355,31 @@ var getEffectPropStatusesCtx = ({
|
|
|
6141
6355
|
}
|
|
6142
6356
|
return {
|
|
6143
6357
|
type: "can-update-effect",
|
|
6144
|
-
props: evaluateSourcePropStatuses(effect.props,
|
|
6358
|
+
props: evaluateSourcePropStatuses(effect.props, videoConfigValues)
|
|
6145
6359
|
};
|
|
6146
6360
|
};
|
|
6147
|
-
var
|
|
6148
|
-
|
|
6361
|
+
var getEffectPropStatusesCtx = ({
|
|
6362
|
+
propStatuses,
|
|
6363
|
+
nodePath,
|
|
6364
|
+
effectIndex
|
|
6365
|
+
}) => {
|
|
6366
|
+
return getEffectStatusForSequenceStatus({
|
|
6367
|
+
status: propStatuses[makeSequencePropsSubscriptionKey(nodePath)] ?? null,
|
|
6368
|
+
effectIndex,
|
|
6369
|
+
videoConfigValues: nodePath.videoConfigValues
|
|
6370
|
+
});
|
|
6371
|
+
};
|
|
6372
|
+
var getPropStatusesForSequenceStatus = (status, videoConfigValues) => {
|
|
6149
6373
|
if (!status) {
|
|
6150
6374
|
return;
|
|
6151
6375
|
}
|
|
6152
6376
|
if (!status.canUpdate) {
|
|
6153
6377
|
return;
|
|
6154
6378
|
}
|
|
6155
|
-
return evaluateSourcePropStatuses(status.props,
|
|
6379
|
+
return evaluateSourcePropStatuses(status.props, videoConfigValues);
|
|
6380
|
+
};
|
|
6381
|
+
var getPropStatusesCtx = (propStatuses, nodePath) => {
|
|
6382
|
+
return getPropStatusesForSequenceStatus(propStatuses[makeSequencePropsSubscriptionKey(nodePath)] ?? null, nodePath.videoConfigValues);
|
|
6156
6383
|
};
|
|
6157
6384
|
var useMemoizedEffects = ({
|
|
6158
6385
|
effects,
|
|
@@ -6160,23 +6387,24 @@ var useMemoizedEffects = ({
|
|
|
6160
6387
|
videoConfigValues
|
|
6161
6388
|
}) => {
|
|
6162
6389
|
const previousRef = useRef7(null);
|
|
6163
|
-
const {
|
|
6390
|
+
const { isStudio } = useRemotionEnvironment();
|
|
6164
6391
|
const { overrideIdToNodePathMappings } = useContext26(OverrideIdsToNodePathsGettersContext);
|
|
6165
6392
|
const previous = previousRef.current;
|
|
6166
6393
|
const nodePath = overrideId ? overrideIdToNodePathMappings[overrideId] ?? null : null;
|
|
6167
6394
|
const effectDragOverrides = useEffectDragOverridesForNodePath(nodePath);
|
|
6168
|
-
const
|
|
6395
|
+
const sequenceStatus = usePropStatusForNodePath(nodePath);
|
|
6396
|
+
const effectPropStatuses = useMemo19(() => Array.from({ length: effects.length }, (_, effectIndex) => {
|
|
6169
6397
|
if (nodePath === null) {
|
|
6170
6398
|
return null;
|
|
6171
6399
|
}
|
|
6172
|
-
const status =
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6400
|
+
const status = getEffectStatusForSequenceStatus({
|
|
6401
|
+
status: sequenceStatus,
|
|
6402
|
+
effectIndex,
|
|
6403
|
+
videoConfigValues
|
|
6176
6404
|
});
|
|
6177
6405
|
return status.type === "can-update-effect" ? status.props : null;
|
|
6178
|
-
}), [effects.length, nodePath,
|
|
6179
|
-
const animatedEffects =
|
|
6406
|
+
}), [effects.length, nodePath, sequenceStatus, videoConfigValues]);
|
|
6407
|
+
const animatedEffects = useMemo19(() => effectPropStatuses.map((status, index) => Object.values(status ?? {}).some((prop) => prop.status === "keyframed") || Object.values(effectDragOverrides[index] ?? emptyDragOverrides2).some((override) => override.type === "keyframed")), [effectDragOverrides, effectPropStatuses]);
|
|
6180
6408
|
const frame = useCurrentFrameWithOptionalSubscription(animatedEffects.some(Boolean));
|
|
6181
6409
|
const prepared = effects.map((descriptor, index) => {
|
|
6182
6410
|
const propStatus = effectPropStatuses[index];
|
|
@@ -6214,7 +6442,7 @@ var useMemoizedEffects = ({
|
|
|
6214
6442
|
useCacheCommitEffect(() => {
|
|
6215
6443
|
previousRef.current = { prepared, effects: next };
|
|
6216
6444
|
}, [next, prepared]);
|
|
6217
|
-
return next;
|
|
6445
|
+
return useEffectSourceInspection(next, isStudio && nodePath !== null ? makeSequencePropsSubscriptionKey({ ...nodePath, videoConfigValues }) : null);
|
|
6218
6446
|
};
|
|
6219
6447
|
|
|
6220
6448
|
// src/flatten-schema.ts
|
|
@@ -6616,11 +6844,11 @@ var mergeValues = ({
|
|
|
6616
6844
|
};
|
|
6617
6845
|
var DisableInteractivityContext = createContext27(false);
|
|
6618
6846
|
var DisableInteractivityProvider = ({ children }) => {
|
|
6619
|
-
return
|
|
6847
|
+
return React26.createElement(DisableInteractivityContext.Provider, { value: true }, children);
|
|
6620
6848
|
};
|
|
6621
6849
|
var EnableInteractivityContext = createContext27(false);
|
|
6622
6850
|
var EnableInteractivityProvider = ({ children }) => {
|
|
6623
|
-
return
|
|
6851
|
+
return React26.createElement(EnableInteractivityContext.Provider, { value: true }, children);
|
|
6624
6852
|
};
|
|
6625
6853
|
var withInteractivitySchema = ({
|
|
6626
6854
|
Component,
|
|
@@ -6645,27 +6873,26 @@ var withInteractivitySchema = ({
|
|
|
6645
6873
|
const disableInteractivity = useContext27(DisableInteractivityContext);
|
|
6646
6874
|
const enableInteractivity = useContext27(EnableInteractivityContext);
|
|
6647
6875
|
if (!env.isStudio && !enableInteractivity || env.isRendering || !canUseRemotionHooks || disableInteractivity) {
|
|
6648
|
-
return
|
|
6876
|
+
return React26.createElement(Component, {
|
|
6649
6877
|
...cleanProps,
|
|
6650
6878
|
controls: null,
|
|
6651
6879
|
ref
|
|
6652
6880
|
});
|
|
6653
6881
|
}
|
|
6654
|
-
const { propStatuses } = useContext27(VisualModePropStatusesContext);
|
|
6655
6882
|
const nodePathMapping = useContext27(OverrideIdsToNodePathsGettersContext);
|
|
6656
6883
|
const videoConfig = useUnsafeVideoConfig();
|
|
6657
6884
|
const durationInFrames = videoConfig?.durationInFrames;
|
|
6658
6885
|
const fps = videoConfig?.fps;
|
|
6659
6886
|
const height = videoConfig?.height;
|
|
6660
6887
|
const width = videoConfig?.width;
|
|
6661
|
-
const videoConfigValues =
|
|
6888
|
+
const videoConfigValues = useMemo20(() => durationInFrames === undefined || fps === undefined || height === undefined || width === undefined ? null : {
|
|
6662
6889
|
durationInFrames,
|
|
6663
6890
|
fps,
|
|
6664
6891
|
height,
|
|
6665
6892
|
width
|
|
6666
6893
|
}, [durationInFrames, fps, height, width]);
|
|
6667
6894
|
const passedControls = cleanProps.controls;
|
|
6668
|
-
const resolvedPassedControls =
|
|
6895
|
+
const resolvedPassedControls = useMemo20(() => {
|
|
6669
6896
|
if (!passedControls || getStackForControls(passedControls) !== null || internalStack === undefined) {
|
|
6670
6897
|
return passedControls;
|
|
6671
6898
|
}
|
|
@@ -6674,13 +6901,13 @@ var withInteractivitySchema = ({
|
|
|
6674
6901
|
return controlsWithStack;
|
|
6675
6902
|
}, [internalStack, passedControls]);
|
|
6676
6903
|
if (resolvedPassedControls) {
|
|
6677
|
-
return
|
|
6904
|
+
return React26.createElement(Component, {
|
|
6678
6905
|
...cleanProps,
|
|
6679
6906
|
controls: resolvedPassedControls,
|
|
6680
6907
|
ref
|
|
6681
6908
|
});
|
|
6682
6909
|
}
|
|
6683
|
-
const [overrideId] =
|
|
6910
|
+
const [overrideId] = useState9(() => {
|
|
6684
6911
|
if (!internalStack) {
|
|
6685
6912
|
return String(Math.random());
|
|
6686
6913
|
}
|
|
@@ -6694,10 +6921,8 @@ var withInteractivitySchema = ({
|
|
|
6694
6921
|
});
|
|
6695
6922
|
const nodePath = env.isReadOnlyStudio ? null : nodePathMapping.overrideIdToNodePathMappings[overrideId] ?? null;
|
|
6696
6923
|
const dragOverrides = useDragOverridesForNodePath(nodePath);
|
|
6697
|
-
const
|
|
6698
|
-
|
|
6699
|
-
videoConfigValues
|
|
6700
|
-
}), [nodePath, propStatuses, videoConfigValues]);
|
|
6924
|
+
const sequenceStatus = usePropStatusForNodePath(nodePath);
|
|
6925
|
+
const propStatus = useMemo20(() => getPropStatusesForSequenceStatus(sequenceStatus, videoConfigValues), [sequenceStatus, videoConfigValues]);
|
|
6701
6926
|
const needsFrame = flatKeys.some((key) => propStatus?.[key]?.status === "keyframed" || dragOverrides[key]?.type === "keyframed");
|
|
6702
6927
|
const frame = useCurrentFrameWithOptionalSubscription(needsFrame);
|
|
6703
6928
|
const runtimeValues = flatKeys.map((key) => getRuntimeValueForSchemaKey({
|
|
@@ -6705,12 +6930,12 @@ var withInteractivitySchema = ({
|
|
|
6705
6930
|
key,
|
|
6706
6931
|
props: cleanProps
|
|
6707
6932
|
}));
|
|
6708
|
-
const currentRuntimeValueDotNotation =
|
|
6709
|
-
const [runtimeValueStore] =
|
|
6710
|
-
|
|
6933
|
+
const currentRuntimeValueDotNotation = useMemo20(() => readValuesFromProps(cleanProps, flatKeys, flatSchema), runtimeValues);
|
|
6934
|
+
const [runtimeValueStore] = useState9(() => createRuntimeValueStore(currentRuntimeValueDotNotation));
|
|
6935
|
+
useLayoutEffect8(() => {
|
|
6711
6936
|
runtimeValueStore.setSnapshot(currentRuntimeValueDotNotation);
|
|
6712
6937
|
}, [currentRuntimeValueDotNotation, runtimeValueStore]);
|
|
6713
|
-
const controls =
|
|
6938
|
+
const controls = useMemo20(() => {
|
|
6714
6939
|
const controlsForRender = {
|
|
6715
6940
|
schema: schemaWithSequenceName,
|
|
6716
6941
|
currentRuntimeValueDotNotation,
|
|
@@ -6730,10 +6955,10 @@ var withInteractivitySchema = ({
|
|
|
6730
6955
|
runtimeValueStore.store,
|
|
6731
6956
|
videoConfigValues
|
|
6732
6957
|
]);
|
|
6733
|
-
|
|
6958
|
+
useLayoutEffect8(() => {
|
|
6734
6959
|
OptimisticSequenceDeletion.register(internalStack ?? null, nodePath);
|
|
6735
6960
|
}, [internalStack, nodePath]);
|
|
6736
|
-
const { merged: valuesDotNotation, propsToDelete } =
|
|
6961
|
+
const { merged: valuesDotNotation, propsToDelete } = useMemo20(() => {
|
|
6737
6962
|
return computeEffectiveSchemaValuesDotNotation({
|
|
6738
6963
|
schema: schemaWithSequenceName,
|
|
6739
6964
|
currentValue: currentRuntimeValueDotNotation,
|
|
@@ -6753,7 +6978,7 @@ var withInteractivitySchema = ({
|
|
|
6753
6978
|
if (OptimisticSequenceDeletion.isDeleted(nodePath, pendingDeletions)) {
|
|
6754
6979
|
return null;
|
|
6755
6980
|
}
|
|
6756
|
-
return
|
|
6981
|
+
return React26.createElement(Component, {
|
|
6757
6982
|
...mergedProps,
|
|
6758
6983
|
controls,
|
|
6759
6984
|
ref
|
|
@@ -6768,6 +6993,23 @@ import { jsx as jsx17 } from "react/jsx-runtime";
|
|
|
6768
6993
|
var SeriesContentVisibilityContext = createContext28(true);
|
|
6769
6994
|
var SequenceContextProvider = withCommittedMetadata(SequenceContext.Provider);
|
|
6770
6995
|
var EMPTY_EFFECTS = [];
|
|
6996
|
+
var getSequenceRegistration = (sequence) => {
|
|
6997
|
+
return sequence;
|
|
6998
|
+
};
|
|
6999
|
+
var getSequenceStack = (stack) => {
|
|
7000
|
+
return stack;
|
|
7001
|
+
};
|
|
7002
|
+
var getSequenceCurrentFrame = (ref) => {
|
|
7003
|
+
return ref.current;
|
|
7004
|
+
};
|
|
7005
|
+
var setSequenceWrapperRef = (ref, wrapperRef, node) => {
|
|
7006
|
+
wrapperRef.current = node;
|
|
7007
|
+
if (typeof ref === "function") {
|
|
7008
|
+
ref(node);
|
|
7009
|
+
} else if (ref) {
|
|
7010
|
+
ref.current = node;
|
|
7011
|
+
}
|
|
7012
|
+
};
|
|
6771
7013
|
var RegularSequenceRefForwardingFunction = ({
|
|
6772
7014
|
from = 0,
|
|
6773
7015
|
trimBefore = 0,
|
|
@@ -6798,7 +7040,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
6798
7040
|
...other
|
|
6799
7041
|
}, ref) => {
|
|
6800
7042
|
const { layout = "absolute-fill" } = other;
|
|
6801
|
-
const [id] =
|
|
7043
|
+
const [id] = useState10(() => String(Math.random()));
|
|
6802
7044
|
const parentSequence = useContext28(SequenceContext);
|
|
6803
7045
|
const activityRequested = useContext28(SequenceActivityContext);
|
|
6804
7046
|
const parentDormant = useContext28(SequenceActivityDormantContext);
|
|
@@ -6882,7 +7124,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
6882
7124
|
if (lastPlaybackRate.current.frame !== absoluteFrame && lastPlaybackRate.current.playbackRate !== playbackRate) {
|
|
6883
7125
|
throw new Error('The "playbackRate" prop of <Sequence /> must be constant. Animating playbackRate is not supported.');
|
|
6884
7126
|
}
|
|
6885
|
-
|
|
7127
|
+
useLayoutEffect9(() => {
|
|
6886
7128
|
lastPlaybackRate.current = { playbackRate, frame: absoluteFrame };
|
|
6887
7129
|
}, [absoluteFrame, playbackRate]);
|
|
6888
7130
|
const videoConfig = useVideoConfig();
|
|
@@ -6913,13 +7155,13 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
6913
7155
|
const sequenceRegistrationEnabled = useContext28(SequenceRegistrationContext);
|
|
6914
7156
|
const canvasOutlinesEnabled = useContext28(SequenceOutlineContext);
|
|
6915
7157
|
const shouldDiscoverOutline = env.isStudio || canvasOutlinesEnabled;
|
|
6916
|
-
const automaticOutlineRef =
|
|
7158
|
+
const automaticOutlineRef = useMemo21(() => shouldDiscoverOutline && layout === "none" ? SequenceOutlineInternals.createRef() : null, [shouldDiscoverOutline, layout]);
|
|
6917
7159
|
const wrapperRefForOutline = useRef8(null);
|
|
6918
7160
|
const refForOutline = layout === "none" ? automaticOutlineRef : wrapperRefForOutline;
|
|
6919
|
-
const premounting =
|
|
7161
|
+
const premounting = useMemo21(() => {
|
|
6920
7162
|
return parentSequence?.premounting || Boolean(other._remotionInternalIsPremounting);
|
|
6921
7163
|
}, [other._remotionInternalIsPremounting, parentSequence?.premounting]);
|
|
6922
|
-
const postmounting =
|
|
7164
|
+
const postmounting = useMemo21(() => {
|
|
6923
7165
|
return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
|
|
6924
7166
|
}, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
|
|
6925
7167
|
const currentSequenceStart = cumulatedFrom + relativeFrom;
|
|
@@ -6927,7 +7169,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
6927
7169
|
const parentFirstFrame = parentSequence ? parentSequenceStart - parentSequence.cumulatedNegativeFrom / parentPlaybackRate : 0;
|
|
6928
7170
|
const firstFrame = Math.max(0, parentFirstFrame, cumulatedFrom + clockFrom / parentPlaybackRate);
|
|
6929
7171
|
const cumulatedNegativeFrom = (currentSequenceStart - firstFrame) * cumulativePlaybackRate;
|
|
6930
|
-
const contextValue =
|
|
7172
|
+
const contextValue = useMemo21(() => {
|
|
6931
7173
|
return {
|
|
6932
7174
|
playbackRate: cumulativePlaybackRate,
|
|
6933
7175
|
absoluteFrom,
|
|
@@ -6960,7 +7202,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
6960
7202
|
postmountDisplay,
|
|
6961
7203
|
cumulatedNegativeFrom
|
|
6962
7204
|
]);
|
|
6963
|
-
const loopContextValue =
|
|
7205
|
+
const loopContextValue = useMemo21(() => {
|
|
6964
7206
|
if (loopPeriod === null) {
|
|
6965
7207
|
return null;
|
|
6966
7208
|
}
|
|
@@ -6969,7 +7211,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
6969
7211
|
durationInFrames: contentDurationInFrames
|
|
6970
7212
|
};
|
|
6971
7213
|
}, [contentDurationInFrames, loopIteration, loopPeriod]);
|
|
6972
|
-
const resolvedLoopDisplay =
|
|
7214
|
+
const resolvedLoopDisplay = useMemo21(() => {
|
|
6973
7215
|
if (loopDisplay || loopPeriod === null) {
|
|
6974
7216
|
return loopDisplay;
|
|
6975
7217
|
}
|
|
@@ -6979,21 +7221,21 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
6979
7221
|
durationInFrames: loopPeriod
|
|
6980
7222
|
};
|
|
6981
7223
|
}, [actualDurationInFrames, loopDisplay, loopPeriod]);
|
|
6982
|
-
const timelineClipName =
|
|
7224
|
+
const timelineClipName = useMemo21(() => {
|
|
6983
7225
|
return name ?? "";
|
|
6984
7226
|
}, [name]);
|
|
6985
7227
|
const resolvedDocumentationLink = documentationLink ?? "https://www.remotion.dev/docs/sequence";
|
|
6986
7228
|
const isInsideSeries = useContext28(IsInsideSeriesContext);
|
|
6987
|
-
const singleChildComponent =
|
|
7229
|
+
const singleChildComponent = useMemo21(() => childComponentOverride === undefined ? getSingleChildComponent(children) : childComponentOverride, [children, childComponentOverride]);
|
|
6988
7230
|
const registrationStack = controls ? getStackForControls(controls) ?? stack ?? null : stack ?? null;
|
|
6989
|
-
const getStack =
|
|
7231
|
+
const getStack = useMemo21(() => getSequenceStack.bind(null, registrationStack), [registrationStack]);
|
|
6990
7232
|
const registeredFrozenFrame = typeof freeze === "number" ? freeze : null;
|
|
6991
7233
|
const currentFrame = registeredFrozenFrame ?? (absoluteFrame - currentSequenceStart) * cumulativePlaybackRate;
|
|
6992
7234
|
const currentFrameRef = useRef8(currentFrame);
|
|
6993
|
-
|
|
7235
|
+
useLayoutEffect9(() => {
|
|
6994
7236
|
currentFrameRef.current = currentFrame;
|
|
6995
7237
|
}, [currentFrame]);
|
|
6996
|
-
const getCurrentFrame =
|
|
7238
|
+
const getCurrentFrame = useMemo21(() => getSequenceCurrentFrame.bind(null, currentFrameRef), [currentFrameRef]);
|
|
6997
7239
|
const registeredTrimBefore = trimBefore === 0 ? null : trimBefore;
|
|
6998
7240
|
const parentCumulatedNegativeFrom = parentSequence?.cumulatedNegativeFrom ?? 0;
|
|
6999
7241
|
const startMediaFrom = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom - cumulatedNegativeFrom : null;
|
|
@@ -7011,8 +7253,8 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
7011
7253
|
const autoDuration = canInferDuration && durationInFrames === undefined;
|
|
7012
7254
|
const isSeriesChild = controlsComponentIdentity === "dev.remotion.remotion.Series.Sequence" || controlsComponentIdentity === "dev.remotion.transitions.TransitionSeries.Sequence" || controlsComponentIdentity === "dev.remotion.transitions.TransitionSeries.Transition" || controlsComponentIdentity === "dev.remotion.transitions.TransitionSeries.Overlay";
|
|
7013
7255
|
const seriesContentVisible = useContext28(SeriesContentVisibilityContext);
|
|
7014
|
-
const effectRuntimeValues =
|
|
7015
|
-
const registrationControls =
|
|
7256
|
+
const effectRuntimeValues = useMemo21(() => _remotionInternalEffects?.runtimeValues ?? null, [_remotionInternalEffects]);
|
|
7257
|
+
const registrationControls = useMemo21(() => {
|
|
7016
7258
|
if (controlsSchema === undefined || controlsRuntimeValues === undefined || controlsOverrideId === undefined || controlsSupportsEffects === undefined || controlsComponentIdentity === undefined || controlsComponentName === undefined || controlsVideoConfigValues === undefined) {
|
|
7017
7259
|
return null;
|
|
7018
7260
|
}
|
|
@@ -7034,7 +7276,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
7034
7276
|
controlsSchema,
|
|
7035
7277
|
controlsSupportsEffects
|
|
7036
7278
|
]);
|
|
7037
|
-
const
|
|
7279
|
+
const sequenceForRegistration = useMemo21(() => {
|
|
7038
7280
|
const trackRegistration = timelineTrack ? {
|
|
7039
7281
|
timelineTrack: {
|
|
7040
7282
|
...timelineTrack,
|
|
@@ -7168,6 +7410,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
7168
7410
|
frozenMediaFrame,
|
|
7169
7411
|
singleChildComponent
|
|
7170
7412
|
]);
|
|
7413
|
+
const getSequenceForRegistration = useMemo21(() => getSequenceRegistration.bind(null, sequenceForRegistration), [sequenceForRegistration]);
|
|
7171
7414
|
const registration = useSequenceRegistration({
|
|
7172
7415
|
getSequence: env.isStudio || sequenceRegistrationEnabled ? getSequenceForRegistration : null,
|
|
7173
7416
|
id
|
|
@@ -7190,7 +7433,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
7190
7433
|
end: cumulatedFrom + (from + actualDurationInFrames) / parentPlaybackRate
|
|
7191
7434
|
} : null);
|
|
7192
7435
|
const renderActivity = activityEnabled && (!activityDormant || admitted || activitySuspended && hadActivity.current);
|
|
7193
|
-
const useCommitEffect =
|
|
7436
|
+
const useCommitEffect = React27.useInsertionEffect ?? useLayoutEffect9;
|
|
7194
7437
|
useCommitEffect(() => {
|
|
7195
7438
|
hadActivity.current = renderActivity;
|
|
7196
7439
|
}, [renderActivity]);
|
|
@@ -7211,15 +7454,8 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
7211
7454
|
bottom: resolvedCropBottom,
|
|
7212
7455
|
style: styleIfThere
|
|
7213
7456
|
});
|
|
7214
|
-
const sequenceRef =
|
|
7215
|
-
|
|
7216
|
-
if (typeof ref === "function") {
|
|
7217
|
-
ref(node);
|
|
7218
|
-
} else if (ref) {
|
|
7219
|
-
ref.current = node;
|
|
7220
|
-
}
|
|
7221
|
-
}, [ref]);
|
|
7222
|
-
const defaultStyle = useMemo20(() => {
|
|
7457
|
+
const sequenceRef = useMemo21(() => setSequenceWrapperRef.bind(null, ref, wrapperRefForOutline), [ref, wrapperRefForOutline]);
|
|
7458
|
+
const defaultStyle = useMemo21(() => {
|
|
7223
7459
|
return {
|
|
7224
7460
|
flexDirection: undefined,
|
|
7225
7461
|
...width ? { width } : {},
|
|
@@ -7233,7 +7469,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
7233
7469
|
if (ref !== null && layout === "none") {
|
|
7234
7470
|
throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
|
|
7235
7471
|
}
|
|
7236
|
-
const metadata =
|
|
7472
|
+
const metadata = useMemo21(() => shouldDiscoverOutline || registration !== null ? {
|
|
7237
7473
|
type: "sequence",
|
|
7238
7474
|
id,
|
|
7239
7475
|
value: registration,
|
|
@@ -7366,7 +7602,7 @@ var SequenceWithoutFrom = withInteractivitySchema({
|
|
|
7366
7602
|
});
|
|
7367
7603
|
|
|
7368
7604
|
// src/AbsoluteFill.tsx
|
|
7369
|
-
import { useCallback as
|
|
7605
|
+
import { useCallback as useCallback6 } from "react";
|
|
7370
7606
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
7371
7607
|
var absoluteFillSchema = {
|
|
7372
7608
|
...baseSchema,
|
|
@@ -7479,7 +7715,7 @@ var AbsoluteFillInner = ({
|
|
|
7479
7715
|
...divProps
|
|
7480
7716
|
}) => {
|
|
7481
7717
|
const videoConfig = useUnsafeVideoConfig();
|
|
7482
|
-
const callbackRef =
|
|
7718
|
+
const callbackRef = useCallback6((element) => {
|
|
7483
7719
|
setRef(ref, element);
|
|
7484
7720
|
}, [ref]);
|
|
7485
7721
|
if (videoConfig === null) {
|
|
@@ -7522,13 +7758,13 @@ addSequenceStackTraces(AbsoluteFill);
|
|
|
7522
7758
|
import {
|
|
7523
7759
|
forwardRef as forwardRef4,
|
|
7524
7760
|
useImperativeHandle as useImperativeHandle2,
|
|
7525
|
-
useLayoutEffect as
|
|
7761
|
+
useLayoutEffect as useLayoutEffect10,
|
|
7526
7762
|
useRef as useRef11,
|
|
7527
|
-
useState as
|
|
7763
|
+
useState as useState11
|
|
7528
7764
|
} from "react";
|
|
7529
7765
|
|
|
7530
7766
|
// src/use-crop-style.ts
|
|
7531
|
-
import { useMemo as
|
|
7767
|
+
import { useMemo as useMemo22 } from "react";
|
|
7532
7768
|
var useCropStyle = ({
|
|
7533
7769
|
cropLeft,
|
|
7534
7770
|
cropRight,
|
|
@@ -7538,7 +7774,7 @@ var useCropStyle = ({
|
|
|
7538
7774
|
componentName
|
|
7539
7775
|
}) => {
|
|
7540
7776
|
validateSequenceCrop({ cropLeft, cropRight, cropTop, cropBottom }, componentName);
|
|
7541
|
-
return
|
|
7777
|
+
return useMemo22(() => {
|
|
7542
7778
|
const cropClipPath = getSequenceCropClipPath({
|
|
7543
7779
|
...resolveSequenceCrop({ cropLeft, cropRight, cropTop, cropBottom }),
|
|
7544
7780
|
style
|
|
@@ -7551,7 +7787,7 @@ var useCropStyle = ({
|
|
|
7551
7787
|
};
|
|
7552
7788
|
|
|
7553
7789
|
// src/animated-image/canvas.tsx
|
|
7554
|
-
import
|
|
7790
|
+
import React29, { useCallback as useCallback7, useImperativeHandle, useMemo as useMemo24, useRef as useRef10 } from "react";
|
|
7555
7791
|
|
|
7556
7792
|
// src/calculate-image-fit.ts
|
|
7557
7793
|
var calculateImageFit = (fit, imageSize, canvasSize) => {
|
|
@@ -7782,6 +8018,7 @@ var createEffectChainState = (width, height) => {
|
|
|
7782
8018
|
};
|
|
7783
8019
|
var cleanupEffectChainState = (state) => {
|
|
7784
8020
|
state.currentRunId++;
|
|
8021
|
+
invalidateEffectChainSources(state);
|
|
7785
8022
|
try {
|
|
7786
8023
|
for (const entry of state.cleanupRegistry) {
|
|
7787
8024
|
entry.definition.cleanup(entry.state);
|
|
@@ -7848,6 +8085,7 @@ var runEffectChainWithoutResize = async ({ state, source, effects, output, width
|
|
|
7848
8085
|
state.pool.assertContextNotLost(dst);
|
|
7849
8086
|
}
|
|
7850
8087
|
const setupState = ensureSetup(state, def, dst);
|
|
8088
|
+
publishEffectSource(eff, currentImage, state);
|
|
7851
8089
|
def.apply({
|
|
7852
8090
|
source: currentImage,
|
|
7853
8091
|
target: dst,
|
|
@@ -7921,7 +8159,7 @@ var runEffectChain = async (options) => {
|
|
|
7921
8159
|
};
|
|
7922
8160
|
|
|
7923
8161
|
// src/effects/use-effect-chain-state.ts
|
|
7924
|
-
import { useEffect as useEffect7, useMemo as
|
|
8162
|
+
import { useEffect as useEffect7, useMemo as useMemo23, useRef as useRef9 } from "react";
|
|
7925
8163
|
var useEffectChainState = (effectsOutputSize = null) => {
|
|
7926
8164
|
const effectWidth = effectsOutputSize?.width;
|
|
7927
8165
|
const effectHeight = effectsOutputSize?.height;
|
|
@@ -7943,7 +8181,7 @@ var useEffectChainState = (effectsOutputSize = null) => {
|
|
|
7943
8181
|
}
|
|
7944
8182
|
};
|
|
7945
8183
|
}, []);
|
|
7946
|
-
return
|
|
8184
|
+
return useMemo23(() => ({
|
|
7947
8185
|
get: (width, height) => {
|
|
7948
8186
|
width = effectWidth ?? width;
|
|
7949
8187
|
height = effectHeight ?? height;
|
|
@@ -7967,13 +8205,13 @@ import { jsx as jsx19 } from "react/jsx-runtime";
|
|
|
7967
8205
|
var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effects, effectsOutputSize, ...props }, ref) => {
|
|
7968
8206
|
const canvasRef = useRef10(null);
|
|
7969
8207
|
const chainState = useEffectChainState(effectsOutputSize);
|
|
7970
|
-
const sourceCanvas =
|
|
8208
|
+
const sourceCanvas = useMemo24(() => {
|
|
7971
8209
|
if (typeof document === "undefined") {
|
|
7972
8210
|
return null;
|
|
7973
8211
|
}
|
|
7974
8212
|
return document.createElement("canvas");
|
|
7975
8213
|
}, []);
|
|
7976
|
-
const draw =
|
|
8214
|
+
const draw = useCallback7((imageData) => {
|
|
7977
8215
|
const canvas = canvasRef.current;
|
|
7978
8216
|
const canvasWidth = width ?? imageData.displayWidth;
|
|
7979
8217
|
const canvasHeight = height ?? imageData.displayHeight;
|
|
@@ -8032,7 +8270,7 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
|
|
|
8032
8270
|
...props
|
|
8033
8271
|
});
|
|
8034
8272
|
};
|
|
8035
|
-
var Canvas =
|
|
8273
|
+
var Canvas = React29.forwardRef(CanvasRefForwardingFunction);
|
|
8036
8274
|
|
|
8037
8275
|
// src/animated-image/create-image-decoder.ts
|
|
8038
8276
|
var createImageDecoder = async ({
|
|
@@ -8122,6 +8360,7 @@ var decodeImage = async ({
|
|
|
8122
8360
|
continue;
|
|
8123
8361
|
}
|
|
8124
8362
|
const item = sortByClosestToCurrentTime[i];
|
|
8363
|
+
item.frame?.close();
|
|
8125
8364
|
item.frame = null;
|
|
8126
8365
|
}
|
|
8127
8366
|
};
|
|
@@ -8308,7 +8547,7 @@ var AnimatedImageContent = forwardRef4(({
|
|
|
8308
8547
|
...props
|
|
8309
8548
|
}, canvasRef) => {
|
|
8310
8549
|
const resolvedSrc = resolveAnimatedImageSource(src);
|
|
8311
|
-
const [decodedImage, setDecodedImage] =
|
|
8550
|
+
const [decodedImage, setDecodedImage] = useState11(null);
|
|
8312
8551
|
const imageDecoder = decodedImage?.decoder ?? null;
|
|
8313
8552
|
const activeDecoderRef = useRef11(null);
|
|
8314
8553
|
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
@@ -8333,8 +8572,8 @@ var AnimatedImageContent = forwardRef4(({
|
|
|
8333
8572
|
}
|
|
8334
8573
|
return c;
|
|
8335
8574
|
}, []);
|
|
8336
|
-
const [initialLoopBehavior] =
|
|
8337
|
-
|
|
8575
|
+
const [initialLoopBehavior] = useState11(() => loopBehavior);
|
|
8576
|
+
useLayoutEffect10(() => {
|
|
8338
8577
|
const decodeHandle = delayRender(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`);
|
|
8339
8578
|
const controller = new AbortController;
|
|
8340
8579
|
let cancelled = false;
|
|
@@ -8392,7 +8631,7 @@ var AnimatedImageContent = forwardRef4(({
|
|
|
8392
8631
|
delayRender,
|
|
8393
8632
|
cancelRender
|
|
8394
8633
|
]);
|
|
8395
|
-
|
|
8634
|
+
useLayoutEffect10(() => {
|
|
8396
8635
|
if (!imageDecoder || !decodedImage || activeDecoderRef.current !== imageDecoder) {
|
|
8397
8636
|
return;
|
|
8398
8637
|
}
|
|
@@ -8570,9 +8809,9 @@ var AnimatedImageWithIntrinsicDuration = (props) => {
|
|
|
8570
8809
|
requestInitRef.current = requestInit;
|
|
8571
8810
|
const onErrorRef = useRef11(props.onError);
|
|
8572
8811
|
onErrorRef.current = props.onError;
|
|
8573
|
-
const [duration, setDuration] =
|
|
8574
|
-
const [failedHandle, setFailedHandle] =
|
|
8575
|
-
|
|
8812
|
+
const [duration, setDuration] = useState11(null);
|
|
8813
|
+
const [failedHandle, setFailedHandle] = useState11(null);
|
|
8814
|
+
useLayoutEffect10(() => {
|
|
8576
8815
|
const handle = delayRender(`Finding duration of <AnimatedImage src="${src}" />`);
|
|
8577
8816
|
const controller = new AbortController;
|
|
8578
8817
|
let cancelled = false;
|
|
@@ -8605,7 +8844,7 @@ var AnimatedImageWithIntrinsicDuration = (props) => {
|
|
|
8605
8844
|
continueRender(handle);
|
|
8606
8845
|
};
|
|
8607
8846
|
}, [cancelRender, continueRender, delayRender, fps, src, trimBefore]);
|
|
8608
|
-
|
|
8847
|
+
useLayoutEffect10(() => {
|
|
8609
8848
|
if (duration !== null) {
|
|
8610
8849
|
continueRender(duration.handle);
|
|
8611
8850
|
}
|
|
@@ -8675,17 +8914,17 @@ var createEffect = (definition) => {
|
|
|
8675
8914
|
return factory;
|
|
8676
8915
|
};
|
|
8677
8916
|
// src/Artifact.tsx
|
|
8678
|
-
import { useContext as useContext29, useLayoutEffect as
|
|
8917
|
+
import { useContext as useContext29, useLayoutEffect as useLayoutEffect12, useState as useState13 } from "react";
|
|
8679
8918
|
|
|
8680
8919
|
// src/RenderAssetManager.tsx
|
|
8681
8920
|
import {
|
|
8682
8921
|
createContext as createContext29,
|
|
8683
|
-
useCallback as
|
|
8922
|
+
useCallback as useCallback8,
|
|
8684
8923
|
useImperativeHandle as useImperativeHandle3,
|
|
8685
|
-
useLayoutEffect as
|
|
8686
|
-
useMemo as
|
|
8924
|
+
useLayoutEffect as useLayoutEffect11,
|
|
8925
|
+
useMemo as useMemo25,
|
|
8687
8926
|
useRef as useRef12,
|
|
8688
|
-
useState as
|
|
8927
|
+
useState as useState12
|
|
8689
8928
|
} from "react";
|
|
8690
8929
|
|
|
8691
8930
|
// src/validation/validate-artifact.ts
|
|
@@ -8731,9 +8970,9 @@ var RenderAssetManager = createContext29({
|
|
|
8731
8970
|
renderAssets: []
|
|
8732
8971
|
});
|
|
8733
8972
|
var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
8734
|
-
const [renderAssets, setRenderAssets] =
|
|
8973
|
+
const [renderAssets, setRenderAssets] = useState12([]);
|
|
8735
8974
|
const renderAssetsRef = useRef12([]);
|
|
8736
|
-
const registerRenderAsset =
|
|
8975
|
+
const registerRenderAsset = useCallback8((renderAsset) => {
|
|
8737
8976
|
validateRenderAsset(renderAsset);
|
|
8738
8977
|
renderAssetsRef.current = [...renderAssetsRef.current, renderAsset];
|
|
8739
8978
|
setRenderAssets(renderAssetsRef.current);
|
|
@@ -8750,11 +8989,11 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
8750
8989
|
};
|
|
8751
8990
|
}, []);
|
|
8752
8991
|
}
|
|
8753
|
-
const unregisterRenderAsset =
|
|
8992
|
+
const unregisterRenderAsset = useCallback8((id) => {
|
|
8754
8993
|
renderAssetsRef.current = renderAssetsRef.current.filter((a) => a.id !== id);
|
|
8755
8994
|
setRenderAssets(renderAssetsRef.current);
|
|
8756
8995
|
}, []);
|
|
8757
|
-
|
|
8996
|
+
useLayoutEffect11(() => {
|
|
8758
8997
|
if (typeof window !== "undefined") {
|
|
8759
8998
|
window.remotion_collectAssets = () => {
|
|
8760
8999
|
const assets = renderAssetsRef.current;
|
|
@@ -8764,7 +9003,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
8764
9003
|
};
|
|
8765
9004
|
}
|
|
8766
9005
|
}, []);
|
|
8767
|
-
const contextValue =
|
|
9006
|
+
const contextValue = useMemo25(() => {
|
|
8768
9007
|
return {
|
|
8769
9008
|
registerRenderAsset,
|
|
8770
9009
|
unregisterRenderAsset,
|
|
@@ -8783,10 +9022,10 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
|
8783
9022
|
const { registerRenderAsset, unregisterRenderAsset } = useContext29(RenderAssetManager);
|
|
8784
9023
|
const env = useRemotionEnvironment();
|
|
8785
9024
|
const frame = useCurrentFrame();
|
|
8786
|
-
const [id] =
|
|
9025
|
+
const [id] = useState13(() => {
|
|
8787
9026
|
return String(Math.random());
|
|
8788
9027
|
});
|
|
8789
|
-
|
|
9028
|
+
useLayoutEffect12(() => {
|
|
8790
9029
|
if (!env.isRendering) {
|
|
8791
9030
|
return;
|
|
8792
9031
|
}
|
|
@@ -8837,7 +9076,7 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
|
8837
9076
|
};
|
|
8838
9077
|
Artifact.Thumbnail = ArtifactThumbnail;
|
|
8839
9078
|
// src/audio/html5-audio.tsx
|
|
8840
|
-
import { forwardRef as forwardRef7, useCallback as
|
|
9079
|
+
import { forwardRef as forwardRef7, useCallback as useCallback15, useContext as useContext44, useMemo as useMemo38 } from "react";
|
|
8841
9080
|
|
|
8842
9081
|
// src/absolute-src.ts
|
|
8843
9082
|
var getAbsoluteSrc = (relativeSrc) => {
|
|
@@ -8879,11 +9118,11 @@ var getMediaTrimAfter = ({
|
|
|
8879
9118
|
};
|
|
8880
9119
|
|
|
8881
9120
|
// src/loop/index.tsx
|
|
8882
|
-
import
|
|
9121
|
+
import React30, { createContext as createContext30, useContext as useContext30, useMemo as useMemo26 } from "react";
|
|
8883
9122
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
8884
9123
|
var LoopTimelineContext = createContext30(null);
|
|
8885
9124
|
var useLoop = () => {
|
|
8886
|
-
return
|
|
9125
|
+
return React30.useContext(LoopContext);
|
|
8887
9126
|
};
|
|
8888
9127
|
var Loop = ({
|
|
8889
9128
|
durationInFrames,
|
|
@@ -8925,20 +9164,20 @@ var Loop = ({
|
|
|
8925
9164
|
const iteration = Math.max(0, Math.min(actualTimes - 1, isAtBoundary ? nearestIteration : Math.floor(loopsElapsed)));
|
|
8926
9165
|
const start = isAtBoundary ? currentFrame : iteration * iterationDurationInFrames;
|
|
8927
9166
|
const from = Math.max(0, Math.min(start, maxFrame));
|
|
8928
|
-
const loopDisplay =
|
|
9167
|
+
const loopDisplay = useMemo26(() => {
|
|
8929
9168
|
return {
|
|
8930
9169
|
numberOfTimes: Math.min(compDuration / iterationDurationInFrames, times),
|
|
8931
9170
|
startOffset: -from,
|
|
8932
9171
|
durationInFrames: iterationDurationInFrames
|
|
8933
9172
|
};
|
|
8934
9173
|
}, [compDuration, from, iterationDurationInFrames, times]);
|
|
8935
|
-
const loopContext =
|
|
9174
|
+
const loopContext = useMemo26(() => {
|
|
8936
9175
|
return {
|
|
8937
9176
|
iteration,
|
|
8938
9177
|
durationInFrames
|
|
8939
9178
|
};
|
|
8940
9179
|
}, [iteration, durationInFrames]);
|
|
8941
|
-
const timelineContext =
|
|
9180
|
+
const timelineContext = useMemo26(() => ({
|
|
8942
9181
|
startFrame: loopStartFrame,
|
|
8943
9182
|
firstVisibleFrame,
|
|
8944
9183
|
endFrame,
|
|
@@ -8982,7 +9221,7 @@ var playbackLogging = ({
|
|
|
8982
9221
|
};
|
|
8983
9222
|
|
|
8984
9223
|
// src/prefetch-state.tsx
|
|
8985
|
-
import { createContext as createContext31, useEffect as useEffect8, useState as
|
|
9224
|
+
import { createContext as createContext31, useEffect as useEffect8, useState as useState14 } from "react";
|
|
8986
9225
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
8987
9226
|
var PreloadContext = createContext31({});
|
|
8988
9227
|
var preloads = {};
|
|
@@ -8992,7 +9231,7 @@ var setPreloads = (updater) => {
|
|
|
8992
9231
|
updaters.forEach((u) => u());
|
|
8993
9232
|
};
|
|
8994
9233
|
var PrefetchProvider = ({ children }) => {
|
|
8995
|
-
const [_preloads, _setPreloads] =
|
|
9234
|
+
const [_preloads, _setPreloads] = useState14(() => preloads);
|
|
8996
9235
|
useEffect8(() => {
|
|
8997
9236
|
const updaterFunction = () => {
|
|
8998
9237
|
_setPreloads(preloads);
|
|
@@ -9035,6 +9274,7 @@ var usePreload = (src) => {
|
|
|
9035
9274
|
}
|
|
9036
9275
|
return preloads[withoutHashFragment];
|
|
9037
9276
|
};
|
|
9277
|
+
var activePrefetches = new Map;
|
|
9038
9278
|
var blobToBase64 = function(blob) {
|
|
9039
9279
|
const reader = new FileReader;
|
|
9040
9280
|
return new Promise((resolve, reject) => {
|
|
@@ -9106,6 +9346,7 @@ var prefetch = (src, options) => {
|
|
|
9106
9346
|
return;
|
|
9107
9347
|
});
|
|
9108
9348
|
const controller = new AbortController;
|
|
9349
|
+
const prefetchId = Symbol("prefetch");
|
|
9109
9350
|
let reader = null;
|
|
9110
9351
|
fetch(srcWithoutHash, {
|
|
9111
9352
|
signal: controller.signal,
|
|
@@ -9145,6 +9386,9 @@ var prefetch = (src, options) => {
|
|
|
9145
9386
|
return URL.createObjectURL(actualBlob);
|
|
9146
9387
|
}).then((url) => {
|
|
9147
9388
|
if (canceled) {
|
|
9389
|
+
if (url && method === "blob-url") {
|
|
9390
|
+
URL.revokeObjectURL(url);
|
|
9391
|
+
}
|
|
9148
9392
|
return;
|
|
9149
9393
|
}
|
|
9150
9394
|
playbackLogging({
|
|
@@ -9154,6 +9398,9 @@ var prefetch = (src, options) => {
|
|
|
9154
9398
|
mountTime: null
|
|
9155
9399
|
});
|
|
9156
9400
|
objectUrl = url;
|
|
9401
|
+
const prefetchesForSrc = activePrefetches.get(srcWithoutHash) ?? new Map;
|
|
9402
|
+
prefetchesForSrc.set(prefetchId, objectUrl);
|
|
9403
|
+
activePrefetches.set(srcWithoutHash, prefetchesForSrc);
|
|
9157
9404
|
setPreloads((p) => ({
|
|
9158
9405
|
...p,
|
|
9159
9406
|
[srcWithoutHash]: objectUrl
|
|
@@ -9167,6 +9414,10 @@ var prefetch = (src, options) => {
|
|
|
9167
9414
|
});
|
|
9168
9415
|
return {
|
|
9169
9416
|
free: () => {
|
|
9417
|
+
if (canceled) {
|
|
9418
|
+
return;
|
|
9419
|
+
}
|
|
9420
|
+
canceled = true;
|
|
9170
9421
|
playbackLogging({
|
|
9171
9422
|
logLevel,
|
|
9172
9423
|
tag: "prefetch",
|
|
@@ -9177,16 +9428,25 @@ var prefetch = (src, options) => {
|
|
|
9177
9428
|
if (method === "blob-url") {
|
|
9178
9429
|
URL.revokeObjectURL(objectUrl);
|
|
9179
9430
|
}
|
|
9431
|
+
const prefetchesForSrc = activePrefetches.get(srcWithoutHash);
|
|
9432
|
+
prefetchesForSrc?.delete(prefetchId);
|
|
9433
|
+
const remainingUrl = prefetchesForSrc ? [...prefetchesForSrc.values()].pop() : undefined;
|
|
9434
|
+
if (prefetchesForSrc?.size === 0) {
|
|
9435
|
+
activePrefetches.delete(srcWithoutHash);
|
|
9436
|
+
}
|
|
9180
9437
|
setPreloads((p) => {
|
|
9438
|
+
if (p[srcWithoutHash] === remainingUrl) {
|
|
9439
|
+
return p;
|
|
9440
|
+
}
|
|
9181
9441
|
const copy = { ...p };
|
|
9182
|
-
|
|
9442
|
+
if (remainingUrl === undefined) {
|
|
9443
|
+
delete copy[srcWithoutHash];
|
|
9444
|
+
} else {
|
|
9445
|
+
copy[srcWithoutHash] = remainingUrl;
|
|
9446
|
+
}
|
|
9183
9447
|
return copy;
|
|
9184
9448
|
});
|
|
9185
9449
|
} else {
|
|
9186
|
-
if (canceled) {
|
|
9187
|
-
return;
|
|
9188
|
-
}
|
|
9189
|
-
canceled = true;
|
|
9190
9450
|
const cancellationError = new Error("free() called");
|
|
9191
9451
|
reject(cancellationError);
|
|
9192
9452
|
try {
|
|
@@ -9309,7 +9569,7 @@ var resolveTrimProps = ({
|
|
|
9309
9569
|
};
|
|
9310
9570
|
|
|
9311
9571
|
// src/video/duration-state.tsx
|
|
9312
|
-
import { createContext as createContext32, useMemo as
|
|
9572
|
+
import { createContext as createContext32, useMemo as useMemo27, useReducer } from "react";
|
|
9313
9573
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
9314
9574
|
var durationReducer = (state, action) => {
|
|
9315
9575
|
switch (action.type) {
|
|
@@ -9327,6 +9587,9 @@ var durationReducer = (state, action) => {
|
|
|
9327
9587
|
return state;
|
|
9328
9588
|
}
|
|
9329
9589
|
};
|
|
9590
|
+
var onMediaDuration = (setDurations, src, durationInSeconds) => {
|
|
9591
|
+
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
9592
|
+
};
|
|
9330
9593
|
var DurationsContext = createContext32({
|
|
9331
9594
|
durations: {},
|
|
9332
9595
|
setDurations: () => {
|
|
@@ -9335,7 +9598,7 @@ var DurationsContext = createContext32({
|
|
|
9335
9598
|
});
|
|
9336
9599
|
var DurationsContextProvider = ({ children }) => {
|
|
9337
9600
|
const [durations, setDurations] = useReducer(durationReducer, {});
|
|
9338
|
-
const value =
|
|
9601
|
+
const value = useMemo27(() => {
|
|
9339
9602
|
return {
|
|
9340
9603
|
durations,
|
|
9341
9604
|
setDurations
|
|
@@ -9348,15 +9611,13 @@ var DurationsContextProvider = ({ children }) => {
|
|
|
9348
9611
|
};
|
|
9349
9612
|
|
|
9350
9613
|
// src/audio/AudioForPreview.tsx
|
|
9351
|
-
import { useCallback as
|
|
9352
|
-
import
|
|
9614
|
+
import { useCallback as useCallback14 } from "react";
|
|
9615
|
+
import React36, {
|
|
9353
9616
|
forwardRef as forwardRef5,
|
|
9354
9617
|
useContext as useContext41,
|
|
9355
|
-
useEffect as useEffect15,
|
|
9356
9618
|
useImperativeHandle as useImperativeHandle4,
|
|
9357
|
-
useMemo as
|
|
9358
|
-
|
|
9359
|
-
useState as useState17
|
|
9619
|
+
useMemo as useMemo35,
|
|
9620
|
+
useState as useState18
|
|
9360
9621
|
} from "react";
|
|
9361
9622
|
|
|
9362
9623
|
// src/get-cross-origin-value.ts
|
|
@@ -9412,18 +9673,18 @@ var random = (seed, dummy) => {
|
|
|
9412
9673
|
};
|
|
9413
9674
|
|
|
9414
9675
|
// src/use-amplification.ts
|
|
9415
|
-
import { useContext as useContext33, useLayoutEffect as
|
|
9676
|
+
import { useContext as useContext33, useLayoutEffect as useLayoutEffect13, useRef as useRef16 } from "react";
|
|
9416
9677
|
|
|
9417
9678
|
// src/audio/shared-audio-tags.tsx
|
|
9418
|
-
import
|
|
9679
|
+
import React33, {
|
|
9419
9680
|
createContext as createContext33,
|
|
9420
9681
|
createRef as createRef2,
|
|
9421
|
-
useCallback as
|
|
9682
|
+
useCallback as useCallback9,
|
|
9422
9683
|
useContext as useContext32,
|
|
9423
9684
|
useEffect as useEffect9,
|
|
9424
|
-
useMemo as
|
|
9685
|
+
useMemo as useMemo29,
|
|
9425
9686
|
useRef as useRef14,
|
|
9426
|
-
useState as
|
|
9687
|
+
useState as useState15
|
|
9427
9688
|
} from "react";
|
|
9428
9689
|
|
|
9429
9690
|
// src/play-and-handle-not-allowed-error.ts
|
|
@@ -9526,7 +9787,7 @@ var makeSharedElementSourceNode = ({
|
|
|
9526
9787
|
};
|
|
9527
9788
|
|
|
9528
9789
|
// src/audio/use-audio-context.ts
|
|
9529
|
-
import { useMemo as
|
|
9790
|
+
import { useMemo as useMemo28, useRef as useRef13 } from "react";
|
|
9530
9791
|
var warned = false;
|
|
9531
9792
|
var warnOnce = (logLevel) => {
|
|
9532
9793
|
if (warned) {
|
|
@@ -9548,7 +9809,7 @@ var useSingletonAudioContext = ({
|
|
|
9548
9809
|
if (sampleRate !== initialSampleRate.current) {
|
|
9549
9810
|
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.`);
|
|
9550
9811
|
}
|
|
9551
|
-
const context =
|
|
9812
|
+
const context = useMemo28(() => {
|
|
9552
9813
|
if (env.isRendering) {
|
|
9553
9814
|
return null;
|
|
9554
9815
|
}
|
|
@@ -9746,9 +10007,9 @@ var SharedAudioContextProvider = ({
|
|
|
9746
10007
|
const isResuming = useRef14(null);
|
|
9747
10008
|
const nextResumeAttemptId = useRef14(0);
|
|
9748
10009
|
const nextResumeIsAutoPlayAttempt = useRef14(false);
|
|
9749
|
-
const audioSyncAnchor =
|
|
10010
|
+
const audioSyncAnchor = useMemo29(() => ({ value: 0 }), []);
|
|
9750
10011
|
const audioSyncAnchorListeners = useRef14([]);
|
|
9751
|
-
const audioSyncAnchorEmitter =
|
|
10012
|
+
const audioSyncAnchorEmitter = useMemo29(() => {
|
|
9752
10013
|
return {
|
|
9753
10014
|
dispatch: (event) => {
|
|
9754
10015
|
audioSyncAnchorListeners.current.forEach((l) => l(event));
|
|
@@ -9765,10 +10026,10 @@ var SharedAudioContextProvider = ({
|
|
|
9765
10026
|
}, []);
|
|
9766
10027
|
const prevEndTimes = useRef14({ scheduledEndTime: null, mediaEndTime: null });
|
|
9767
10028
|
const nodesToResume = useRef14(new Map);
|
|
9768
|
-
const unscheduleAudioNode =
|
|
10029
|
+
const unscheduleAudioNode = useCallback9((node) => {
|
|
9769
10030
|
return nodesToResume.current.delete(node);
|
|
9770
10031
|
}, []);
|
|
9771
|
-
const scheduleAudioNode =
|
|
10032
|
+
const scheduleAudioNode = useMemo29(() => {
|
|
9772
10033
|
return ({
|
|
9773
10034
|
node,
|
|
9774
10035
|
mediaTimestamp,
|
|
@@ -9820,7 +10081,7 @@ var SharedAudioContextProvider = ({
|
|
|
9820
10081
|
};
|
|
9821
10082
|
};
|
|
9822
10083
|
}, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
|
|
9823
|
-
const resume =
|
|
10084
|
+
const resume = useCallback9(() => {
|
|
9824
10085
|
const isAutoPlayAttempt = nextResumeIsAutoPlayAttempt.current;
|
|
9825
10086
|
nextResumeIsAutoPlayAttempt.current = false;
|
|
9826
10087
|
if (!ctxAndGain) {
|
|
@@ -9862,14 +10123,14 @@ var SharedAudioContextProvider = ({
|
|
|
9862
10123
|
};
|
|
9863
10124
|
return resumePromise.catch(() => {});
|
|
9864
10125
|
}, [ctxAndGain, _experimentalKeepAudioContextAlive, logLevel]);
|
|
9865
|
-
const resumeAsAutoPlay =
|
|
10126
|
+
const resumeAsAutoPlay = useCallback9(() => {
|
|
9866
10127
|
nextResumeIsAutoPlayAttempt.current = true;
|
|
9867
10128
|
return resume();
|
|
9868
10129
|
}, [resume]);
|
|
9869
|
-
const getIsResumingAudioContext =
|
|
10130
|
+
const getIsResumingAudioContext = useCallback9(() => {
|
|
9870
10131
|
return isResuming.current?.promise ?? null;
|
|
9871
10132
|
}, []);
|
|
9872
|
-
const suspend =
|
|
10133
|
+
const suspend = useCallback9(() => {
|
|
9873
10134
|
isResuming.current?.abortController.abort();
|
|
9874
10135
|
if (!ctxAndGain) {
|
|
9875
10136
|
return Promise.resolve();
|
|
@@ -9913,7 +10174,7 @@ var SharedAudioContextProvider = ({
|
|
|
9913
10174
|
ctxAndGain.suspend().catch(() => {});
|
|
9914
10175
|
};
|
|
9915
10176
|
}, [ctxAndGain, _experimentalKeepAudioContextAlive]);
|
|
9916
|
-
const audioContextValue =
|
|
10177
|
+
const audioContextValue = useMemo29(() => {
|
|
9917
10178
|
return {
|
|
9918
10179
|
sampleRate,
|
|
9919
10180
|
audioContext: ctxAndGain?.audioContext ?? null,
|
|
@@ -9949,7 +10210,7 @@ var SharedAudioContextProvider = ({
|
|
|
9949
10210
|
};
|
|
9950
10211
|
var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
9951
10212
|
const audios = useRef14([]);
|
|
9952
|
-
const [initialNumberOfAudioTags] =
|
|
10213
|
+
const [initialNumberOfAudioTags] = useState15(numberOfAudioTags);
|
|
9953
10214
|
if (numberOfAudioTags !== initialNumberOfAudioTags) {
|
|
9954
10215
|
throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");
|
|
9955
10216
|
}
|
|
@@ -9959,7 +10220,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
9959
10220
|
const audioCtx = useContext32(SharedAudioContext);
|
|
9960
10221
|
const audioContext = audioCtx?.audioContext ?? null;
|
|
9961
10222
|
const resume = audioCtx?.resume;
|
|
9962
|
-
const [refs] =
|
|
10223
|
+
const [refs] = useState15(() => {
|
|
9963
10224
|
return new Array(numberOfAudioTags).fill(true).map(() => {
|
|
9964
10225
|
const ref = createRef2();
|
|
9965
10226
|
return {
|
|
@@ -9975,7 +10236,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
9975
10236
|
for (const { mediaElementSourceNode } of refs) {
|
|
9976
10237
|
mediaElementSourceNode?.setAudioContext(audioContext);
|
|
9977
10238
|
}
|
|
9978
|
-
const effectToUse =
|
|
10239
|
+
const effectToUse = React33.useInsertionEffect ?? React33.useLayoutEffect;
|
|
9979
10240
|
effectToUse(() => {
|
|
9980
10241
|
return () => {
|
|
9981
10242
|
requestAnimationFrame(() => {
|
|
@@ -9986,7 +10247,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
9986
10247
|
};
|
|
9987
10248
|
}, [refs]);
|
|
9988
10249
|
const takenAudios = useRef14(new Array(numberOfAudioTags).fill(false));
|
|
9989
|
-
const rerenderAudios =
|
|
10250
|
+
const rerenderAudios = useCallback9(() => {
|
|
9990
10251
|
refs.forEach(({ ref, id }) => {
|
|
9991
10252
|
const data = audios.current?.find((a) => a.id === id);
|
|
9992
10253
|
const { current } = ref;
|
|
@@ -10009,7 +10270,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
10009
10270
|
});
|
|
10010
10271
|
});
|
|
10011
10272
|
}, [refs]);
|
|
10012
|
-
const registerAudio =
|
|
10273
|
+
const registerAudio = useCallback9((options) => {
|
|
10013
10274
|
const { aud, audioId, premounting, postmounting } = options;
|
|
10014
10275
|
const found = audios.current?.find((a) => a.audioId === audioId);
|
|
10015
10276
|
if (found) {
|
|
@@ -10038,7 +10299,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
10038
10299
|
rerenderAudios();
|
|
10039
10300
|
return newElem;
|
|
10040
10301
|
}, [numberOfAudioTags, refs, rerenderAudios]);
|
|
10041
|
-
const unregisterAudio =
|
|
10302
|
+
const unregisterAudio = useCallback9((id) => {
|
|
10042
10303
|
const cloned = [...takenAudios.current];
|
|
10043
10304
|
const index = refs.findIndex((r) => r.id === id);
|
|
10044
10305
|
if (index === -1) {
|
|
@@ -10049,7 +10310,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
10049
10310
|
audios.current = audios.current?.filter((a) => a.id !== id);
|
|
10050
10311
|
rerenderAudios();
|
|
10051
10312
|
}, [refs, rerenderAudios]);
|
|
10052
|
-
const updateAudio =
|
|
10313
|
+
const updateAudio = useCallback9(({
|
|
10053
10314
|
aud,
|
|
10054
10315
|
audioId,
|
|
10055
10316
|
id,
|
|
@@ -10083,7 +10344,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
10083
10344
|
rerenderAudios();
|
|
10084
10345
|
}
|
|
10085
10346
|
}, [rerenderAudios]);
|
|
10086
|
-
const playAllAudios =
|
|
10347
|
+
const playAllAudios = useCallback9(() => {
|
|
10087
10348
|
refs.forEach((ref) => {
|
|
10088
10349
|
const audio = audios.current.find((a) => a.el === ref.ref);
|
|
10089
10350
|
if (audio?.premounting) {
|
|
@@ -10101,7 +10362,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
10101
10362
|
});
|
|
10102
10363
|
resume?.();
|
|
10103
10364
|
}, [logLevel, mountTime, refs, env.isPlayer, resume]);
|
|
10104
|
-
const audioTagsValue =
|
|
10365
|
+
const audioTagsValue = useMemo29(() => {
|
|
10105
10366
|
return {
|
|
10106
10367
|
registerAudio,
|
|
10107
10368
|
unregisterAudio,
|
|
@@ -10116,7 +10377,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
10116
10377
|
unregisterAudio,
|
|
10117
10378
|
updateAudio
|
|
10118
10379
|
]);
|
|
10119
|
-
const sharedAudioTagElements =
|
|
10380
|
+
const sharedAudioTagElements = useMemo29(() => {
|
|
10120
10381
|
return refs.map(({ id, ref }) => {
|
|
10121
10382
|
return /* @__PURE__ */ jsx25("audio", {
|
|
10122
10383
|
ref,
|
|
@@ -10133,6 +10394,11 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
|
|
|
10133
10394
|
]
|
|
10134
10395
|
});
|
|
10135
10396
|
};
|
|
10397
|
+
var unregisterSharedAudio = (tagsContext, id) => {
|
|
10398
|
+
if (tagsContext && tagsContext.numberOfAudioTags > 0) {
|
|
10399
|
+
tagsContext.unregisterAudio(id);
|
|
10400
|
+
}
|
|
10401
|
+
};
|
|
10136
10402
|
var useSharedAudio = ({
|
|
10137
10403
|
aud,
|
|
10138
10404
|
audioId,
|
|
@@ -10141,11 +10407,11 @@ var useSharedAudio = ({
|
|
|
10141
10407
|
}) => {
|
|
10142
10408
|
const audioCtx = useContext32(SharedAudioContext);
|
|
10143
10409
|
const tagsCtx = useContext32(SharedAudioTagsContext);
|
|
10144
|
-
const [elem] =
|
|
10410
|
+
const [elem] = useState15(() => {
|
|
10145
10411
|
if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
|
|
10146
10412
|
return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
|
|
10147
10413
|
}
|
|
10148
|
-
const el =
|
|
10414
|
+
const el = React33.createRef();
|
|
10149
10415
|
const mediaElementSourceNode = makeSharedElementSourceNode({
|
|
10150
10416
|
audioContext: audioCtx?.audioContext ?? null,
|
|
10151
10417
|
ref: el
|
|
@@ -10165,7 +10431,7 @@ var useSharedAudio = ({
|
|
|
10165
10431
|
};
|
|
10166
10432
|
});
|
|
10167
10433
|
elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
|
|
10168
|
-
const effectToUse =
|
|
10434
|
+
const effectToUse = React33.useInsertionEffect ?? React33.useLayoutEffect;
|
|
10169
10435
|
if (typeof document !== "undefined") {
|
|
10170
10436
|
effectToUse(() => {
|
|
10171
10437
|
if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
|
|
@@ -10179,11 +10445,7 @@ var useSharedAudio = ({
|
|
|
10179
10445
|
}
|
|
10180
10446
|
}, [aud, tagsCtx, elem.id, audioId, premounting, postmounting]);
|
|
10181
10447
|
effectToUse(() => {
|
|
10182
|
-
return (
|
|
10183
|
-
if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
|
|
10184
|
-
tagsCtx.unregisterAudio(elem.id);
|
|
10185
|
-
}
|
|
10186
|
-
};
|
|
10448
|
+
return unregisterSharedAudio.bind(null, tagsCtx, elem.id);
|
|
10187
10449
|
}, [tagsCtx, elem.id]);
|
|
10188
10450
|
}
|
|
10189
10451
|
return elem;
|
|
@@ -10335,7 +10597,7 @@ var useVolume = ({
|
|
|
10335
10597
|
}
|
|
10336
10598
|
const { audioContext, gainNode: masterGainNode } = sharedAudioContext;
|
|
10337
10599
|
if (typeof window !== "undefined") {
|
|
10338
|
-
|
|
10600
|
+
useLayoutEffect13(() => {
|
|
10339
10601
|
if (!audioContext) {
|
|
10340
10602
|
return;
|
|
10341
10603
|
}
|
|
@@ -10394,8 +10656,36 @@ var useVolume = ({
|
|
|
10394
10656
|
return audioStuffRef;
|
|
10395
10657
|
};
|
|
10396
10658
|
|
|
10659
|
+
// src/use-media-duration.ts
|
|
10660
|
+
import { useEffect as useEffect10, useRef as useRef17 } from "react";
|
|
10661
|
+
var subscribeToMediaDuration = (mediaRef, onDurationRef, src) => {
|
|
10662
|
+
const { current } = mediaRef;
|
|
10663
|
+
if (!current) {
|
|
10664
|
+
return;
|
|
10665
|
+
}
|
|
10666
|
+
if (current.duration) {
|
|
10667
|
+
onDurationRef.current?.(src ?? current.src, current.duration);
|
|
10668
|
+
return;
|
|
10669
|
+
}
|
|
10670
|
+
const onLoadedMetadata = () => {
|
|
10671
|
+
onDurationRef.current?.(src ?? current.src, current.duration);
|
|
10672
|
+
};
|
|
10673
|
+
current.addEventListener("loadedmetadata", onLoadedMetadata);
|
|
10674
|
+
return () => {
|
|
10675
|
+
current.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
10676
|
+
};
|
|
10677
|
+
};
|
|
10678
|
+
var useMediaDuration = (mediaRef, onDuration, src, useCurrentSrc) => {
|
|
10679
|
+
const onDurationRef = useRef17(onDuration);
|
|
10680
|
+
onDurationRef.current = onDuration;
|
|
10681
|
+
useEffect10(subscribeToMediaDuration.bind(null, mediaRef, onDurationRef, useCurrentSrc ? null : src), [mediaRef, src, useCurrentSrc]);
|
|
10682
|
+
};
|
|
10683
|
+
var scheduleMediaSourceCleanup = (cleanup) => {
|
|
10684
|
+
requestAnimationFrame(() => cleanup?.());
|
|
10685
|
+
};
|
|
10686
|
+
|
|
10397
10687
|
// src/use-media-in-timeline.ts
|
|
10398
|
-
import { useCallback as
|
|
10688
|
+
import { useCallback as useCallback10, useContext as useContext35, useMemo as useMemo30 } from "react";
|
|
10399
10689
|
|
|
10400
10690
|
// src/audio/use-audio-frame.ts
|
|
10401
10691
|
import { createContext as createContext34, useContext as useContext34 } from "react";
|
|
@@ -10485,7 +10775,7 @@ var useBasicMediaInTimeline = ({
|
|
|
10485
10775
|
loop
|
|
10486
10776
|
});
|
|
10487
10777
|
const startMediaFrom = 0 - mediaStartsAt + (trimBefore ?? 0);
|
|
10488
|
-
const memoizedResult =
|
|
10778
|
+
const memoizedResult = useMemo30(() => {
|
|
10489
10779
|
return {
|
|
10490
10780
|
duration,
|
|
10491
10781
|
finalDisplayName: displayName ?? getAssetDisplayName(src),
|
|
@@ -10520,8 +10810,8 @@ var useMediaInTimelineRegistration = ({
|
|
|
10520
10810
|
const canvasOutlinesEnabled = useContext35(SequenceOutlineContext);
|
|
10521
10811
|
const { isStudio } = useRemotionEnvironment();
|
|
10522
10812
|
const stack = getStack();
|
|
10523
|
-
const getStackForRegistration =
|
|
10524
|
-
const automaticOutlineRef =
|
|
10813
|
+
const getStackForRegistration = useCallback10(() => stack, [stack]);
|
|
10814
|
+
const automaticOutlineRef = useMemo30(() => mediaType === "video" && (isStudio || canvasOutlinesEnabled) ? SequenceOutlineInternals.createRef() : null, [canvasOutlinesEnabled, isStudio, mediaType]);
|
|
10525
10815
|
const { duration, finalDisplayName } = useBasicMediaInTimeline({
|
|
10526
10816
|
src,
|
|
10527
10817
|
displayName,
|
|
@@ -10533,7 +10823,7 @@ var useMediaInTimelineRegistration = ({
|
|
|
10533
10823
|
loop: false,
|
|
10534
10824
|
muted
|
|
10535
10825
|
});
|
|
10536
|
-
const getSequenceForRegistration =
|
|
10826
|
+
const getSequenceForRegistration = useCallback10(() => {
|
|
10537
10827
|
if (!src) {
|
|
10538
10828
|
throw new Error("No src passed");
|
|
10539
10829
|
}
|
|
@@ -10601,34 +10891,34 @@ var useMediaInTimelineRegistration = ({
|
|
|
10601
10891
|
|
|
10602
10892
|
// src/use-media-playback.ts
|
|
10603
10893
|
import {
|
|
10604
|
-
useCallback as
|
|
10894
|
+
useCallback as useCallback13,
|
|
10605
10895
|
useContext as useContext38,
|
|
10606
|
-
useEffect as
|
|
10607
|
-
useLayoutEffect as
|
|
10608
|
-
useRef as
|
|
10896
|
+
useEffect as useEffect14,
|
|
10897
|
+
useLayoutEffect as useLayoutEffect15,
|
|
10898
|
+
useRef as useRef20
|
|
10609
10899
|
} from "react";
|
|
10610
10900
|
|
|
10611
10901
|
// src/buffer-until-first-frame.ts
|
|
10612
|
-
import { useCallback as
|
|
10902
|
+
import { useCallback as useCallback12, useMemo as useMemo33, useRef as useRef18 } from "react";
|
|
10613
10903
|
|
|
10614
10904
|
// src/use-buffer-state.ts
|
|
10615
|
-
import { useContext as useContext37, useMemo as
|
|
10905
|
+
import { useContext as useContext37, useMemo as useMemo32 } from "react";
|
|
10616
10906
|
|
|
10617
10907
|
// src/buffering.tsx
|
|
10618
|
-
import
|
|
10619
|
-
useCallback as
|
|
10908
|
+
import React34, {
|
|
10909
|
+
useCallback as useCallback11,
|
|
10620
10910
|
useContext as useContext36,
|
|
10621
|
-
useEffect as
|
|
10622
|
-
useLayoutEffect as
|
|
10623
|
-
useMemo as
|
|
10624
|
-
useState as
|
|
10911
|
+
useEffect as useEffect11,
|
|
10912
|
+
useLayoutEffect as useLayoutEffect14,
|
|
10913
|
+
useMemo as useMemo31,
|
|
10914
|
+
useState as useState16
|
|
10625
10915
|
} from "react";
|
|
10626
10916
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
10627
10917
|
var useBufferManager = (logLevel, mountTime, setBuffering, isBuffering) => {
|
|
10628
|
-
const [blockCount, setBlockCount] =
|
|
10918
|
+
const [blockCount, setBlockCount] = useState16(0);
|
|
10629
10919
|
const env = useRemotionEnvironment();
|
|
10630
10920
|
const rendering = env.isRendering;
|
|
10631
|
-
const addBlock =
|
|
10921
|
+
const addBlock = useCallback11(() => {
|
|
10632
10922
|
if (rendering) {
|
|
10633
10923
|
return {
|
|
10634
10924
|
unblock: () => {
|
|
@@ -10648,7 +10938,7 @@ var useBufferManager = (logLevel, mountTime, setBuffering, isBuffering) => {
|
|
|
10648
10938
|
}
|
|
10649
10939
|
};
|
|
10650
10940
|
}, [rendering]);
|
|
10651
|
-
|
|
10941
|
+
useEffect11(() => {
|
|
10652
10942
|
if (rendering) {
|
|
10653
10943
|
return;
|
|
10654
10944
|
}
|
|
@@ -10663,7 +10953,7 @@ var useBufferManager = (logLevel, mountTime, setBuffering, isBuffering) => {
|
|
|
10663
10953
|
}
|
|
10664
10954
|
}, [blockCount]);
|
|
10665
10955
|
if (typeof window !== "undefined") {
|
|
10666
|
-
|
|
10956
|
+
useLayoutEffect14(() => {
|
|
10667
10957
|
if (rendering) {
|
|
10668
10958
|
return;
|
|
10669
10959
|
}
|
|
@@ -10678,9 +10968,9 @@ var useBufferManager = (logLevel, mountTime, setBuffering, isBuffering) => {
|
|
|
10678
10968
|
}
|
|
10679
10969
|
}, [blockCount]);
|
|
10680
10970
|
}
|
|
10681
|
-
return
|
|
10971
|
+
return useMemo31(() => ({ addBlock }), [addBlock]);
|
|
10682
10972
|
};
|
|
10683
|
-
var BufferingContextReact =
|
|
10973
|
+
var BufferingContextReact = React34.createContext(null);
|
|
10684
10974
|
var BufferingProvider = ({ children }) => {
|
|
10685
10975
|
const { logLevel, mountTime } = useContext36(LogLevelContext);
|
|
10686
10976
|
const { isBuffering, setBuffering } = useContext36(SetTimelineContext);
|
|
@@ -10696,7 +10986,7 @@ var useBufferState = () => {
|
|
|
10696
10986
|
const buffer = useContext37(BufferingContextReact);
|
|
10697
10987
|
const logLevel = useLogLevel();
|
|
10698
10988
|
const addBlock = buffer ? buffer.addBlock : null;
|
|
10699
|
-
return
|
|
10989
|
+
return useMemo32(() => ({
|
|
10700
10990
|
delayPlayback: () => {
|
|
10701
10991
|
if (!addBlock) {
|
|
10702
10992
|
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");
|
|
@@ -10731,9 +11021,9 @@ var useBufferUntilFirstFrame = ({
|
|
|
10731
11021
|
logLevel,
|
|
10732
11022
|
mountTime
|
|
10733
11023
|
}) => {
|
|
10734
|
-
const bufferingRef =
|
|
11024
|
+
const bufferingRef = useRef18(false);
|
|
10735
11025
|
const { delayPlayback } = useBufferState();
|
|
10736
|
-
const bufferUntilFirstFrame =
|
|
11026
|
+
const bufferUntilFirstFrame = useCallback12((requestedTime) => {
|
|
10737
11027
|
if (mediaType !== "video") {
|
|
10738
11028
|
return;
|
|
10739
11029
|
}
|
|
@@ -10804,7 +11094,7 @@ var useBufferUntilFirstFrame = ({
|
|
|
10804
11094
|
onVariableFpsVideoDetected,
|
|
10805
11095
|
pauseWhenBuffering
|
|
10806
11096
|
]);
|
|
10807
|
-
return
|
|
11097
|
+
return useMemo33(() => {
|
|
10808
11098
|
return {
|
|
10809
11099
|
isBuffering: () => bufferingRef.current,
|
|
10810
11100
|
bufferUntilFirstFrame
|
|
@@ -10881,9 +11171,9 @@ var getMediaSyncAction = (input) => {
|
|
|
10881
11171
|
};
|
|
10882
11172
|
|
|
10883
11173
|
// src/media-tag-current-time-timestamp.ts
|
|
10884
|
-
import
|
|
11174
|
+
import React35 from "react";
|
|
10885
11175
|
var useCurrentTimeOfMediaTagWithUpdateTimeStamp = (mediaRef) => {
|
|
10886
|
-
const lastUpdate =
|
|
11176
|
+
const lastUpdate = React35.useRef({
|
|
10887
11177
|
time: mediaRef.current?.currentTime ?? 0,
|
|
10888
11178
|
lastUpdate: performance.now()
|
|
10889
11179
|
});
|
|
@@ -10917,7 +11207,7 @@ var seek = ({
|
|
|
10917
11207
|
};
|
|
10918
11208
|
|
|
10919
11209
|
// src/use-media-buffering.ts
|
|
10920
|
-
import { useEffect as
|
|
11210
|
+
import { useEffect as useEffect12, useState as useState17 } from "react";
|
|
10921
11211
|
var useMediaBuffering = ({
|
|
10922
11212
|
element,
|
|
10923
11213
|
shouldBuffer,
|
|
@@ -10928,8 +11218,8 @@ var useMediaBuffering = ({
|
|
|
10928
11218
|
src
|
|
10929
11219
|
}) => {
|
|
10930
11220
|
const buffer = useBufferState();
|
|
10931
|
-
const [isBuffering, setIsBuffering] =
|
|
10932
|
-
|
|
11221
|
+
const [isBuffering, setIsBuffering] = useState17(false);
|
|
11222
|
+
useEffect12(() => {
|
|
10933
11223
|
let cleanupFns = [];
|
|
10934
11224
|
const { current } = element;
|
|
10935
11225
|
if (!current) {
|
|
@@ -11057,15 +11347,15 @@ var useMediaBuffering = ({
|
|
|
11057
11347
|
};
|
|
11058
11348
|
|
|
11059
11349
|
// src/use-request-video-callback-time.ts
|
|
11060
|
-
import { useEffect as
|
|
11350
|
+
import { useEffect as useEffect13, useRef as useRef19 } from "react";
|
|
11061
11351
|
var useRequestVideoCallbackTime = ({
|
|
11062
11352
|
mediaRef,
|
|
11063
11353
|
mediaType,
|
|
11064
11354
|
lastSeek,
|
|
11065
11355
|
onVariableFpsVideoDetected
|
|
11066
11356
|
}) => {
|
|
11067
|
-
const currentTime =
|
|
11068
|
-
|
|
11357
|
+
const currentTime = useRef19(null);
|
|
11358
|
+
useEffect13(() => {
|
|
11069
11359
|
const { current } = mediaRef;
|
|
11070
11360
|
if (current) {
|
|
11071
11361
|
currentTime.current = {
|
|
@@ -11217,12 +11507,12 @@ var useMediaPlayback = ({
|
|
|
11217
11507
|
const playerBuffering = useBuffering();
|
|
11218
11508
|
const { fps } = useVideoConfig();
|
|
11219
11509
|
const mediaTrimBefore = useContext38(Html5MediaTrimContext);
|
|
11220
|
-
const lastSeekDueToShift =
|
|
11221
|
-
const lastSeek =
|
|
11510
|
+
const lastSeekDueToShift = useRef20(null);
|
|
11511
|
+
const lastSeek = useRef20(null);
|
|
11222
11512
|
const logLevel = useLogLevel();
|
|
11223
11513
|
const mountTime = useMountTime();
|
|
11224
|
-
const isVariableFpsVideoMap =
|
|
11225
|
-
const onVariableFpsVideoDetected =
|
|
11514
|
+
const isVariableFpsVideoMap = useRef20({});
|
|
11515
|
+
const onVariableFpsVideoDetected = useCallback13(() => {
|
|
11226
11516
|
if (!src) {
|
|
11227
11517
|
return;
|
|
11228
11518
|
}
|
|
@@ -11271,7 +11561,7 @@ var useMediaPlayback = ({
|
|
|
11271
11561
|
return acceptableTimeshift ?? DEFAULT_ACCEPTABLE_TIMESHIFT_WITH_AMPLIFICATION;
|
|
11272
11562
|
})();
|
|
11273
11563
|
const env = useRemotionEnvironment();
|
|
11274
|
-
|
|
11564
|
+
useLayoutEffect15(() => {
|
|
11275
11565
|
const playbackRateToSet = Math.max(0, playbackRate);
|
|
11276
11566
|
if (mediaRef.current && mediaRef.current.defaultPlaybackRate !== playbackRateToSet) {
|
|
11277
11567
|
mediaRef.current.defaultPlaybackRate = playbackRateToSet;
|
|
@@ -11283,7 +11573,7 @@ var useMediaPlayback = ({
|
|
|
11283
11573
|
mediaRef.current.preservesPitch = preservePitch;
|
|
11284
11574
|
}
|
|
11285
11575
|
}, [mediaRef, playbackRate, preservePitch]);
|
|
11286
|
-
|
|
11576
|
+
useEffect14(() => {
|
|
11287
11577
|
const tagName = mediaType === "audio" ? "<Html5Audio>" : "<Html5Video>";
|
|
11288
11578
|
if (!mediaRef.current) {
|
|
11289
11579
|
throw new Error(`No ${mediaType} ref found`);
|
|
@@ -11426,7 +11716,7 @@ var useMediaPlayback = ({
|
|
|
11426
11716
|
};
|
|
11427
11717
|
|
|
11428
11718
|
// src/use-media-tag.ts
|
|
11429
|
-
import { useContext as useContext39, useEffect as
|
|
11719
|
+
import { useContext as useContext39, useEffect as useEffect15, useRef as useRef21 } from "react";
|
|
11430
11720
|
var useMediaTag = ({
|
|
11431
11721
|
mediaRef,
|
|
11432
11722
|
id,
|
|
@@ -11437,12 +11727,12 @@ var useMediaTag = ({
|
|
|
11437
11727
|
}) => {
|
|
11438
11728
|
const { audioAndVideoTags, isPlaying } = useTimelineContext();
|
|
11439
11729
|
const { subscribePlaying } = useContext39(SetTimelineContext);
|
|
11440
|
-
const isPlayingRef =
|
|
11730
|
+
const isPlayingRef = useRef21(isPlaying);
|
|
11441
11731
|
isPlayingRef.current = isPlaying;
|
|
11442
11732
|
const logLevel = useLogLevel();
|
|
11443
11733
|
const mountTime = useMountTime();
|
|
11444
11734
|
const env = useRemotionEnvironment();
|
|
11445
|
-
|
|
11735
|
+
useEffect15(() => {
|
|
11446
11736
|
const tag = {
|
|
11447
11737
|
id,
|
|
11448
11738
|
play: (reason) => {
|
|
@@ -11500,7 +11790,7 @@ var useMediaTag = ({
|
|
|
11500
11790
|
};
|
|
11501
11791
|
|
|
11502
11792
|
// src/volume-position-state.ts
|
|
11503
|
-
import { createContext as createContext35, useContext as useContext40, useMemo as
|
|
11793
|
+
import { createContext as createContext35, useContext as useContext40, useMemo as useMemo34 } from "react";
|
|
11504
11794
|
var MediaVolumeContext = createContext35({
|
|
11505
11795
|
playerMuted: false,
|
|
11506
11796
|
mediaVolume: 1
|
|
@@ -11516,14 +11806,14 @@ var SetMediaVolumeContext = createContext35({
|
|
|
11516
11806
|
var useMediaVolumeState = () => {
|
|
11517
11807
|
const { mediaVolume } = useContext40(MediaVolumeContext);
|
|
11518
11808
|
const { setMediaVolume } = useContext40(SetMediaVolumeContext);
|
|
11519
|
-
return
|
|
11809
|
+
return useMemo34(() => {
|
|
11520
11810
|
return [mediaVolume, setMediaVolume];
|
|
11521
11811
|
}, [mediaVolume, setMediaVolume]);
|
|
11522
11812
|
};
|
|
11523
11813
|
var usePlayerMutedState = () => {
|
|
11524
11814
|
const { playerMuted } = useContext40(MediaVolumeContext);
|
|
11525
11815
|
const { setPlayerMuted } = useContext40(SetMediaVolumeContext);
|
|
11526
|
-
return
|
|
11816
|
+
return useMemo34(() => {
|
|
11527
11817
|
return [playerMuted, setPlayerMuted];
|
|
11528
11818
|
}, [playerMuted, setPlayerMuted]);
|
|
11529
11819
|
};
|
|
@@ -11595,7 +11885,7 @@ var useMediaAudioState = ({
|
|
|
11595
11885
|
// src/audio/AudioForPreview.tsx
|
|
11596
11886
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
11597
11887
|
var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
11598
|
-
const [initialShouldPreMountAudioElements] =
|
|
11888
|
+
const [initialShouldPreMountAudioElements] = useState18(props.shouldPreMountAudioTags);
|
|
11599
11889
|
if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
|
|
11600
11890
|
throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");
|
|
11601
11891
|
}
|
|
@@ -11645,7 +11935,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
11645
11935
|
requestsVideoFrame: false,
|
|
11646
11936
|
isClientSideRendering: false
|
|
11647
11937
|
});
|
|
11648
|
-
const propsToPass =
|
|
11938
|
+
const propsToPass = useMemo35(() => {
|
|
11649
11939
|
return {
|
|
11650
11940
|
muted: isMutedForPlayback,
|
|
11651
11941
|
src: preloadedSrc,
|
|
@@ -11660,7 +11950,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
11660
11950
|
preloadedSrc,
|
|
11661
11951
|
crossOriginValue
|
|
11662
11952
|
]);
|
|
11663
|
-
const id =
|
|
11953
|
+
const id = useMemo35(() => `audio-${random(src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
|
|
11664
11954
|
src,
|
|
11665
11955
|
sequenceContext?.relativeFrom,
|
|
11666
11956
|
sequenceContext?.cumulatedFrom,
|
|
@@ -11706,36 +11996,14 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
11706
11996
|
volume: userPreferredVolume,
|
|
11707
11997
|
shouldUseWebAudioApi: useWebAudioApi ?? false
|
|
11708
11998
|
});
|
|
11709
|
-
const effectToUse =
|
|
11999
|
+
const effectToUse = React36.useInsertionEffect ?? React36.useLayoutEffect;
|
|
11710
12000
|
effectToUse(() => {
|
|
11711
|
-
return ()
|
|
11712
|
-
requestAnimationFrame(() => {
|
|
11713
|
-
cleanupOnMediaTagUnmount();
|
|
11714
|
-
});
|
|
11715
|
-
};
|
|
12001
|
+
return scheduleMediaSourceCleanup.bind(null, cleanupOnMediaTagUnmount);
|
|
11716
12002
|
}, [cleanupOnMediaTagUnmount]);
|
|
11717
12003
|
useImperativeHandle4(ref, () => {
|
|
11718
12004
|
return audioRef.current;
|
|
11719
12005
|
}, [audioRef]);
|
|
11720
|
-
|
|
11721
|
-
currentOnDurationCallback.current = onDuration;
|
|
11722
|
-
useEffect15(() => {
|
|
11723
|
-
const { current } = audioRef;
|
|
11724
|
-
if (!current) {
|
|
11725
|
-
return;
|
|
11726
|
-
}
|
|
11727
|
-
if (current.duration) {
|
|
11728
|
-
currentOnDurationCallback.current?.(current.src, current.duration);
|
|
11729
|
-
return;
|
|
11730
|
-
}
|
|
11731
|
-
const onLoadedMetadata = () => {
|
|
11732
|
-
currentOnDurationCallback.current?.(current.src, current.duration);
|
|
11733
|
-
};
|
|
11734
|
-
current.addEventListener("loadedmetadata", onLoadedMetadata);
|
|
11735
|
-
return () => {
|
|
11736
|
-
current.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
11737
|
-
};
|
|
11738
|
-
}, [audioRef, src]);
|
|
12006
|
+
useMediaDuration(audioRef, onDuration, src, true);
|
|
11739
12007
|
if (initialShouldPreMountAudioElements) {
|
|
11740
12008
|
return null;
|
|
11741
12009
|
}
|
|
@@ -11759,7 +12027,7 @@ var AudioForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
11759
12027
|
showInTimeline,
|
|
11760
12028
|
loopVolumeCurveBehavior
|
|
11761
12029
|
} = props;
|
|
11762
|
-
const [timelineId] =
|
|
12030
|
+
const [timelineId] = useState18(() => String(Math.random()));
|
|
11763
12031
|
const sequenceContext = useContext41(SequenceContext);
|
|
11764
12032
|
const { isStudio } = useRemotionEnvironment();
|
|
11765
12033
|
const [mediaVolume] = useMediaVolumeState();
|
|
@@ -11774,7 +12042,7 @@ var AudioForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
11774
12042
|
volume: userPreferredVolume,
|
|
11775
12043
|
audioEnabled: true
|
|
11776
12044
|
});
|
|
11777
|
-
const getStack =
|
|
12045
|
+
const getStack = useCallback14(() => {
|
|
11778
12046
|
return _remotionInternalStack ?? null;
|
|
11779
12047
|
}, [_remotionInternalStack]);
|
|
11780
12048
|
const { registration } = useMediaInTimelineRegistration({
|
|
@@ -11791,7 +12059,7 @@ var AudioForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
11791
12059
|
documentationLink: "https://www.remotion.dev/docs/html5-audio",
|
|
11792
12060
|
muted: isMutedForTimeline
|
|
11793
12061
|
});
|
|
11794
|
-
const metadata =
|
|
12062
|
+
const metadata = useMemo35(() => isStudio || registration !== null ? {
|
|
11795
12063
|
type: "sequence",
|
|
11796
12064
|
id: timelineId,
|
|
11797
12065
|
value: registration,
|
|
@@ -11814,18 +12082,18 @@ var AudioForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
11814
12082
|
var AudioForPreview = forwardRef5(AudioForPreviewRefForwardingFunction);
|
|
11815
12083
|
|
|
11816
12084
|
// src/audio/AudioForRendering.tsx
|
|
11817
|
-
import {
|
|
12085
|
+
import React37, {
|
|
11818
12086
|
forwardRef as forwardRef6,
|
|
11819
12087
|
useContext as useContext43,
|
|
11820
12088
|
useEffect as useEffect16,
|
|
11821
12089
|
useImperativeHandle as useImperativeHandle5,
|
|
11822
|
-
useLayoutEffect as
|
|
11823
|
-
useMemo as
|
|
12090
|
+
useLayoutEffect as useLayoutEffect16,
|
|
12091
|
+
useMemo as useMemo37,
|
|
11824
12092
|
useRef as useRef22
|
|
11825
12093
|
} from "react";
|
|
11826
12094
|
|
|
11827
12095
|
// src/use-media-enabled.tsx
|
|
11828
|
-
import { createContext as createContext36, useContext as useContext42, useMemo as
|
|
12096
|
+
import { createContext as createContext36, useContext as useContext42, useMemo as useMemo36 } from "react";
|
|
11829
12097
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
11830
12098
|
var MediaEnabledContext = createContext36(null);
|
|
11831
12099
|
var useVideoEnabled = () => {
|
|
@@ -11853,7 +12121,7 @@ var MediaEnabledProvider = ({
|
|
|
11853
12121
|
videoEnabled,
|
|
11854
12122
|
audioEnabled
|
|
11855
12123
|
}) => {
|
|
11856
|
-
const value =
|
|
12124
|
+
const value = useMemo36(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
|
|
11857
12125
|
return /* @__PURE__ */ jsx28(MediaEnabledContext.Provider, {
|
|
11858
12126
|
value,
|
|
11859
12127
|
children
|
|
@@ -11865,6 +12133,8 @@ import { jsx as jsx29 } from "react/jsx-runtime";
|
|
|
11865
12133
|
var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
11866
12134
|
const audioRef = useRef22(null);
|
|
11867
12135
|
const {
|
|
12136
|
+
registerRenderAsset,
|
|
12137
|
+
unregisterRenderAsset,
|
|
11868
12138
|
volume: volumeProp,
|
|
11869
12139
|
playbackRate,
|
|
11870
12140
|
allowAmplificationDuringRender,
|
|
@@ -11880,7 +12150,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
11880
12150
|
loopVolumeCurveBehavior,
|
|
11881
12151
|
pauseWhenBuffering,
|
|
11882
12152
|
audioStreamIndex,
|
|
11883
|
-
preservePitch
|
|
12153
|
+
preservePitch,
|
|
11884
12154
|
...nativeProps
|
|
11885
12155
|
} = props;
|
|
11886
12156
|
const absoluteFrame = useTimelinePosition();
|
|
@@ -11889,9 +12159,8 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
11889
12159
|
const sequenceContext = useContext43(SequenceContext);
|
|
11890
12160
|
const sequencePlaybackRate = sequenceContext?.playbackRate ?? 1;
|
|
11891
12161
|
const audioStartFrame = useContext43(Html5MediaTrimContext);
|
|
11892
|
-
const { registerRenderAsset, unregisterRenderAsset } = useContext43(RenderAssetManager);
|
|
11893
12162
|
const { delayRender, continueRender } = useDelayRender();
|
|
11894
|
-
const id =
|
|
12163
|
+
const id = useMemo37(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
|
|
11895
12164
|
props.src,
|
|
11896
12165
|
sequenceContext?.relativeFrom,
|
|
11897
12166
|
sequenceContext?.cumulatedFrom,
|
|
@@ -11929,7 +12198,8 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
11929
12198
|
playbackRate: (props.playbackRate ?? 1) * sequencePlaybackRate,
|
|
11930
12199
|
toneFrequency: toneFrequency ?? 1,
|
|
11931
12200
|
audioStartFrame,
|
|
11932
|
-
audioStreamIndex: audioStreamIndex ?? 0
|
|
12201
|
+
audioStreamIndex: audioStreamIndex ?? 0,
|
|
12202
|
+
preservePitch: preservePitch ?? true
|
|
11933
12203
|
});
|
|
11934
12204
|
return () => unregisterRenderAsset(id);
|
|
11935
12205
|
}, [
|
|
@@ -11947,11 +12217,12 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
11947
12217
|
toneFrequency,
|
|
11948
12218
|
audioStartFrame,
|
|
11949
12219
|
sequencePlaybackRate,
|
|
11950
|
-
audioStreamIndex
|
|
12220
|
+
audioStreamIndex,
|
|
12221
|
+
preservePitch
|
|
11951
12222
|
]);
|
|
11952
12223
|
const { src } = props;
|
|
11953
12224
|
const needsToRenderAudioTag = ref || _remotionInternalNeedsDurationCalculation;
|
|
11954
|
-
|
|
12225
|
+
useLayoutEffect16(() => {
|
|
11955
12226
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
11956
12227
|
return;
|
|
11957
12228
|
}
|
|
@@ -11997,7 +12268,16 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
11997
12268
|
onError: onNativeError
|
|
11998
12269
|
});
|
|
11999
12270
|
};
|
|
12000
|
-
var
|
|
12271
|
+
var MemoAudioForRendering = React37.memo(forwardRef6(AudioForRenderingRefForwardingFunction));
|
|
12272
|
+
var AudioForRendering = forwardRef6((props, ref) => {
|
|
12273
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext43(RenderAssetManager);
|
|
12274
|
+
return /* @__PURE__ */ jsx29(MemoAudioForRendering, {
|
|
12275
|
+
...props,
|
|
12276
|
+
ref,
|
|
12277
|
+
registerRenderAsset,
|
|
12278
|
+
unregisterRenderAsset
|
|
12279
|
+
});
|
|
12280
|
+
});
|
|
12001
12281
|
|
|
12002
12282
|
// src/audio/html5-audio.tsx
|
|
12003
12283
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
@@ -12033,7 +12313,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
12033
12313
|
throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
12034
12314
|
}
|
|
12035
12315
|
const preloadedSrc = usePreload(props.src);
|
|
12036
|
-
const onError =
|
|
12316
|
+
const onError = useCallback15((e) => {
|
|
12037
12317
|
console.log(e.currentTarget.error);
|
|
12038
12318
|
const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
|
|
12039
12319
|
if (loop) {
|
|
@@ -12047,9 +12327,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
12047
12327
|
console.warn(errMessage);
|
|
12048
12328
|
}
|
|
12049
12329
|
}, [loop, onRemotionError, preloadedSrc]);
|
|
12050
|
-
const onDuration =
|
|
12051
|
-
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
12052
|
-
}, [setDurations]);
|
|
12330
|
+
const onDuration = useMemo38(() => onMediaDuration.bind(null, setDurations), [setDurations]);
|
|
12053
12331
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props.src)];
|
|
12054
12332
|
validateMediaTrimProps({ startFrom, endAt, trimBefore, trimAfter });
|
|
12055
12333
|
if (durationInFrames !== undefined) {
|
|
@@ -12144,12 +12422,12 @@ var Audio = Html5Audio;
|
|
|
12144
12422
|
// src/effects/Solid.tsx
|
|
12145
12423
|
import {
|
|
12146
12424
|
forwardRef as forwardRef8,
|
|
12147
|
-
useCallback as
|
|
12425
|
+
useCallback as useCallback16,
|
|
12148
12426
|
useEffect as useEffect17,
|
|
12149
12427
|
useImperativeHandle as useImperativeHandle6,
|
|
12150
|
-
useMemo as
|
|
12428
|
+
useMemo as useMemo39,
|
|
12151
12429
|
useRef as useRef23,
|
|
12152
|
-
useState as
|
|
12430
|
+
useState as useState19
|
|
12153
12431
|
} from "react";
|
|
12154
12432
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
12155
12433
|
var resolveSolidPixelDensity = (pixelDensity) => {
|
|
@@ -12217,13 +12495,13 @@ var SolidInner = ({
|
|
|
12217
12495
|
const resolvedPixelDensity = resolveSolidPixelDensity(pixelDensity);
|
|
12218
12496
|
const canvasWidth = Math.ceil(width * resolvedPixelDensity);
|
|
12219
12497
|
const canvasHeight = Math.ceil(height * resolvedPixelDensity);
|
|
12220
|
-
const [outputCanvas, setOutputCanvas] =
|
|
12498
|
+
const [outputCanvas, setOutputCanvas] = useState19(null);
|
|
12221
12499
|
const memoizedEffects = useMemoizedEffects({
|
|
12222
12500
|
effects,
|
|
12223
12501
|
overrideId: overrideId ?? null,
|
|
12224
12502
|
videoConfigValues
|
|
12225
12503
|
});
|
|
12226
|
-
const sourceCanvas =
|
|
12504
|
+
const sourceCanvas = useMemo39(() => {
|
|
12227
12505
|
if (typeof document === "undefined") {
|
|
12228
12506
|
return null;
|
|
12229
12507
|
}
|
|
@@ -12233,7 +12511,7 @@ var SolidInner = ({
|
|
|
12233
12511
|
return canvas;
|
|
12234
12512
|
}, []);
|
|
12235
12513
|
const chainState = useEffectChainState(effectsOutputSize);
|
|
12236
|
-
const canvasRef =
|
|
12514
|
+
const canvasRef = useCallback16((canvas) => {
|
|
12237
12515
|
setOutputCanvas(canvas);
|
|
12238
12516
|
if (typeof reference === "function") {
|
|
12239
12517
|
reference(canvas);
|
|
@@ -12291,7 +12569,7 @@ var SolidInner = ({
|
|
|
12291
12569
|
cancelRender,
|
|
12292
12570
|
memoizedEffects
|
|
12293
12571
|
]);
|
|
12294
|
-
const canvasStyle =
|
|
12572
|
+
const canvasStyle = useMemo39(() => {
|
|
12295
12573
|
return {
|
|
12296
12574
|
width,
|
|
12297
12575
|
height,
|
|
@@ -12424,13 +12702,69 @@ addSequenceStackTraces(Solid);
|
|
|
12424
12702
|
import {
|
|
12425
12703
|
createContext as createContext37,
|
|
12426
12704
|
forwardRef as forwardRef9,
|
|
12427
|
-
useCallback as
|
|
12705
|
+
useCallback as useCallback17,
|
|
12428
12706
|
useContext as useContext45,
|
|
12429
|
-
useLayoutEffect as
|
|
12430
|
-
useMemo as
|
|
12707
|
+
useLayoutEffect as useLayoutEffect17,
|
|
12708
|
+
useMemo as useMemo40,
|
|
12431
12709
|
useRef as useRef24
|
|
12432
12710
|
} from "react";
|
|
12711
|
+
|
|
12712
|
+
// src/HtmlInCanvasFallback.tsx
|
|
12433
12713
|
import { jsx as jsx32, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
12714
|
+
var HtmlInCanvasFallback = ({ children, style, label }) => {
|
|
12715
|
+
const currentScale = useCurrentScale({ dontThrowIfOutsideOfRemotion: true });
|
|
12716
|
+
const scale = currentScale > 0 ? currentScale : 1;
|
|
12717
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
12718
|
+
style: { position: "relative", ...style },
|
|
12719
|
+
children: [
|
|
12720
|
+
children,
|
|
12721
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
12722
|
+
className: "css-reset",
|
|
12723
|
+
style: {
|
|
12724
|
+
position: "absolute",
|
|
12725
|
+
top: 8 / scale,
|
|
12726
|
+
right: 8 / scale,
|
|
12727
|
+
zIndex: 1000,
|
|
12728
|
+
transform: `scale(${1 / scale})`,
|
|
12729
|
+
transformOrigin: "top right",
|
|
12730
|
+
maxWidth: `calc(${scale * 100}% - 16px)`,
|
|
12731
|
+
padding: "8px 10px",
|
|
12732
|
+
borderRadius: 6,
|
|
12733
|
+
border: "1px solid #7f3540",
|
|
12734
|
+
backgroundColor: "#2b171c",
|
|
12735
|
+
boxShadow: "0 2px 8px #0003",
|
|
12736
|
+
pointerEvents: "none",
|
|
12737
|
+
textAlign: "left"
|
|
12738
|
+
},
|
|
12739
|
+
children: [
|
|
12740
|
+
/* @__PURE__ */ jsx32("div", {
|
|
12741
|
+
style: {
|
|
12742
|
+
fontFamily: "Arial, Helvetica, sans-serif",
|
|
12743
|
+
fontSize: 12,
|
|
12744
|
+
fontWeight: 600,
|
|
12745
|
+
lineHeight: 1.5,
|
|
12746
|
+
color: "#ffabb5"
|
|
12747
|
+
},
|
|
12748
|
+
children: "HTML-in-canvas is not available"
|
|
12749
|
+
}),
|
|
12750
|
+
/* @__PURE__ */ jsx32("div", {
|
|
12751
|
+
style: {
|
|
12752
|
+
fontFamily: "Arial, Helvetica, sans-serif",
|
|
12753
|
+
fontSize: 11,
|
|
12754
|
+
fontWeight: 400,
|
|
12755
|
+
lineHeight: 1.5,
|
|
12756
|
+
color: "#e8bdc3"
|
|
12757
|
+
},
|
|
12758
|
+
children: label
|
|
12759
|
+
})
|
|
12760
|
+
]
|
|
12761
|
+
})
|
|
12762
|
+
]
|
|
12763
|
+
});
|
|
12764
|
+
};
|
|
12765
|
+
|
|
12766
|
+
// src/HtmlInCanvas.tsx
|
|
12767
|
+
import { jsx as jsx33, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
12434
12768
|
var transferredOffscreenCanvases = new WeakMap;
|
|
12435
12769
|
var getTransferredOffscreenCanvas = (canvas) => {
|
|
12436
12770
|
const existing = transferredOffscreenCanvases.get(canvas);
|
|
@@ -12538,6 +12872,16 @@ var defaultOnPaint = ({
|
|
|
12538
12872
|
ctx.drawElementImage(elementImage, 0, 0);
|
|
12539
12873
|
};
|
|
12540
12874
|
var HtmlInCanvasAncestorContext = createContext37(null);
|
|
12875
|
+
var useHtmlInCanvasUnsupportedMessage = () => {
|
|
12876
|
+
const ancestorPaintState = useContext45(HtmlInCanvasAncestorContext);
|
|
12877
|
+
if (!isHtmlInCanvasSupported()) {
|
|
12878
|
+
return getHtmlInCanvasUnsupportedMessage();
|
|
12879
|
+
}
|
|
12880
|
+
if (ancestorPaintState && !isHtmlInCanvasNestingSupported()) {
|
|
12881
|
+
return `Nested <HtmlInCanvas> components require Chrome ${MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS} or newer with HTML-in-canvas enabled.`;
|
|
12882
|
+
}
|
|
12883
|
+
return null;
|
|
12884
|
+
};
|
|
12541
12885
|
var HtmlInCanvasContent = forwardRef9(({
|
|
12542
12886
|
width,
|
|
12543
12887
|
height,
|
|
@@ -12573,7 +12917,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12573
12917
|
const paintTargetRef = useRef24(null);
|
|
12574
12918
|
const divRef = useRef24(null);
|
|
12575
12919
|
const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}-${paintTargetMode}`;
|
|
12576
|
-
const paintState =
|
|
12920
|
+
const paintState = useMemo40(() => {
|
|
12577
12921
|
const state = {
|
|
12578
12922
|
pendingChildren: 0,
|
|
12579
12923
|
generation: 0,
|
|
@@ -12604,7 +12948,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12604
12948
|
};
|
|
12605
12949
|
return state;
|
|
12606
12950
|
}, [continueRender, delayRender, ancestorPaintState]);
|
|
12607
|
-
const setVisibleCanvasRef =
|
|
12951
|
+
const setVisibleCanvasRef = useCallback17((node) => {
|
|
12608
12952
|
if (paintTargetMode === "copied") {
|
|
12609
12953
|
outputCanvasRef.current = node;
|
|
12610
12954
|
} else {
|
|
@@ -12633,7 +12977,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12633
12977
|
const unmountedRef = useRef24(false);
|
|
12634
12978
|
const effectScratchCanvasesRef = useRef24(null);
|
|
12635
12979
|
const paintingTargets = useRef24(new WeakMap);
|
|
12636
|
-
const onPaintCb =
|
|
12980
|
+
const onPaintCb = useCallback17(async () => {
|
|
12637
12981
|
if (isRendering && paintState.pendingChildren > 0) {
|
|
12638
12982
|
return;
|
|
12639
12983
|
}
|
|
@@ -12838,13 +13182,13 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12838
13182
|
paintState,
|
|
12839
13183
|
ancestorPaintState
|
|
12840
13184
|
]);
|
|
12841
|
-
|
|
13185
|
+
useLayoutEffect17(() => {
|
|
12842
13186
|
return () => {
|
|
12843
13187
|
paintState.release?.();
|
|
12844
13188
|
paintState.release = null;
|
|
12845
13189
|
};
|
|
12846
13190
|
}, [paintState]);
|
|
12847
|
-
|
|
13191
|
+
useLayoutEffect17(() => {
|
|
12848
13192
|
const placeholder = canvas2dRef.current;
|
|
12849
13193
|
if (!placeholder) {
|
|
12850
13194
|
throw new Error("Canvas not found");
|
|
@@ -12872,7 +13216,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12872
13216
|
};
|
|
12873
13217
|
}, [onPaintCb, cancelRender, canvasWidth, canvasHeight, paintTargetMode]);
|
|
12874
13218
|
const onPaintChangedRef = useRef24(false);
|
|
12875
|
-
|
|
13219
|
+
useLayoutEffect17(() => {
|
|
12876
13220
|
if (!onPaintChangedRef.current) {
|
|
12877
13221
|
onPaintChangedRef.current = true;
|
|
12878
13222
|
return;
|
|
@@ -12883,7 +13227,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12883
13227
|
}
|
|
12884
13228
|
canvas.requestPaint?.();
|
|
12885
13229
|
}, [onPaint, memoizedEffects]);
|
|
12886
|
-
|
|
13230
|
+
useLayoutEffect17(() => {
|
|
12887
13231
|
const canvas = canvas2dRef.current;
|
|
12888
13232
|
if (!canvas) {
|
|
12889
13233
|
return;
|
|
@@ -12910,23 +13254,23 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12910
13254
|
isRendering,
|
|
12911
13255
|
ancestorPaintState
|
|
12912
13256
|
]);
|
|
12913
|
-
const innerStyle =
|
|
13257
|
+
const innerStyle = useMemo40(() => {
|
|
12914
13258
|
return {
|
|
12915
13259
|
width,
|
|
12916
13260
|
height
|
|
12917
13261
|
};
|
|
12918
13262
|
}, [width, height]);
|
|
12919
|
-
const canvasStyle =
|
|
13263
|
+
const canvasStyle = useMemo40(() => {
|
|
12920
13264
|
return {
|
|
12921
13265
|
width,
|
|
12922
13266
|
height,
|
|
12923
13267
|
...style ?? {}
|
|
12924
13268
|
};
|
|
12925
13269
|
}, [height, style, width]);
|
|
12926
|
-
return /* @__PURE__ */
|
|
13270
|
+
return /* @__PURE__ */ jsxs4(HtmlInCanvasAncestorContext.Provider, {
|
|
12927
13271
|
value: paintState,
|
|
12928
13272
|
children: [
|
|
12929
|
-
/* @__PURE__ */
|
|
13273
|
+
/* @__PURE__ */ jsx33("canvas", {
|
|
12930
13274
|
ref: paintTargetMode === "copied" ? canvas2dRef : setVisibleCanvasRef,
|
|
12931
13275
|
width: canvasWidth,
|
|
12932
13276
|
height: canvasHeight,
|
|
@@ -12936,10 +13280,10 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12936
13280
|
visibility: "hidden",
|
|
12937
13281
|
pointerEvents: "none"
|
|
12938
13282
|
} : canvasStyle,
|
|
12939
|
-
children: /* @__PURE__ */
|
|
13283
|
+
children: /* @__PURE__ */ jsxs4(DefaultPremountContext.Provider, {
|
|
12940
13284
|
value: 0,
|
|
12941
13285
|
children: [
|
|
12942
|
-
/* @__PURE__ */
|
|
13286
|
+
/* @__PURE__ */ jsx33("div", {
|
|
12943
13287
|
ref: divRef,
|
|
12944
13288
|
style: paintTargetMode === "copied" ? { ...innerStyle, visibility: "visible" } : innerStyle,
|
|
12945
13289
|
children
|
|
@@ -12948,7 +13292,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12948
13292
|
]
|
|
12949
13293
|
})
|
|
12950
13294
|
}, canvasSizeKey),
|
|
12951
|
-
paintTargetMode === "copied" ? /* @__PURE__ */
|
|
13295
|
+
paintTargetMode === "copied" ? /* @__PURE__ */ jsx33("canvas", {
|
|
12952
13296
|
ref: setVisibleCanvasRef,
|
|
12953
13297
|
width: canvasWidth,
|
|
12954
13298
|
height: canvasHeight,
|
|
@@ -12960,7 +13304,7 @@ var HtmlInCanvasContent = forwardRef9(({
|
|
|
12960
13304
|
HtmlInCanvasContent.displayName = "HtmlInCanvasContent";
|
|
12961
13305
|
var HtmlInCanvasContentForRendering = forwardRef9((props, ref) => {
|
|
12962
13306
|
const frame = useCurrentFrame();
|
|
12963
|
-
return /* @__PURE__ */
|
|
13307
|
+
return /* @__PURE__ */ jsx33(HtmlInCanvasContent, {
|
|
12964
13308
|
...props,
|
|
12965
13309
|
ref,
|
|
12966
13310
|
renderFrame: frame
|
|
@@ -12977,6 +13321,7 @@ var HtmlInCanvasInner = forwardRef9(({
|
|
|
12977
13321
|
onInit,
|
|
12978
13322
|
pixelDensity,
|
|
12979
13323
|
_remotionInternalCanvasSiblings,
|
|
13324
|
+
_remotionInternalFallbackLabel = "Effects are not visible",
|
|
12980
13325
|
controls,
|
|
12981
13326
|
style,
|
|
12982
13327
|
cropLeft,
|
|
@@ -12992,10 +13337,13 @@ var HtmlInCanvasInner = forwardRef9(({
|
|
|
12992
13337
|
...sequenceProps
|
|
12993
13338
|
}, ref) => {
|
|
12994
13339
|
const { isRendering } = useRemotionEnvironment();
|
|
13340
|
+
const unsupportedMessage = useHtmlInCanvasUnsupportedMessage();
|
|
13341
|
+
assertHtmlInCanvasDimensions(width, height);
|
|
13342
|
+
resolveHtmlInCanvasPixelDensity(pixelDensity);
|
|
12995
13343
|
const Content = isRendering ? HtmlInCanvasContentForRendering : HtmlInCanvasContent;
|
|
12996
13344
|
const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
|
|
12997
13345
|
const actualRef = useRef24(null);
|
|
12998
|
-
const setCanvasRef =
|
|
13346
|
+
const setCanvasRef = useCallback17((node) => {
|
|
12999
13347
|
actualRef.current = node;
|
|
13000
13348
|
if (typeof ref === "function") {
|
|
13001
13349
|
ref(node);
|
|
@@ -13033,11 +13381,11 @@ var HtmlInCanvasInner = forwardRef9(({
|
|
|
13033
13381
|
style: premountingStyle,
|
|
13034
13382
|
componentName: "<HtmlInCanvas />"
|
|
13035
13383
|
});
|
|
13036
|
-
return /* @__PURE__ */
|
|
13384
|
+
return /* @__PURE__ */ jsx33(Freeze, {
|
|
13037
13385
|
frame: freezeFrame,
|
|
13038
13386
|
active: isPremountingOrPostmounting,
|
|
13039
13387
|
_remotionInternalIsPremounting: premountingActive,
|
|
13040
|
-
children: /* @__PURE__ */
|
|
13388
|
+
children: /* @__PURE__ */ jsx33(Sequence, {
|
|
13041
13389
|
layout: "none",
|
|
13042
13390
|
durationInFrames,
|
|
13043
13391
|
name: name ?? "<HtmlInCanvas>",
|
|
@@ -13049,7 +13397,17 @@ var HtmlInCanvasInner = forwardRef9(({
|
|
|
13049
13397
|
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
13050
13398
|
_remotionInternalIsPremounting: premountingActive,
|
|
13051
13399
|
_remotionInternalIsPostmounting: postmountingActive,
|
|
13052
|
-
children: /* @__PURE__ */
|
|
13400
|
+
children: !isRendering && unsupportedMessage !== null ? /* @__PURE__ */ jsx33(HtmlInCanvasFallback, {
|
|
13401
|
+
style: { width, height, ...croppedStyle },
|
|
13402
|
+
label: _remotionInternalFallbackLabel,
|
|
13403
|
+
children: /* @__PURE__ */ jsx33(DefaultPremountContext.Provider, {
|
|
13404
|
+
value: 0,
|
|
13405
|
+
children: /* @__PURE__ */ jsx33("div", {
|
|
13406
|
+
style: { width, height },
|
|
13407
|
+
children
|
|
13408
|
+
})
|
|
13409
|
+
})
|
|
13410
|
+
}) : /* @__PURE__ */ jsx33(Content, {
|
|
13053
13411
|
ref: setCanvasRef,
|
|
13054
13412
|
renderFrame: null,
|
|
13055
13413
|
width,
|
|
@@ -13102,13 +13460,12 @@ addSequenceStackTraces(HtmlInCanvas);
|
|
|
13102
13460
|
// src/canvas-image/CanvasImage.tsx
|
|
13103
13461
|
import {
|
|
13104
13462
|
forwardRef as forwardRef10,
|
|
13105
|
-
useCallback as useCallback20,
|
|
13106
13463
|
useContext as useContext46,
|
|
13107
13464
|
useImperativeHandle as useImperativeHandle7,
|
|
13108
|
-
useLayoutEffect as
|
|
13109
|
-
useMemo as
|
|
13465
|
+
useLayoutEffect as useLayoutEffect18,
|
|
13466
|
+
useMemo as useMemo41,
|
|
13110
13467
|
useRef as useRef25,
|
|
13111
|
-
useState as
|
|
13468
|
+
useState as useState20
|
|
13112
13469
|
} from "react";
|
|
13113
13470
|
|
|
13114
13471
|
// src/truncate-src-for-label.ts
|
|
@@ -13123,7 +13480,7 @@ function truncateSrcForLabel(src) {
|
|
|
13123
13480
|
}
|
|
13124
13481
|
|
|
13125
13482
|
// src/canvas-image/CanvasImage.tsx
|
|
13126
|
-
import { jsx as
|
|
13483
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
13127
13484
|
var canvasImageSchema = {
|
|
13128
13485
|
src: {
|
|
13129
13486
|
type: "asset",
|
|
@@ -13150,6 +13507,26 @@ var canvasImageSchema = {
|
|
|
13150
13507
|
...borderSchema,
|
|
13151
13508
|
...borderRadiusSchema
|
|
13152
13509
|
};
|
|
13510
|
+
var continueImageLoadDelay = (pendingLoadDelayRef, setIsLoadPending, continueRender, { markAsReady }) => {
|
|
13511
|
+
const pending = pendingLoadDelayRef.current;
|
|
13512
|
+
if (!pending || pending.continued) {
|
|
13513
|
+
return;
|
|
13514
|
+
}
|
|
13515
|
+
pending.continued = true;
|
|
13516
|
+
if (markAsReady) {
|
|
13517
|
+
setIsLoadPending(false);
|
|
13518
|
+
}
|
|
13519
|
+
continueRender(pending.handle);
|
|
13520
|
+
pendingLoadDelayRef.current = null;
|
|
13521
|
+
};
|
|
13522
|
+
var setCanvasRef = (setOutputCanvas, ref, canvas) => {
|
|
13523
|
+
setOutputCanvas(canvas);
|
|
13524
|
+
if (typeof ref === "function") {
|
|
13525
|
+
ref(canvas);
|
|
13526
|
+
} else if (ref) {
|
|
13527
|
+
ref.current = canvas;
|
|
13528
|
+
}
|
|
13529
|
+
};
|
|
13153
13530
|
var makeAbortError = () => {
|
|
13154
13531
|
if (typeof DOMException !== "undefined") {
|
|
13155
13532
|
return new DOMException("Image loading was aborted", "AbortError");
|
|
@@ -13202,7 +13579,7 @@ var loadImage = ({
|
|
|
13202
13579
|
onAbort();
|
|
13203
13580
|
return;
|
|
13204
13581
|
}
|
|
13205
|
-
image.crossOrigin = crossOrigin
|
|
13582
|
+
image.crossOrigin = crossOrigin || "anonymous";
|
|
13206
13583
|
image.src = src;
|
|
13207
13584
|
});
|
|
13208
13585
|
};
|
|
@@ -13242,8 +13619,8 @@ var CanvasImageContent = forwardRef10(({
|
|
|
13242
13619
|
}, ref) => {
|
|
13243
13620
|
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
13244
13621
|
const { delayPlayback } = useBufferState();
|
|
13245
|
-
const [outputCanvas, setOutputCanvas] =
|
|
13246
|
-
const [loadedImage, setLoadedImage] =
|
|
13622
|
+
const [outputCanvas, setOutputCanvas] = useState20(null);
|
|
13623
|
+
const [loadedImage, setLoadedImage] = useState20(null);
|
|
13247
13624
|
const actualSrc = usePreload(src);
|
|
13248
13625
|
const chainState = useEffectChainState(effectsOutputSize);
|
|
13249
13626
|
const memoizedEffects = useMemoizedEffects({
|
|
@@ -13253,36 +13630,18 @@ var CanvasImageContent = forwardRef10(({
|
|
|
13253
13630
|
});
|
|
13254
13631
|
const sequenceContext = useContext46(SequenceContext);
|
|
13255
13632
|
const pendingLoadDelayRef = useRef25(null);
|
|
13256
|
-
const [isLoadPending, setIsLoadPending] =
|
|
13633
|
+
const [isLoadPending, setIsLoadPending] = useState20(false);
|
|
13257
13634
|
const isPremounting = Boolean(sequenceContext?.premounting);
|
|
13258
13635
|
const isPostmounting = Boolean(sequenceContext?.postmounting);
|
|
13259
|
-
const continuePendingLoadDelay =
|
|
13260
|
-
|
|
13261
|
-
if (!pending || pending.continued) {
|
|
13262
|
-
return;
|
|
13263
|
-
}
|
|
13264
|
-
pending.continued = true;
|
|
13265
|
-
if (markAsReady) {
|
|
13266
|
-
setIsLoadPending(false);
|
|
13267
|
-
}
|
|
13268
|
-
continueRender(pending.handle);
|
|
13269
|
-
pendingLoadDelayRef.current = null;
|
|
13270
|
-
}, [continueRender]);
|
|
13271
|
-
const sourceCanvas = useMemo39(() => {
|
|
13636
|
+
const continuePendingLoadDelay = useMemo41(() => continueImageLoadDelay.bind(null, pendingLoadDelayRef, setIsLoadPending, continueRender), [continueRender]);
|
|
13637
|
+
const sourceCanvas = useMemo41(() => {
|
|
13272
13638
|
if (typeof document === "undefined") {
|
|
13273
13639
|
return null;
|
|
13274
13640
|
}
|
|
13275
13641
|
return document.createElement("canvas");
|
|
13276
13642
|
}, []);
|
|
13277
|
-
const canvasRef =
|
|
13278
|
-
|
|
13279
|
-
if (typeof ref === "function") {
|
|
13280
|
-
ref(canvas);
|
|
13281
|
-
} else if (ref) {
|
|
13282
|
-
ref.current = canvas;
|
|
13283
|
-
}
|
|
13284
|
-
}, [ref]);
|
|
13285
|
-
useLayoutEffect17(() => {
|
|
13643
|
+
const canvasRef = useMemo41(() => setCanvasRef.bind(null, setOutputCanvas, ref), [ref]);
|
|
13644
|
+
useLayoutEffect18(() => {
|
|
13286
13645
|
if (!pauseWhenLoading || !isLoadPending || isPremounting || isPostmounting) {
|
|
13287
13646
|
return;
|
|
13288
13647
|
}
|
|
@@ -13294,7 +13653,7 @@ var CanvasImageContent = forwardRef10(({
|
|
|
13294
13653
|
isPremounting,
|
|
13295
13654
|
pauseWhenLoading
|
|
13296
13655
|
]);
|
|
13297
|
-
|
|
13656
|
+
useLayoutEffect18(() => {
|
|
13298
13657
|
const handle = delayRender(`Rendering <CanvasImage> with src="${truncateSrcForLabel(actualSrc)}"`, {
|
|
13299
13658
|
retries: delayRenderRetries ?? undefined,
|
|
13300
13659
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
@@ -13357,7 +13716,7 @@ var CanvasImageContent = forwardRef10(({
|
|
|
13357
13716
|
maxRetries,
|
|
13358
13717
|
onError
|
|
13359
13718
|
]);
|
|
13360
|
-
|
|
13719
|
+
useLayoutEffect18(() => {
|
|
13361
13720
|
if (!loadedImage || !outputCanvas || !sourceCanvas) {
|
|
13362
13721
|
return;
|
|
13363
13722
|
}
|
|
@@ -13444,7 +13803,7 @@ var CanvasImageContent = forwardRef10(({
|
|
|
13444
13803
|
sourceCanvas,
|
|
13445
13804
|
width
|
|
13446
13805
|
]);
|
|
13447
|
-
return /* @__PURE__ */
|
|
13806
|
+
return /* @__PURE__ */ jsx34("canvas", {
|
|
13448
13807
|
...canvasProps,
|
|
13449
13808
|
ref: canvasRef,
|
|
13450
13809
|
width,
|
|
@@ -13495,7 +13854,7 @@ var CanvasImageInner = forwardRef10(({
|
|
|
13495
13854
|
if (!src) {
|
|
13496
13855
|
throw new Error('No "src" prop was passed to <CanvasImage>.');
|
|
13497
13856
|
}
|
|
13498
|
-
const isMedia =
|
|
13857
|
+
const isMedia = useMemo41(() => ({
|
|
13499
13858
|
type: "image",
|
|
13500
13859
|
src
|
|
13501
13860
|
}), [src]);
|
|
@@ -13534,11 +13893,11 @@ var CanvasImageInner = forwardRef10(({
|
|
|
13534
13893
|
style: premountingStyle,
|
|
13535
13894
|
componentName: _remotionInternalCropComponentName ?? "<CanvasImage />"
|
|
13536
13895
|
});
|
|
13537
|
-
return /* @__PURE__ */
|
|
13896
|
+
return /* @__PURE__ */ jsx34(Freeze, {
|
|
13538
13897
|
frame: freezeFrame,
|
|
13539
13898
|
active: isPremountingOrPostmounting,
|
|
13540
13899
|
_remotionInternalIsPremounting: premountingActive,
|
|
13541
|
-
children: /* @__PURE__ */
|
|
13900
|
+
children: /* @__PURE__ */ jsx34(Sequence, {
|
|
13542
13901
|
layout: "none",
|
|
13543
13902
|
from: from ?? 0,
|
|
13544
13903
|
trimBefore,
|
|
@@ -13556,8 +13915,8 @@ var CanvasImageInner = forwardRef10(({
|
|
|
13556
13915
|
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
13557
13916
|
_remotionInternalIsPremounting: premountingActive,
|
|
13558
13917
|
_remotionInternalIsPostmounting: postmountingActive,
|
|
13559
|
-
children: /* @__PURE__ */
|
|
13560
|
-
children: /* @__PURE__ */
|
|
13918
|
+
children: /* @__PURE__ */ jsx34(SequenceContent, {
|
|
13919
|
+
children: /* @__PURE__ */ jsx34(CanvasImageContent, {
|
|
13561
13920
|
ref: actualRef,
|
|
13562
13921
|
src,
|
|
13563
13922
|
crossOrigin,
|
|
@@ -13622,8 +13981,8 @@ var getStaticFiles = () => {
|
|
|
13622
13981
|
return window.remotion_staticFiles;
|
|
13623
13982
|
};
|
|
13624
13983
|
// src/IFrame.tsx
|
|
13625
|
-
import { forwardRef as forwardRef11, useCallback as
|
|
13626
|
-
import { jsx as
|
|
13984
|
+
import { forwardRef as forwardRef11, useCallback as useCallback18, useLayoutEffect as useLayoutEffect19, useRef as useRef26 } from "react";
|
|
13985
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
13627
13986
|
var IFrameRefForwarding = ({
|
|
13628
13987
|
onLoad,
|
|
13629
13988
|
onError,
|
|
@@ -13635,7 +13994,7 @@ var IFrameRefForwarding = ({
|
|
|
13635
13994
|
const handle = useRef26(null);
|
|
13636
13995
|
const loadedSource = useRef26(null);
|
|
13637
13996
|
const { src, srcDoc } = props;
|
|
13638
|
-
|
|
13997
|
+
useLayoutEffect19(() => {
|
|
13639
13998
|
if (loadedSource.current?.src === src && loadedSource.current?.srcDoc === srcDoc && loadedSource.current !== null) {
|
|
13640
13999
|
return;
|
|
13641
14000
|
}
|
|
@@ -13657,7 +14016,7 @@ var IFrameRefForwarding = ({
|
|
|
13657
14016
|
src,
|
|
13658
14017
|
srcDoc
|
|
13659
14018
|
]);
|
|
13660
|
-
const didLoad =
|
|
14019
|
+
const didLoad = useCallback18((e) => {
|
|
13661
14020
|
loadedSource.current = { src, srcDoc };
|
|
13662
14021
|
if (handle.current !== null) {
|
|
13663
14022
|
continueRender(handle.current);
|
|
@@ -13665,7 +14024,7 @@ var IFrameRefForwarding = ({
|
|
|
13665
14024
|
}
|
|
13666
14025
|
onLoad?.(e);
|
|
13667
14026
|
}, [onLoad, continueRender, src, srcDoc]);
|
|
13668
|
-
const didGetError =
|
|
14027
|
+
const didGetError = useCallback18((e) => {
|
|
13669
14028
|
loadedSource.current = { src, srcDoc };
|
|
13670
14029
|
if (handle.current !== null) {
|
|
13671
14030
|
continueRender(handle.current);
|
|
@@ -13677,7 +14036,7 @@ var IFrameRefForwarding = ({
|
|
|
13677
14036
|
console.error("Error loading iframe:", e, "Handle the event using the onError() prop to make this message disappear.");
|
|
13678
14037
|
}
|
|
13679
14038
|
}, [onError, continueRender, src, srcDoc]);
|
|
13680
|
-
return /* @__PURE__ */
|
|
14039
|
+
return /* @__PURE__ */ jsx35("iframe", {
|
|
13681
14040
|
referrerPolicy: "strict-origin-when-cross-origin",
|
|
13682
14041
|
...props,
|
|
13683
14042
|
ref,
|
|
@@ -13688,17 +14047,130 @@ var IFrameRefForwarding = ({
|
|
|
13688
14047
|
var IFrame = forwardRef11(IFrameRefForwarding);
|
|
13689
14048
|
// src/Img.tsx
|
|
13690
14049
|
import {
|
|
13691
|
-
useCallback as useCallback22,
|
|
13692
14050
|
useContext as useContext47,
|
|
13693
|
-
useLayoutEffect as
|
|
13694
|
-
useMemo as
|
|
14051
|
+
useLayoutEffect as useLayoutEffect20,
|
|
14052
|
+
useMemo as useMemo42,
|
|
13695
14053
|
useRef as useRef27,
|
|
13696
|
-
useState as
|
|
14054
|
+
useState as useState21
|
|
13697
14055
|
} from "react";
|
|
13698
|
-
import { jsx as
|
|
14056
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
13699
14057
|
function exponentialBackoff2(errorCount) {
|
|
13700
14058
|
return 1000 * 2 ** (errorCount - 1);
|
|
13701
14059
|
}
|
|
14060
|
+
var setImageRef = (imageRef, ref, img) => {
|
|
14061
|
+
imageRef.current = img;
|
|
14062
|
+
if (typeof ref === "function") {
|
|
14063
|
+
ref(img);
|
|
14064
|
+
} else if (ref) {
|
|
14065
|
+
ref.current = img;
|
|
14066
|
+
}
|
|
14067
|
+
};
|
|
14068
|
+
var retryImage = (imageRef, timeout) => {
|
|
14069
|
+
if (!imageRef.current) {
|
|
14070
|
+
return;
|
|
14071
|
+
}
|
|
14072
|
+
const currentSrc = imageRef.current.src;
|
|
14073
|
+
setTimeout(() => {
|
|
14074
|
+
if (!imageRef.current) {
|
|
14075
|
+
return;
|
|
14076
|
+
}
|
|
14077
|
+
const newSrc = imageRef.current?.src;
|
|
14078
|
+
if (newSrc !== currentSrc) {
|
|
14079
|
+
return;
|
|
14080
|
+
}
|
|
14081
|
+
imageRef.current.removeAttribute("src");
|
|
14082
|
+
imageRef.current.setAttribute("src", newSrc);
|
|
14083
|
+
}, timeout);
|
|
14084
|
+
};
|
|
14085
|
+
var handleImageError = ({
|
|
14086
|
+
errors,
|
|
14087
|
+
imageRef,
|
|
14088
|
+
onError,
|
|
14089
|
+
onImageError,
|
|
14090
|
+
maxRetries,
|
|
14091
|
+
cancelRender,
|
|
14092
|
+
retryIn
|
|
14093
|
+
}, e) => {
|
|
14094
|
+
if (!errors.current) {
|
|
14095
|
+
return;
|
|
14096
|
+
}
|
|
14097
|
+
errors.current[imageRef.current?.src] = (errors.current[imageRef.current?.src] ?? 0) + 1;
|
|
14098
|
+
if ((onError || onImageError) && (errors.current[imageRef.current?.src] ?? 0) > maxRetries) {
|
|
14099
|
+
onError?.(e);
|
|
14100
|
+
onImageError?.(new Error("Error loading image with src: " + truncateSrcForLabel(imageRef.current?.src)));
|
|
14101
|
+
return;
|
|
14102
|
+
}
|
|
14103
|
+
if ((errors.current[imageRef.current?.src] ?? 0) <= maxRetries) {
|
|
14104
|
+
const backoff = exponentialBackoff2(errors.current[imageRef.current?.src] ?? 0);
|
|
14105
|
+
console.warn(`Could not load image with source ${truncateSrcForLabel(imageRef.current?.src)}, retrying again in ${backoff}ms`);
|
|
14106
|
+
retryIn(backoff);
|
|
14107
|
+
return;
|
|
14108
|
+
}
|
|
14109
|
+
try {
|
|
14110
|
+
cancelRender("Error loading image with src: " + truncateSrcForLabel(imageRef.current?.src));
|
|
14111
|
+
} catch {}
|
|
14112
|
+
};
|
|
14113
|
+
var loadImage2 = ({
|
|
14114
|
+
imageRef,
|
|
14115
|
+
errors,
|
|
14116
|
+
actualSrc,
|
|
14117
|
+
delayRenderRetries,
|
|
14118
|
+
delayRenderTimeoutInMilliseconds,
|
|
14119
|
+
onImageFrame,
|
|
14120
|
+
delayRender,
|
|
14121
|
+
continueRender,
|
|
14122
|
+
setIsLoading
|
|
14123
|
+
}) => {
|
|
14124
|
+
if (window.process?.env?.NODE_ENV === "test") {
|
|
14125
|
+
if (imageRef.current) {
|
|
14126
|
+
imageRef.current.src = actualSrc;
|
|
14127
|
+
}
|
|
14128
|
+
return;
|
|
14129
|
+
}
|
|
14130
|
+
const { current } = imageRef;
|
|
14131
|
+
if (!current) {
|
|
14132
|
+
return;
|
|
14133
|
+
}
|
|
14134
|
+
setIsLoading(true);
|
|
14135
|
+
const newHandle = delayRender("Loading <Img> with src=" + truncateSrcForLabel(actualSrc), {
|
|
14136
|
+
retries: delayRenderRetries ?? undefined,
|
|
14137
|
+
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
14138
|
+
});
|
|
14139
|
+
let unmounted = false;
|
|
14140
|
+
const onComplete = () => {
|
|
14141
|
+
if (unmounted) {
|
|
14142
|
+
continueRender(newHandle);
|
|
14143
|
+
return;
|
|
14144
|
+
}
|
|
14145
|
+
if ((errors.current[imageRef.current?.src] ?? 0) > 0) {
|
|
14146
|
+
delete errors.current[imageRef.current?.src];
|
|
14147
|
+
console.info(`Retry successful - ${truncateSrcForLabel(imageRef.current?.src)} is now loaded`);
|
|
14148
|
+
}
|
|
14149
|
+
if (current) {
|
|
14150
|
+
onImageFrame?.(current);
|
|
14151
|
+
}
|
|
14152
|
+
setIsLoading(false);
|
|
14153
|
+
continueRender(newHandle);
|
|
14154
|
+
};
|
|
14155
|
+
if (!imageRef.current) {
|
|
14156
|
+
onComplete();
|
|
14157
|
+
return;
|
|
14158
|
+
}
|
|
14159
|
+
current.src = actualSrc;
|
|
14160
|
+
current.decode().then(onComplete).catch((err) => {
|
|
14161
|
+
console.warn(err);
|
|
14162
|
+
if (current.complete && current.naturalWidth > 0 && current.naturalHeight > 0) {
|
|
14163
|
+
onComplete();
|
|
14164
|
+
} else {
|
|
14165
|
+
current.addEventListener("load", onComplete);
|
|
14166
|
+
}
|
|
14167
|
+
});
|
|
14168
|
+
return () => {
|
|
14169
|
+
unmounted = true;
|
|
14170
|
+
current.removeEventListener("load", onComplete);
|
|
14171
|
+
continueRender(newHandle);
|
|
14172
|
+
};
|
|
14173
|
+
};
|
|
13702
14174
|
var ImgContent = ({
|
|
13703
14175
|
onError,
|
|
13704
14176
|
onImageError,
|
|
@@ -13717,62 +14189,28 @@ var ImgContent = ({
|
|
|
13717
14189
|
const errors = useRef27({});
|
|
13718
14190
|
const { delayPlayback } = useBufferState();
|
|
13719
14191
|
const sequenceContext = useContext47(SequenceContext);
|
|
13720
|
-
const [isLoading, setIsLoading] =
|
|
14192
|
+
const [isLoading, setIsLoading] = useState21(false);
|
|
13721
14193
|
const _propsValid = true;
|
|
13722
14194
|
if (!_propsValid) {
|
|
13723
14195
|
throw new Error("typecheck error");
|
|
13724
14196
|
}
|
|
13725
|
-
const imageCallbackRef =
|
|
13726
|
-
imageRef.current = img;
|
|
13727
|
-
if (typeof ref === "function") {
|
|
13728
|
-
ref(img);
|
|
13729
|
-
} else if (ref) {
|
|
13730
|
-
ref.current = img;
|
|
13731
|
-
}
|
|
13732
|
-
}, [ref]);
|
|
14197
|
+
const imageCallbackRef = useMemo42(() => setImageRef.bind(null, imageRef, ref ?? null), [ref]);
|
|
13733
14198
|
const actualSrc = usePreload(src);
|
|
13734
|
-
const retryIn =
|
|
13735
|
-
if (!imageRef.current) {
|
|
13736
|
-
return;
|
|
13737
|
-
}
|
|
13738
|
-
const currentSrc = imageRef.current.src;
|
|
13739
|
-
setTimeout(() => {
|
|
13740
|
-
if (!imageRef.current) {
|
|
13741
|
-
return;
|
|
13742
|
-
}
|
|
13743
|
-
const newSrc = imageRef.current?.src;
|
|
13744
|
-
if (newSrc !== currentSrc) {
|
|
13745
|
-
return;
|
|
13746
|
-
}
|
|
13747
|
-
imageRef.current.removeAttribute("src");
|
|
13748
|
-
imageRef.current.setAttribute("src", newSrc);
|
|
13749
|
-
}, timeout);
|
|
13750
|
-
}, []);
|
|
14199
|
+
const retryIn = useMemo42(() => retryImage.bind(null, imageRef), []);
|
|
13751
14200
|
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
13752
14201
|
const isPremounting = Boolean(sequenceContext?.premounting);
|
|
13753
14202
|
const isPostmounting = Boolean(sequenceContext?.postmounting);
|
|
13754
|
-
const didGetError =
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
}
|
|
13764
|
-
if ((errors.current[imageRef.current?.src] ?? 0) <= maxRetries) {
|
|
13765
|
-
const backoff = exponentialBackoff2(errors.current[imageRef.current?.src] ?? 0);
|
|
13766
|
-
console.warn(`Could not load image with source ${truncateSrcForLabel(imageRef.current?.src)}, retrying again in ${backoff}ms`);
|
|
13767
|
-
retryIn(backoff);
|
|
13768
|
-
return;
|
|
13769
|
-
}
|
|
13770
|
-
try {
|
|
13771
|
-
cancelRender("Error loading image with src: " + truncateSrcForLabel(imageRef.current?.src));
|
|
13772
|
-
} catch {}
|
|
13773
|
-
}, [cancelRender, maxRetries, onError, onImageError, retryIn]);
|
|
14203
|
+
const didGetError = useMemo42(() => handleImageError.bind(null, {
|
|
14204
|
+
errors,
|
|
14205
|
+
imageRef,
|
|
14206
|
+
onError: onError ?? null,
|
|
14207
|
+
onImageError: onImageError ?? null,
|
|
14208
|
+
maxRetries,
|
|
14209
|
+
cancelRender,
|
|
14210
|
+
retryIn
|
|
14211
|
+
}), [cancelRender, maxRetries, onError, onImageError, retryIn]);
|
|
13774
14212
|
if (typeof window !== "undefined") {
|
|
13775
|
-
|
|
14213
|
+
useLayoutEffect20(() => {
|
|
13776
14214
|
if (!pauseWhenLoading || !isLoading || isPremounting || isPostmounting) {
|
|
13777
14215
|
return;
|
|
13778
14216
|
}
|
|
@@ -13784,57 +14222,17 @@ var ImgContent = ({
|
|
|
13784
14222
|
isPremounting,
|
|
13785
14223
|
pauseWhenLoading
|
|
13786
14224
|
]);
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
setIsLoading(true);
|
|
13799
|
-
const newHandle = delayRender("Loading <Img> with src=" + truncateSrcForLabel(actualSrc), {
|
|
13800
|
-
retries: delayRenderRetries ?? undefined,
|
|
13801
|
-
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
13802
|
-
});
|
|
13803
|
-
let unmounted = false;
|
|
13804
|
-
const onComplete = () => {
|
|
13805
|
-
if (unmounted) {
|
|
13806
|
-
continueRender(newHandle);
|
|
13807
|
-
return;
|
|
13808
|
-
}
|
|
13809
|
-
if ((errors.current[imageRef.current?.src] ?? 0) > 0) {
|
|
13810
|
-
delete errors.current[imageRef.current?.src];
|
|
13811
|
-
console.info(`Retry successful - ${truncateSrcForLabel(imageRef.current?.src)} is now loaded`);
|
|
13812
|
-
}
|
|
13813
|
-
if (current) {
|
|
13814
|
-
onImageFrame?.(current);
|
|
13815
|
-
}
|
|
13816
|
-
setIsLoading(false);
|
|
13817
|
-
continueRender(newHandle);
|
|
13818
|
-
};
|
|
13819
|
-
if (!imageRef.current) {
|
|
13820
|
-
onComplete();
|
|
13821
|
-
return;
|
|
13822
|
-
}
|
|
13823
|
-
current.src = actualSrc;
|
|
13824
|
-
current.decode().then(onComplete).catch((err) => {
|
|
13825
|
-
console.warn(err);
|
|
13826
|
-
if (current.complete && current.naturalWidth > 0 && current.naturalHeight > 0) {
|
|
13827
|
-
onComplete();
|
|
13828
|
-
} else {
|
|
13829
|
-
current.addEventListener("load", onComplete);
|
|
13830
|
-
}
|
|
13831
|
-
});
|
|
13832
|
-
return () => {
|
|
13833
|
-
unmounted = true;
|
|
13834
|
-
current.removeEventListener("load", onComplete);
|
|
13835
|
-
continueRender(newHandle);
|
|
13836
|
-
};
|
|
13837
|
-
}, [
|
|
14225
|
+
useLayoutEffect20(loadImage2.bind(null, {
|
|
14226
|
+
imageRef,
|
|
14227
|
+
errors,
|
|
14228
|
+
actualSrc,
|
|
14229
|
+
delayRenderRetries: delayRenderRetries ?? null,
|
|
14230
|
+
delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? null,
|
|
14231
|
+
onImageFrame: onImageFrame ?? null,
|
|
14232
|
+
delayRender,
|
|
14233
|
+
continueRender,
|
|
14234
|
+
setIsLoading
|
|
14235
|
+
}), [
|
|
13838
14236
|
actualSrc,
|
|
13839
14237
|
delayRenderRetries,
|
|
13840
14238
|
delayRenderTimeoutInMilliseconds,
|
|
@@ -13849,7 +14247,7 @@ var ImgContent = ({
|
|
|
13849
14247
|
requestsVideoFrame: false,
|
|
13850
14248
|
isClientSideRendering
|
|
13851
14249
|
});
|
|
13852
|
-
return /* @__PURE__ */
|
|
14250
|
+
return /* @__PURE__ */ jsx36("img", {
|
|
13853
14251
|
...props,
|
|
13854
14252
|
ref: imageCallbackRef,
|
|
13855
14253
|
crossOrigin: crossOriginValue,
|
|
@@ -13882,7 +14280,7 @@ var NativeImgInner = ({
|
|
|
13882
14280
|
if (!src) {
|
|
13883
14281
|
throw new Error('No "src" prop was passed to <Img>.');
|
|
13884
14282
|
}
|
|
13885
|
-
const isMedia =
|
|
14283
|
+
const isMedia = useMemo42(() => ({
|
|
13886
14284
|
type: "image",
|
|
13887
14285
|
src
|
|
13888
14286
|
}), [src]);
|
|
@@ -13916,11 +14314,11 @@ var NativeImgInner = ({
|
|
|
13916
14314
|
style: premountingStyle,
|
|
13917
14315
|
componentName: "<Img />"
|
|
13918
14316
|
});
|
|
13919
|
-
return /* @__PURE__ */
|
|
14317
|
+
return /* @__PURE__ */ jsx36(Freeze, {
|
|
13920
14318
|
frame: freezeFrame,
|
|
13921
14319
|
active: isPremountingOrPostmounting,
|
|
13922
14320
|
_remotionInternalIsPremounting: premountingActive,
|
|
13923
|
-
children: /* @__PURE__ */
|
|
14321
|
+
children: /* @__PURE__ */ jsx36(Sequence, {
|
|
13924
14322
|
layout: "none",
|
|
13925
14323
|
from: from ?? 0,
|
|
13926
14324
|
trimBefore,
|
|
@@ -13937,8 +14335,8 @@ var NativeImgInner = ({
|
|
|
13937
14335
|
controls,
|
|
13938
14336
|
showInTimeline: showInTimeline ?? true,
|
|
13939
14337
|
hidden,
|
|
13940
|
-
children: /* @__PURE__ */
|
|
13941
|
-
children: /* @__PURE__ */
|
|
14338
|
+
children: /* @__PURE__ */ jsx36(SequenceContent, {
|
|
14339
|
+
children: /* @__PURE__ */ jsx36(ImgContent, {
|
|
13942
14340
|
src,
|
|
13943
14341
|
style: croppedStyle ?? undefined,
|
|
13944
14342
|
...props
|
|
@@ -14040,7 +14438,7 @@ var ImgInner = ({
|
|
|
14040
14438
|
}) => {
|
|
14041
14439
|
const shouldPauseWhenLoading = resolveV5Default(pauseWhenLoading);
|
|
14042
14440
|
if (effects.length === 0) {
|
|
14043
|
-
return /* @__PURE__ */
|
|
14441
|
+
return /* @__PURE__ */ jsx36(NativeImgInner, {
|
|
14044
14442
|
...props,
|
|
14045
14443
|
ref,
|
|
14046
14444
|
hidden,
|
|
@@ -14085,7 +14483,7 @@ var ImgInner = ({
|
|
|
14085
14483
|
const canvasHeight = typeof height === "number" ? height : undefined;
|
|
14086
14484
|
const canvasProps = props;
|
|
14087
14485
|
const canvasFit = getFitFromObjectFit(style) ?? "fill";
|
|
14088
|
-
return /* @__PURE__ */
|
|
14486
|
+
return /* @__PURE__ */ jsx36(CanvasImageWithPrivateProps, {
|
|
14089
14487
|
src,
|
|
14090
14488
|
width: canvasWidth,
|
|
14091
14489
|
height: canvasHeight,
|
|
@@ -14130,8 +14528,8 @@ var Img = withInteractivitySchema({
|
|
|
14130
14528
|
});
|
|
14131
14529
|
addSequenceStackTraces(Img);
|
|
14132
14530
|
// src/Interactive.tsx
|
|
14133
|
-
import
|
|
14134
|
-
import { jsx as
|
|
14531
|
+
import React43, { forwardRef as forwardRef12, useCallback as useCallback19, useContext as useContext48 } from "react";
|
|
14532
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
14135
14533
|
var sourcePathToIdentityPrefix = (packageName) => {
|
|
14136
14534
|
if (packageName === "remotion") {
|
|
14137
14535
|
return "dev.remotion.remotion";
|
|
@@ -14277,10 +14675,10 @@ var withSchema = (untypedOptions) => {
|
|
|
14277
14675
|
style: premountingStyle,
|
|
14278
14676
|
componentName
|
|
14279
14677
|
});
|
|
14280
|
-
return /* @__PURE__ */
|
|
14678
|
+
return /* @__PURE__ */ jsx37(Freeze, {
|
|
14281
14679
|
frame: freezeFrame,
|
|
14282
14680
|
active: isPremountingOrPostmounting,
|
|
14283
|
-
children: /* @__PURE__ */
|
|
14681
|
+
children: /* @__PURE__ */ jsx37(SequenceWithoutSchema, {
|
|
14284
14682
|
_remotionInternalSingleChildComponent: isCurrentComposition ? null : componentIdentity,
|
|
14285
14683
|
layout,
|
|
14286
14684
|
...layout === "absolute-fill" ? {
|
|
@@ -14304,7 +14702,7 @@ var withSchema = (untypedOptions) => {
|
|
|
14304
14702
|
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
14305
14703
|
_remotionInternalIsPremounting: premountingActive,
|
|
14306
14704
|
_remotionInternalIsPostmounting: postmountingActive,
|
|
14307
|
-
children:
|
|
14705
|
+
children: React43.createElement(Component, {
|
|
14308
14706
|
...componentPropsWithoutCropping,
|
|
14309
14707
|
...layout === "none" ? { style: croppedStyle ?? undefined, ref } : {}
|
|
14310
14708
|
})
|
|
@@ -14390,14 +14788,14 @@ var makeInteractiveElement = (tag, displayName, schema) => {
|
|
|
14390
14788
|
style: premountingStyle,
|
|
14391
14789
|
componentName: displayName
|
|
14392
14790
|
});
|
|
14393
|
-
const callbackRef =
|
|
14791
|
+
const callbackRef = useCallback19((element) => {
|
|
14394
14792
|
setRef2(ref, element);
|
|
14395
14793
|
}, [ref]);
|
|
14396
|
-
return /* @__PURE__ */
|
|
14794
|
+
return /* @__PURE__ */ jsx37(Freeze, {
|
|
14397
14795
|
frame: freezeFrame,
|
|
14398
14796
|
active: isPremountingOrPostmounting,
|
|
14399
14797
|
_remotionInternalIsPremounting: premountingActive,
|
|
14400
|
-
children: /* @__PURE__ */
|
|
14798
|
+
children: /* @__PURE__ */ jsx37(Sequence, {
|
|
14401
14799
|
layout: "none",
|
|
14402
14800
|
from: from ?? 0,
|
|
14403
14801
|
trimBefore,
|
|
@@ -14414,7 +14812,7 @@ var makeInteractiveElement = (tag, displayName, schema) => {
|
|
|
14414
14812
|
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
14415
14813
|
_remotionInternalIsPremounting: premountingActive,
|
|
14416
14814
|
_remotionInternalIsPostmounting: postmountingActive,
|
|
14417
|
-
children:
|
|
14815
|
+
children: React43.createElement(tag, {
|
|
14418
14816
|
...props,
|
|
14419
14817
|
style: croppedStyle ?? undefined,
|
|
14420
14818
|
ref: callbackRef
|
|
@@ -14510,43 +14908,43 @@ var getAudioSyncAnchorTolerance = (audioContext) => {
|
|
|
14510
14908
|
};
|
|
14511
14909
|
|
|
14512
14910
|
// src/CompositionManager.tsx
|
|
14513
|
-
import
|
|
14514
|
-
var compositionsRef =
|
|
14911
|
+
import React44 from "react";
|
|
14912
|
+
var compositionsRef = React44.createRef();
|
|
14515
14913
|
|
|
14516
14914
|
// src/CompositionManagerProvider.tsx
|
|
14517
14915
|
import {
|
|
14518
|
-
useCallback as
|
|
14916
|
+
useCallback as useCallback21,
|
|
14519
14917
|
useImperativeHandle as useImperativeHandle9,
|
|
14520
|
-
useMemo as
|
|
14918
|
+
useMemo as useMemo44,
|
|
14521
14919
|
useRef as useRef29,
|
|
14522
|
-
useState as
|
|
14920
|
+
useState as useState23
|
|
14523
14921
|
} from "react";
|
|
14524
14922
|
|
|
14525
14923
|
// src/CompositionRegistryProvider.tsx
|
|
14526
14924
|
import {
|
|
14527
14925
|
forwardRef as forwardRef13,
|
|
14528
|
-
useCallback as
|
|
14926
|
+
useCallback as useCallback20,
|
|
14529
14927
|
useEffect as useEffect18,
|
|
14530
14928
|
useImperativeHandle as useImperativeHandle8,
|
|
14531
|
-
useLayoutEffect as
|
|
14532
|
-
useMemo as
|
|
14929
|
+
useLayoutEffect as useLayoutEffect21,
|
|
14930
|
+
useMemo as useMemo43,
|
|
14533
14931
|
useRef as useRef28,
|
|
14534
|
-
useState as
|
|
14932
|
+
useState as useState22
|
|
14535
14933
|
} from "react";
|
|
14536
|
-
import { jsx as
|
|
14537
|
-
var useIsomorphicLayoutEffect6 = typeof window === "undefined" ? useEffect18 :
|
|
14934
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
14935
|
+
var useIsomorphicLayoutEffect6 = typeof window === "undefined" ? useEffect18 : useLayoutEffect21;
|
|
14538
14936
|
var CompositionRegistryFallbackProvider = withCommittedMetadata(CompositionRegistryFallbackContext.Provider);
|
|
14539
14937
|
var CompositionRegistryProvider = forwardRef13(({ children, onSnapshot }, flushSnapshotRef) => {
|
|
14540
14938
|
const { isStudio } = useRemotionEnvironment();
|
|
14541
|
-
const [managerId] =
|
|
14542
|
-
const [useCommitObserver, setUseCommitObserver] =
|
|
14939
|
+
const [managerId] = useState22(() => String(Math.random()));
|
|
14940
|
+
const [useCommitObserver, setUseCommitObserver] = useState22(() => isStudio && isCommitRegistrationObserverInstalled());
|
|
14543
14941
|
const observedCommitRef = useRef28(false);
|
|
14544
14942
|
const observerFailedRef = useRef28(false);
|
|
14545
14943
|
const unmountedRef = useRef28(false);
|
|
14546
14944
|
const onSnapshotRef = useRef28(onSnapshot);
|
|
14547
14945
|
const lastSnapshotRef = useRef28(null);
|
|
14548
14946
|
const pendingSnapshotRef = useRef28(null);
|
|
14549
|
-
const flushSnapshot =
|
|
14947
|
+
const flushSnapshot = useCallback20(() => {
|
|
14550
14948
|
const pending = pendingSnapshotRef.current;
|
|
14551
14949
|
pendingSnapshotRef.current = null;
|
|
14552
14950
|
if (pending === null || unmountedRef.current) {
|
|
@@ -14561,7 +14959,7 @@ var CompositionRegistryProvider = forwardRef13(({ children, onSnapshot }, flushS
|
|
|
14561
14959
|
onSnapshotRef.current(committed);
|
|
14562
14960
|
}, []);
|
|
14563
14961
|
useImperativeHandle8(flushSnapshotRef, () => flushSnapshot, [flushSnapshot]);
|
|
14564
|
-
const queueSnapshot =
|
|
14962
|
+
const queueSnapshot = useCallback20((snapshot) => {
|
|
14565
14963
|
const alreadyPending = pendingSnapshotRef.current !== null;
|
|
14566
14964
|
pendingSnapshotRef.current = snapshot;
|
|
14567
14965
|
if (alreadyPending) {
|
|
@@ -14569,14 +14967,14 @@ var CompositionRegistryProvider = forwardRef13(({ children, onSnapshot }, flushS
|
|
|
14569
14967
|
}
|
|
14570
14968
|
queueMicrotask(flushSnapshot);
|
|
14571
14969
|
}, [flushSnapshot]);
|
|
14572
|
-
const onObservedSnapshot =
|
|
14970
|
+
const onObservedSnapshot = useCallback20((snapshot) => {
|
|
14573
14971
|
if (observerFailedRef.current) {
|
|
14574
14972
|
return;
|
|
14575
14973
|
}
|
|
14576
14974
|
observedCommitRef.current = true;
|
|
14577
14975
|
queueSnapshot(snapshot);
|
|
14578
14976
|
}, [queueSnapshot]);
|
|
14579
|
-
const fallbackRegistry =
|
|
14977
|
+
const fallbackRegistry = useMemo43(() => {
|
|
14580
14978
|
const entries = new Map;
|
|
14581
14979
|
const getSnapshot = () => {
|
|
14582
14980
|
const compositions = [];
|
|
@@ -14647,12 +15045,12 @@ var CompositionRegistryProvider = forwardRef13(({ children, onSnapshot }, flushS
|
|
|
14647
15045
|
}
|
|
14648
15046
|
};
|
|
14649
15047
|
}, [isStudio, useCommitObserver]);
|
|
14650
|
-
const metadata =
|
|
15048
|
+
const metadata = useMemo43(() => isStudio ? {
|
|
14651
15049
|
type: "composition-manager",
|
|
14652
15050
|
id: managerId,
|
|
14653
15051
|
onCommit: useCommitObserver ? onObservedSnapshot : null
|
|
14654
15052
|
} : null, [isStudio, managerId, onObservedSnapshot, useCommitObserver]);
|
|
14655
|
-
return /* @__PURE__ */
|
|
15053
|
+
return /* @__PURE__ */ jsx38(CompositionRegistryFallbackProvider, {
|
|
14656
15054
|
value: useCommitObserver ? null : fallbackRegistry,
|
|
14657
15055
|
_remotionCommitMetadata: metadata,
|
|
14658
15056
|
children
|
|
@@ -14660,7 +15058,7 @@ var CompositionRegistryProvider = forwardRef13(({ children, onSnapshot }, flushS
|
|
|
14660
15058
|
});
|
|
14661
15059
|
|
|
14662
15060
|
// src/CompositionManagerProvider.tsx
|
|
14663
|
-
import { jsx as
|
|
15061
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
14664
15062
|
var CompositionManagerProvider = ({
|
|
14665
15063
|
children,
|
|
14666
15064
|
onlyRenderComposition,
|
|
@@ -14671,8 +15069,8 @@ var CompositionManagerProvider = ({
|
|
|
14671
15069
|
const committedKeysRef = useRef29(new Set);
|
|
14672
15070
|
const flushSnapshotRef = useRef29(null);
|
|
14673
15071
|
const committedDescriptorsRef = useRef29(new Map);
|
|
14674
|
-
const [registrationError, setRegistrationError] =
|
|
14675
|
-
const [registry] =
|
|
15072
|
+
const [registrationError, setRegistrationError] = useState23(null);
|
|
15073
|
+
const [registry] = useState23(() => createRegistryStore({
|
|
14676
15074
|
compositions: initialCompositions.map((composition, order) => ({
|
|
14677
15075
|
...composition,
|
|
14678
15076
|
order
|
|
@@ -14680,9 +15078,9 @@ var CompositionManagerProvider = ({
|
|
|
14680
15078
|
folders: []
|
|
14681
15079
|
}));
|
|
14682
15080
|
const { compositions, folders } = useSyncExternalStore2(registry.subscribe, registry.getSnapshot, registry.getSnapshot);
|
|
14683
|
-
const [canvasContent, setCanvasContent] =
|
|
14684
|
-
const [currentAssetMetadata, setCurrentAssetMetadata] =
|
|
14685
|
-
const onCommitRegistrations =
|
|
15081
|
+
const [canvasContent, setCanvasContent] = useState23(initialCanvasContent);
|
|
15082
|
+
const [currentAssetMetadata, setCurrentAssetMetadata] = useState23(null);
|
|
15083
|
+
const onCommitRegistrations = useCallback21((pending) => {
|
|
14686
15084
|
const previousKeys = committedKeysRef.current;
|
|
14687
15085
|
const previousDescriptors = committedDescriptorsRef.current;
|
|
14688
15086
|
const existingIds = new Set(registry.getSnapshot().compositions.map((composition) => composition.id));
|
|
@@ -14734,12 +15132,12 @@ var CompositionManagerProvider = ({
|
|
|
14734
15132
|
}
|
|
14735
15133
|
};
|
|
14736
15134
|
}, [registry]);
|
|
14737
|
-
const compositionManagerSetters =
|
|
15135
|
+
const compositionManagerSetters = useMemo44(() => ({
|
|
14738
15136
|
setCanvasContent,
|
|
14739
15137
|
setCurrentAssetMetadata,
|
|
14740
15138
|
onlyRenderComposition
|
|
14741
15139
|
}), [onlyRenderComposition]);
|
|
14742
|
-
const compositionManagerContextValue =
|
|
15140
|
+
const compositionManagerContextValue = useMemo44(() => {
|
|
14743
15141
|
return {
|
|
14744
15142
|
compositions,
|
|
14745
15143
|
folders,
|
|
@@ -14759,14 +15157,14 @@ var CompositionManagerProvider = ({
|
|
|
14759
15157
|
if (registrationError !== null) {
|
|
14760
15158
|
throw registrationError;
|
|
14761
15159
|
}
|
|
14762
|
-
return /* @__PURE__ */
|
|
15160
|
+
return /* @__PURE__ */ jsx39(CompositionRegistryProvider, {
|
|
14763
15161
|
ref: flushSnapshotRef,
|
|
14764
15162
|
onSnapshot: onCommitRegistrations,
|
|
14765
|
-
children: /* @__PURE__ */
|
|
15163
|
+
children: /* @__PURE__ */ jsx39(CompositionManager.Provider, {
|
|
14766
15164
|
value: compositionManagerContextValue,
|
|
14767
|
-
children: /* @__PURE__ */
|
|
15165
|
+
children: /* @__PURE__ */ jsx39(CompositionManagerRefContext.Provider, {
|
|
14768
15166
|
value: compositionManagerRef,
|
|
14769
|
-
children: /* @__PURE__ */
|
|
15167
|
+
children: /* @__PURE__ */ jsx39(CompositionSetters.Provider, {
|
|
14770
15168
|
value: compositionManagerSetters,
|
|
14771
15169
|
children
|
|
14772
15170
|
})
|
|
@@ -14787,11 +15185,41 @@ var createElementSourceProxy = (api, sourceArgumentIndex, getSourceFileName) =>
|
|
|
14787
15185
|
const source = sourceArgumentIndex === null ? null : argArray[sourceArgumentIndex];
|
|
14788
15186
|
const existingStack = props?.[internalStackProp];
|
|
14789
15187
|
const controlsStack = !existingStack && component === getSequenceComponent() && props?.controls ? getStackForControls(props.controls) : null;
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
lineNumber
|
|
14793
|
-
|
|
14794
|
-
|
|
15188
|
+
let stack = existingStack || controlsStack;
|
|
15189
|
+
if (!stack) {
|
|
15190
|
+
if (source && typeof source.fileName === "string" && typeof source.lineNumber === "number" && typeof source.columnNumber === "number") {
|
|
15191
|
+
stack = makeOriginalSourceStack({
|
|
15192
|
+
fileName: getSourceFileName(source.fileName),
|
|
15193
|
+
lineNumber: source.lineNumber,
|
|
15194
|
+
columnNumber: source.columnNumber - 1
|
|
15195
|
+
});
|
|
15196
|
+
} else {
|
|
15197
|
+
const { stackTraceLimit } = Error;
|
|
15198
|
+
const canLimitStack = typeof stackTraceLimit === "number" && stackTraceLimit > 2 && Object.getOwnPropertyDescriptor(Error, "stackTraceLimit")?.writable;
|
|
15199
|
+
let capturedError;
|
|
15200
|
+
try {
|
|
15201
|
+
if (canLimitStack) {
|
|
15202
|
+
Error.stackTraceLimit = 2;
|
|
15203
|
+
}
|
|
15204
|
+
capturedError = new Error;
|
|
15205
|
+
} finally {
|
|
15206
|
+
if (canLimitStack) {
|
|
15207
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
15208
|
+
}
|
|
15209
|
+
}
|
|
15210
|
+
const capturedStack = capturedError.stack;
|
|
15211
|
+
if (capturedStack) {
|
|
15212
|
+
const firstFrameEnd = capturedStack.indexOf(`
|
|
15213
|
+
`, capturedStack.startsWith(`Error
|
|
15214
|
+
`) ? 6 : 0);
|
|
15215
|
+
const callerEnd = firstFrameEnd === -1 ? -1 : capturedStack.indexOf(`
|
|
15216
|
+
`, firstFrameEnd + 1);
|
|
15217
|
+
stack = callerEnd === -1 ? capturedStack : capturedStack.slice(0, callerEnd);
|
|
15218
|
+
} else {
|
|
15219
|
+
stack = capturedStack;
|
|
15220
|
+
}
|
|
15221
|
+
}
|
|
15222
|
+
}
|
|
14795
15223
|
const newProps = existingStack ? { ...props } : {
|
|
14796
15224
|
...props ?? {},
|
|
14797
15225
|
[internalStackProp]: stack
|
|
@@ -14857,6 +15285,72 @@ var makeDefaultPreviewCSS = (scope, backgroundColor) => {
|
|
|
14857
15285
|
`;
|
|
14858
15286
|
};
|
|
14859
15287
|
|
|
15288
|
+
// src/effects/create-curve-sampler.ts
|
|
15289
|
+
var createCurveSampler = (points, interpolation) => {
|
|
15290
|
+
const distances = points.slice(1).map((point, index) => Math.hypot(point[0] - points[index][0], point[1] - points[index][1]));
|
|
15291
|
+
const tangents = points.map(() => [0, 0]);
|
|
15292
|
+
if (interpolation === "smooth" && points.length > 2) {
|
|
15293
|
+
for (let axis = 0;axis < 2; axis++) {
|
|
15294
|
+
const slopes = distances.map((distance, index) => (points[index + 1][axis] - points[index][axis]) / distance);
|
|
15295
|
+
const curvatures = new Array(points.length).fill(0);
|
|
15296
|
+
const upper = new Array(points.length).fill(0);
|
|
15297
|
+
for (let index = 1;index < points.length - 1; index++) {
|
|
15298
|
+
const diagonal = 2 * (distances[index - 1] + distances[index]) - distances[index - 1] * upper[index - 1];
|
|
15299
|
+
upper[index] = distances[index] / diagonal;
|
|
15300
|
+
curvatures[index] = (6 * (slopes[index] - slopes[index - 1]) - distances[index - 1] * curvatures[index - 1]) / diagonal;
|
|
15301
|
+
}
|
|
15302
|
+
for (let index = points.length - 2;index > 0; index--) {
|
|
15303
|
+
curvatures[index] -= upper[index] * curvatures[index + 1];
|
|
15304
|
+
}
|
|
15305
|
+
for (let index = 0;index < points.length; index++) {
|
|
15306
|
+
tangents[index][axis] = index === 0 ? slopes[0] - distances[0] * curvatures[1] / 6 : slopes[index - 1] + distances[index - 1] * (curvatures[index - 1] + 2 * curvatures[index]) / 6;
|
|
15307
|
+
}
|
|
15308
|
+
}
|
|
15309
|
+
for (let index = 0;index < points.length; index++) {
|
|
15310
|
+
const maxTangent = 3 * Math.min(index === 0 ? Infinity : (points[index][0] - points[index - 1][0]) / distances[index - 1], index === points.length - 1 ? Infinity : (points[index + 1][0] - points[index][0]) / distances[index]);
|
|
15311
|
+
if (tangents[index][0] > maxTangent) {
|
|
15312
|
+
tangents[index][1] *= maxTangent / tangents[index][0];
|
|
15313
|
+
}
|
|
15314
|
+
tangents[index][0] = Math.max(0, Math.min(maxTangent, tangents[index][0]));
|
|
15315
|
+
}
|
|
15316
|
+
}
|
|
15317
|
+
return (input) => {
|
|
15318
|
+
if (input <= points[0][0])
|
|
15319
|
+
return points[0][1];
|
|
15320
|
+
if (input >= points[points.length - 1][0]) {
|
|
15321
|
+
return points[points.length - 1][1];
|
|
15322
|
+
}
|
|
15323
|
+
const index = points.findIndex((point) => point[0] > input) - 1;
|
|
15324
|
+
const start = points[index];
|
|
15325
|
+
const end = points[index + 1];
|
|
15326
|
+
if (input === start[0])
|
|
15327
|
+
return start[1];
|
|
15328
|
+
if (interpolation === "linear" || points.length === 2) {
|
|
15329
|
+
return start[1] + (end[1] - start[1]) * ((input - start[0]) / (end[0] - start[0]));
|
|
15330
|
+
}
|
|
15331
|
+
const handleLength = distances[index] / 3;
|
|
15332
|
+
const firstX = start[0] + handleLength * tangents[index][0];
|
|
15333
|
+
const secondX = end[0] - handleLength * tangents[index + 1][0];
|
|
15334
|
+
let low = 0;
|
|
15335
|
+
let high = 1;
|
|
15336
|
+
for (let iteration = 0;iteration < 32; iteration++) {
|
|
15337
|
+
const candidate = (low + high) / 2;
|
|
15338
|
+
const inverse = 1 - candidate;
|
|
15339
|
+
const x = inverse ** 3 * start[0] + 3 * inverse ** 2 * candidate * firstX + 3 * inverse * candidate ** 2 * secondX + candidate ** 3 * end[0];
|
|
15340
|
+
if (x < input)
|
|
15341
|
+
low = candidate;
|
|
15342
|
+
else
|
|
15343
|
+
high = candidate;
|
|
15344
|
+
}
|
|
15345
|
+
const progress = (low + high) / 2;
|
|
15346
|
+
const remaining = 1 - progress;
|
|
15347
|
+
const firstY = start[1] + handleLength * tangents[index][1];
|
|
15348
|
+
const secondY = end[1] - handleLength * tangents[index + 1][1];
|
|
15349
|
+
const value = remaining ** 3 * start[1] + 3 * remaining ** 2 * progress * firstY + 3 * remaining * progress ** 2 * secondY + progress ** 3 * end[1];
|
|
15350
|
+
return Math.max(0, Math.min(1, value));
|
|
15351
|
+
};
|
|
15352
|
+
};
|
|
15353
|
+
|
|
14860
15354
|
// src/get-preview-dom-element.ts
|
|
14861
15355
|
var REMOTION_STUDIO_CONTAINER_ELEMENT = "__remotion-studio-container";
|
|
14862
15356
|
var getPreviewDomElement = () => {
|
|
@@ -14864,8 +15358,8 @@ var getPreviewDomElement = () => {
|
|
|
14864
15358
|
};
|
|
14865
15359
|
|
|
14866
15360
|
// src/max-video-cache-size.ts
|
|
14867
|
-
import
|
|
14868
|
-
var MaxMediaCacheSizeContext =
|
|
15361
|
+
import React45 from "react";
|
|
15362
|
+
var MaxMediaCacheSizeContext = React45.createContext(null);
|
|
14869
15363
|
|
|
14870
15364
|
// src/media-resource-manager.ts
|
|
14871
15365
|
var disposeResource = (resource) => {
|
|
@@ -14982,6 +15476,10 @@ var getMediabunnyInputResourceKey = ({
|
|
|
14982
15476
|
var MEDIABUNNY_DURATION_VALUE_KEY = "mediabunny-duration";
|
|
14983
15477
|
var globalMediaResourceManager = makeMediaResourceManager();
|
|
14984
15478
|
|
|
15479
|
+
// src/playback-pitch-context.ts
|
|
15480
|
+
import { createContext as createContext38 } from "react";
|
|
15481
|
+
var PlaybackPitchContext = createContext38(false);
|
|
15482
|
+
|
|
14985
15483
|
// src/react-refresh-event.ts
|
|
14986
15484
|
var REACT_REFRESH_STARTED_EVENT = "remotion-react-refresh-started";
|
|
14987
15485
|
var REACT_REFRESH_FINISHED_EVENT = "remotion-react-refresh-finished";
|
|
@@ -15018,8 +15516,8 @@ var waitForRoot = (fn) => {
|
|
|
15018
15516
|
};
|
|
15019
15517
|
|
|
15020
15518
|
// src/RemotionRoot.tsx
|
|
15021
|
-
import { useMemo as
|
|
15022
|
-
import { jsx as
|
|
15519
|
+
import { useMemo as useMemo45 } from "react";
|
|
15520
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
15023
15521
|
var RemotionRootContexts = ({
|
|
15024
15522
|
children,
|
|
15025
15523
|
numberOfAudioTags,
|
|
@@ -15031,29 +15529,29 @@ var RemotionRootContexts = ({
|
|
|
15031
15529
|
frameState,
|
|
15032
15530
|
_experimentalKeepAudioContextAlive
|
|
15033
15531
|
}) => {
|
|
15034
|
-
const logging =
|
|
15532
|
+
const logging = useMemo45(() => {
|
|
15035
15533
|
return { logLevel, mountTime: Date.now() };
|
|
15036
15534
|
}, [logLevel]);
|
|
15037
|
-
return /* @__PURE__ */
|
|
15535
|
+
return /* @__PURE__ */ jsx40(LogLevelContext.Provider, {
|
|
15038
15536
|
value: logging,
|
|
15039
|
-
children: /* @__PURE__ */
|
|
15537
|
+
children: /* @__PURE__ */ jsx40(TimelineContextProvider, {
|
|
15040
15538
|
frameState,
|
|
15041
|
-
children: /* @__PURE__ */
|
|
15539
|
+
children: /* @__PURE__ */ jsx40(MediaEnabledProvider, {
|
|
15042
15540
|
videoEnabled,
|
|
15043
15541
|
audioEnabled,
|
|
15044
|
-
children: /* @__PURE__ */
|
|
15045
|
-
children: /* @__PURE__ */
|
|
15046
|
-
children: /* @__PURE__ */
|
|
15047
|
-
children: /* @__PURE__ */
|
|
15048
|
-
children: /* @__PURE__ */
|
|
15049
|
-
children: /* @__PURE__ */
|
|
15542
|
+
children: /* @__PURE__ */ jsx40(EditorPropsProvider, {
|
|
15543
|
+
children: /* @__PURE__ */ jsx40(PrefetchProvider, {
|
|
15544
|
+
children: /* @__PURE__ */ jsx40(SequenceManagerProvider, {
|
|
15545
|
+
children: /* @__PURE__ */ jsx40(DurationsContextProvider, {
|
|
15546
|
+
children: /* @__PURE__ */ jsx40(BufferingProvider, {
|
|
15547
|
+
children: /* @__PURE__ */ jsx40(SharedAudioContextProvider, {
|
|
15050
15548
|
audioLatencyHint,
|
|
15051
15549
|
audioEnabled,
|
|
15052
15550
|
previewSampleRate,
|
|
15053
15551
|
_experimentalKeepAudioContextAlive,
|
|
15054
|
-
children: /* @__PURE__ */
|
|
15552
|
+
children: /* @__PURE__ */ jsx40(SharedAudioTagsContextProvider, {
|
|
15055
15553
|
numberOfAudioTags,
|
|
15056
|
-
children: /* @__PURE__ */
|
|
15554
|
+
children: /* @__PURE__ */ jsx40(VideoProvider, {
|
|
15057
15555
|
children
|
|
15058
15556
|
})
|
|
15059
15557
|
})
|
|
@@ -15069,7 +15567,7 @@ var RemotionRootContexts = ({
|
|
|
15069
15567
|
};
|
|
15070
15568
|
|
|
15071
15569
|
// src/render-resource-manager.ts
|
|
15072
|
-
import
|
|
15570
|
+
import React47 from "react";
|
|
15073
15571
|
var makeRenderResourceManager = () => {
|
|
15074
15572
|
const resources = new Map;
|
|
15075
15573
|
let disposed = false;
|
|
@@ -15110,7 +15608,7 @@ var makeRenderResourceManager = () => {
|
|
|
15110
15608
|
}
|
|
15111
15609
|
};
|
|
15112
15610
|
};
|
|
15113
|
-
var RenderResourceManagerContext =
|
|
15611
|
+
var RenderResourceManagerContext = React47.createContext(null);
|
|
15114
15612
|
|
|
15115
15613
|
// src/codec.ts
|
|
15116
15614
|
var validCodecs = [
|
|
@@ -15301,8 +15799,8 @@ var resolveVideoConfigOrCatch = (params) => {
|
|
|
15301
15799
|
};
|
|
15302
15800
|
|
|
15303
15801
|
// src/sequence-stack-traces.ts
|
|
15304
|
-
import
|
|
15305
|
-
var SequenceStackTracesUpdateContext =
|
|
15802
|
+
import React48 from "react";
|
|
15803
|
+
var SequenceStackTracesUpdateContext = React48.createContext(() => {});
|
|
15306
15804
|
|
|
15307
15805
|
// src/setup-env-variables.ts
|
|
15308
15806
|
var getEnvVariables = () => {
|
|
@@ -15332,8 +15830,8 @@ var setupEnvVariables = () => {
|
|
|
15332
15830
|
};
|
|
15333
15831
|
|
|
15334
15832
|
// src/Track.tsx
|
|
15335
|
-
import { useMemo as
|
|
15336
|
-
import { jsx as
|
|
15833
|
+
import { useMemo as useMemo46, useState as useState24 } from "react";
|
|
15834
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
15337
15835
|
var {
|
|
15338
15836
|
freeze: _freeze,
|
|
15339
15837
|
layout: _layout,
|
|
@@ -15349,11 +15847,11 @@ var TrackWithoutSchema = ({
|
|
|
15349
15847
|
layout = "none",
|
|
15350
15848
|
...props
|
|
15351
15849
|
}) => {
|
|
15352
|
-
const [id] =
|
|
15353
|
-
const value =
|
|
15354
|
-
return /* @__PURE__ */
|
|
15850
|
+
const [id] = useState24(() => String(Math.random()));
|
|
15851
|
+
const value = useMemo46(() => ({ id, name }), [id, name]);
|
|
15852
|
+
return /* @__PURE__ */ jsx41(TimelineTrackContext.Provider, {
|
|
15355
15853
|
value,
|
|
15356
|
-
children: /* @__PURE__ */
|
|
15854
|
+
children: /* @__PURE__ */ jsx41(SequenceWithoutSchema, {
|
|
15357
15855
|
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/track",
|
|
15358
15856
|
...props,
|
|
15359
15857
|
name,
|
|
@@ -15364,7 +15862,7 @@ var TrackWithoutSchema = ({
|
|
|
15364
15862
|
});
|
|
15365
15863
|
};
|
|
15366
15864
|
var Track = withInteractivitySchema({
|
|
15367
|
-
Component: (props) => /* @__PURE__ */
|
|
15865
|
+
Component: (props) => /* @__PURE__ */ jsx41(TrackWithoutSchema, {
|
|
15368
15866
|
...props,
|
|
15369
15867
|
layout: "none"
|
|
15370
15868
|
}),
|
|
@@ -15376,8 +15874,8 @@ var Track = withInteractivitySchema({
|
|
|
15376
15874
|
addSequenceStackTraces(Track);
|
|
15377
15875
|
|
|
15378
15876
|
// src/use-pixel-density.ts
|
|
15379
|
-
import
|
|
15380
|
-
var PixelDensityContext =
|
|
15877
|
+
import React50, { useContext as useContext49 } from "react";
|
|
15878
|
+
var PixelDensityContext = React50.createContext(null);
|
|
15381
15879
|
var getBrowserPixelDensity = () => {
|
|
15382
15880
|
if (typeof window === "undefined") {
|
|
15383
15881
|
return 1;
|
|
@@ -15403,16 +15901,16 @@ var usePixelDensity = (options) => {
|
|
|
15403
15901
|
};
|
|
15404
15902
|
|
|
15405
15903
|
// src/video/OffthreadVideo.tsx
|
|
15406
|
-
import { useCallback as
|
|
15904
|
+
import { useCallback as useCallback24 } from "react";
|
|
15407
15905
|
|
|
15408
15906
|
// src/video/OffthreadVideoForRendering.tsx
|
|
15409
15907
|
import {
|
|
15410
|
-
useCallback as
|
|
15908
|
+
useCallback as useCallback22,
|
|
15411
15909
|
useContext as useContext50,
|
|
15412
15910
|
useEffect as useEffect19,
|
|
15413
|
-
useLayoutEffect as
|
|
15414
|
-
useMemo as
|
|
15415
|
-
useState as
|
|
15911
|
+
useLayoutEffect as useLayoutEffect22,
|
|
15912
|
+
useMemo as useMemo47,
|
|
15913
|
+
useState as useState25
|
|
15416
15914
|
} from "react";
|
|
15417
15915
|
|
|
15418
15916
|
// src/video/offthread-video-source.ts
|
|
@@ -15426,7 +15924,7 @@ var getOffthreadVideoSource = ({
|
|
|
15426
15924
|
};
|
|
15427
15925
|
|
|
15428
15926
|
// src/video/OffthreadVideoForRendering.tsx
|
|
15429
|
-
import { jsx as
|
|
15927
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
15430
15928
|
var OffthreadVideoForRendering = ({
|
|
15431
15929
|
onError,
|
|
15432
15930
|
volume: volumeProp,
|
|
@@ -15444,7 +15942,7 @@ var OffthreadVideoForRendering = ({
|
|
|
15444
15942
|
onVideoFrame,
|
|
15445
15943
|
crossOrigin,
|
|
15446
15944
|
audioStreamIndex,
|
|
15447
|
-
preservePitch
|
|
15945
|
+
preservePitch,
|
|
15448
15946
|
...props
|
|
15449
15947
|
}) => {
|
|
15450
15948
|
const absoluteFrame = useTimelinePosition();
|
|
@@ -15458,7 +15956,7 @@ var OffthreadVideoForRendering = ({
|
|
|
15458
15956
|
if (!src) {
|
|
15459
15957
|
throw new TypeError("No `src` was passed to <OffthreadVideo>.");
|
|
15460
15958
|
}
|
|
15461
|
-
const id =
|
|
15959
|
+
const id = useMemo47(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
15462
15960
|
src,
|
|
15463
15961
|
sequenceContext?.cumulatedFrom,
|
|
15464
15962
|
sequenceContext?.relativeFrom,
|
|
@@ -15496,7 +15994,8 @@ var OffthreadVideoForRendering = ({
|
|
|
15496
15994
|
playbackRate: playbackRate * sequencePlaybackRate,
|
|
15497
15995
|
toneFrequency,
|
|
15498
15996
|
audioStartFrame,
|
|
15499
|
-
audioStreamIndex
|
|
15997
|
+
audioStreamIndex,
|
|
15998
|
+
preservePitch: preservePitch ?? true
|
|
15500
15999
|
});
|
|
15501
16000
|
return () => unregisterRenderAsset(id);
|
|
15502
16001
|
}, [
|
|
@@ -15512,16 +16011,17 @@ var OffthreadVideoForRendering = ({
|
|
|
15512
16011
|
toneFrequency,
|
|
15513
16012
|
audioStartFrame,
|
|
15514
16013
|
sequencePlaybackRate,
|
|
15515
|
-
audioStreamIndex
|
|
16014
|
+
audioStreamIndex,
|
|
16015
|
+
preservePitch
|
|
15516
16016
|
]);
|
|
15517
|
-
const currentTime =
|
|
16017
|
+
const currentTime = useMemo47(() => {
|
|
15518
16018
|
return getExpectedMediaFrameUncorrected({
|
|
15519
16019
|
frame,
|
|
15520
16020
|
playbackRate: playbackRate || 1,
|
|
15521
16021
|
startFrom: audioStartFrame
|
|
15522
16022
|
}) / videoConfig.fps;
|
|
15523
16023
|
}, [frame, audioStartFrame, playbackRate, videoConfig.fps]);
|
|
15524
|
-
const actualSrc =
|
|
16024
|
+
const actualSrc = useMemo47(() => {
|
|
15525
16025
|
return getOffthreadVideoSource({
|
|
15526
16026
|
src,
|
|
15527
16027
|
currentTime,
|
|
@@ -15529,9 +16029,9 @@ var OffthreadVideoForRendering = ({
|
|
|
15529
16029
|
toneMapped
|
|
15530
16030
|
});
|
|
15531
16031
|
}, [toneMapped, currentTime, src, transparent]);
|
|
15532
|
-
const [imageSrc, setImageSrc] =
|
|
15533
|
-
const { delayRender, continueRender } = useDelayRender();
|
|
15534
|
-
|
|
16032
|
+
const [imageSrc, setImageSrc] = useState25(null);
|
|
16033
|
+
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
16034
|
+
useLayoutEffect22(() => {
|
|
15535
16035
|
if (!window.remotion_videoEnabled) {
|
|
15536
16036
|
return;
|
|
15537
16037
|
}
|
|
@@ -15600,19 +16100,20 @@ var OffthreadVideoForRendering = ({
|
|
|
15600
16100
|
delayRenderTimeoutInMilliseconds,
|
|
15601
16101
|
onError,
|
|
15602
16102
|
continueRender,
|
|
16103
|
+
cancelRender,
|
|
15603
16104
|
delayRender
|
|
15604
16105
|
]);
|
|
15605
|
-
const onErr =
|
|
16106
|
+
const onErr = useCallback22(() => {
|
|
15606
16107
|
if (onError) {
|
|
15607
16108
|
onError?.(new Error("Failed to load image with src " + imageSrc));
|
|
15608
16109
|
} else {
|
|
15609
16110
|
cancelRender("Failed to load image with src " + imageSrc);
|
|
15610
16111
|
}
|
|
15611
|
-
}, [imageSrc, onError]);
|
|
15612
|
-
const className =
|
|
16112
|
+
}, [imageSrc, onError, cancelRender]);
|
|
16113
|
+
const className = useMemo47(() => {
|
|
15613
16114
|
return [OBJECTFIT_CONTAIN_CLASS_NAME, props.className].filter(truthy).join(" ");
|
|
15614
16115
|
}, [props.className]);
|
|
15615
|
-
const onImageFrame =
|
|
16116
|
+
const onImageFrame = useCallback22((img) => {
|
|
15616
16117
|
if (onVideoFrame) {
|
|
15617
16118
|
onVideoFrame(img);
|
|
15618
16119
|
}
|
|
@@ -15621,7 +16122,7 @@ var OffthreadVideoForRendering = ({
|
|
|
15621
16122
|
return null;
|
|
15622
16123
|
}
|
|
15623
16124
|
continueRender(imageSrc.handle);
|
|
15624
|
-
return /* @__PURE__ */
|
|
16125
|
+
return /* @__PURE__ */ jsx42(Img, {
|
|
15625
16126
|
src: imageSrc.src,
|
|
15626
16127
|
delayRenderRetries,
|
|
15627
16128
|
delayRenderTimeoutInMilliseconds,
|
|
@@ -15633,15 +16134,15 @@ var OffthreadVideoForRendering = ({
|
|
|
15633
16134
|
};
|
|
15634
16135
|
|
|
15635
16136
|
// src/video/VideoForPreview.tsx
|
|
15636
|
-
import
|
|
16137
|
+
import React52, {
|
|
15637
16138
|
forwardRef as forwardRef14,
|
|
15638
|
-
useCallback as
|
|
16139
|
+
useCallback as useCallback23,
|
|
15639
16140
|
useContext as useContext51,
|
|
15640
16141
|
useEffect as useEffect21,
|
|
15641
16142
|
useImperativeHandle as useImperativeHandle10,
|
|
15642
|
-
useMemo as
|
|
16143
|
+
useMemo as useMemo48,
|
|
15643
16144
|
useRef as useRef30,
|
|
15644
|
-
useState as
|
|
16145
|
+
useState as useState26
|
|
15645
16146
|
} from "react";
|
|
15646
16147
|
|
|
15647
16148
|
// src/video/emit-video-frame.ts
|
|
@@ -15690,14 +16191,14 @@ class MediaPlaybackError extends Error {
|
|
|
15690
16191
|
}
|
|
15691
16192
|
|
|
15692
16193
|
// src/video/VideoForPreview.tsx
|
|
15693
|
-
import { jsx as
|
|
16194
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
15694
16195
|
var VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
15695
16196
|
const context = useContext51(SharedAudioContext);
|
|
15696
16197
|
if (!context) {
|
|
15697
16198
|
throw new Error("SharedAudioContext not found");
|
|
15698
16199
|
}
|
|
15699
16200
|
const videoRef = useRef30(null);
|
|
15700
|
-
const sharedSource =
|
|
16201
|
+
const sharedSource = useMemo48(() => {
|
|
15701
16202
|
if (!context.audioContext) {
|
|
15702
16203
|
return null;
|
|
15703
16204
|
}
|
|
@@ -15706,13 +16207,9 @@ var VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
15706
16207
|
ref: videoRef
|
|
15707
16208
|
});
|
|
15708
16209
|
}, [context.audioContext]);
|
|
15709
|
-
const effectToUse =
|
|
16210
|
+
const effectToUse = React52.useInsertionEffect ?? React52.useLayoutEffect;
|
|
15710
16211
|
effectToUse(() => {
|
|
15711
|
-
return (
|
|
15712
|
-
requestAnimationFrame(() => {
|
|
15713
|
-
sharedSource?.cleanup();
|
|
15714
|
-
});
|
|
15715
|
-
};
|
|
16212
|
+
return scheduleMediaSourceCleanup.bind(null, sharedSource?.cleanup ?? null);
|
|
15716
16213
|
}, [sharedSource]);
|
|
15717
16214
|
const {
|
|
15718
16215
|
timelineId,
|
|
@@ -15798,7 +16295,7 @@ var VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
15798
16295
|
useImperativeHandle10(ref, () => {
|
|
15799
16296
|
return videoRef.current;
|
|
15800
16297
|
}, []);
|
|
15801
|
-
|
|
16298
|
+
useState26(() => playbackLogging({
|
|
15802
16299
|
logLevel,
|
|
15803
16300
|
message: `Mounting video with source = ${actualSrc}, v=${VERSION}, user agent=${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
|
|
15804
16301
|
tag: "video",
|
|
@@ -15844,26 +16341,8 @@ var VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
15844
16341
|
current.removeEventListener("error", errorHandler);
|
|
15845
16342
|
};
|
|
15846
16343
|
}, [onError, src]);
|
|
15847
|
-
const currentOnDurationCallback = useRef30(onDuration);
|
|
15848
|
-
currentOnDurationCallback.current = onDuration;
|
|
15849
16344
|
useEmitVideoFrame({ ref: videoRef, onVideoFrame });
|
|
15850
|
-
|
|
15851
|
-
const { current } = videoRef;
|
|
15852
|
-
if (!current) {
|
|
15853
|
-
return;
|
|
15854
|
-
}
|
|
15855
|
-
if (current.duration) {
|
|
15856
|
-
currentOnDurationCallback.current?.(src, current.duration);
|
|
15857
|
-
return;
|
|
15858
|
-
}
|
|
15859
|
-
const onLoadedMetadata = () => {
|
|
15860
|
-
currentOnDurationCallback.current?.(src, current.duration);
|
|
15861
|
-
};
|
|
15862
|
-
current.addEventListener("loadedmetadata", onLoadedMetadata);
|
|
15863
|
-
return () => {
|
|
15864
|
-
current.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
15865
|
-
};
|
|
15866
|
-
}, [src]);
|
|
16345
|
+
useMediaDuration(videoRef, onDuration, src, false);
|
|
15867
16346
|
useEffect21(() => {
|
|
15868
16347
|
const { current } = videoRef;
|
|
15869
16348
|
if (!current) {
|
|
@@ -15875,7 +16354,7 @@ var VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
15875
16354
|
current.preload = "auto";
|
|
15876
16355
|
}
|
|
15877
16356
|
}, []);
|
|
15878
|
-
const actualStyle =
|
|
16357
|
+
const actualStyle = useMemo48(() => {
|
|
15879
16358
|
return {
|
|
15880
16359
|
...style
|
|
15881
16360
|
};
|
|
@@ -15885,7 +16364,7 @@ var VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
15885
16364
|
requestsVideoFrame: Boolean(onVideoFrame),
|
|
15886
16365
|
isClientSideRendering: false
|
|
15887
16366
|
});
|
|
15888
|
-
const video = /* @__PURE__ */
|
|
16367
|
+
const video = /* @__PURE__ */ jsx43("video", {
|
|
15889
16368
|
...nativeProps,
|
|
15890
16369
|
ref: videoRef,
|
|
15891
16370
|
muted: isMutedForPlayback,
|
|
@@ -15912,7 +16391,7 @@ var VideoForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
15912
16391
|
loopVolumeCurveBehavior,
|
|
15913
16392
|
onlyWarnForMediaSeekingError
|
|
15914
16393
|
} = props;
|
|
15915
|
-
const [timelineId] =
|
|
16394
|
+
const [timelineId] = useState26(() => String(Math.random()));
|
|
15916
16395
|
const parentSequence = useContext51(SequenceContext);
|
|
15917
16396
|
const { isStudio } = useRemotionEnvironment();
|
|
15918
16397
|
const [mediaVolume] = useMediaVolumeState();
|
|
@@ -15927,7 +16406,7 @@ var VideoForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
15927
16406
|
volume: userPreferredVolume,
|
|
15928
16407
|
audioEnabled: true
|
|
15929
16408
|
});
|
|
15930
|
-
const getStack =
|
|
16409
|
+
const getStack = useCallback23(() => {
|
|
15931
16410
|
return _remotionInternalStack ?? null;
|
|
15932
16411
|
}, [_remotionInternalStack]);
|
|
15933
16412
|
const { automaticOutlineRef, registration } = useMediaInTimelineRegistration({
|
|
@@ -15944,17 +16423,17 @@ var VideoForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
15944
16423
|
documentationLink: onlyWarnForMediaSeekingError ? "https://www.remotion.dev/docs/offthreadvideo" : "https://www.remotion.dev/docs/html5-video",
|
|
15945
16424
|
muted: isMutedForTimeline
|
|
15946
16425
|
});
|
|
15947
|
-
const metadata =
|
|
16426
|
+
const metadata = useMemo48(() => isStudio || automaticOutlineRef || registration !== null ? {
|
|
15948
16427
|
type: "sequence",
|
|
15949
16428
|
id: timelineId,
|
|
15950
16429
|
value: registration,
|
|
15951
16430
|
outlineChildrenRef: automaticOutlineRef
|
|
15952
16431
|
} : null, [automaticOutlineRef, isStudio, registration, timelineId]);
|
|
15953
|
-
return /* @__PURE__ */
|
|
16432
|
+
return /* @__PURE__ */ jsx43(CommittedMetadataProvider, {
|
|
15954
16433
|
value: null,
|
|
15955
16434
|
_remotionCommitMetadata: metadata,
|
|
15956
|
-
children: /* @__PURE__ */
|
|
15957
|
-
children: /* @__PURE__ */
|
|
16435
|
+
children: /* @__PURE__ */ jsx43(SequenceContent, {
|
|
16436
|
+
children: /* @__PURE__ */ jsx43(VideoForPreviewContent, {
|
|
15958
16437
|
...props,
|
|
15959
16438
|
ref,
|
|
15960
16439
|
timelineId,
|
|
@@ -15967,7 +16446,7 @@ var VideoForPreviewRefForwardingFunction = (props, ref) => {
|
|
|
15967
16446
|
var VideoForPreview = forwardRef14(VideoForPreviewRefForwardingFunction);
|
|
15968
16447
|
|
|
15969
16448
|
// src/video/OffthreadVideo.tsx
|
|
15970
|
-
import { jsx as
|
|
16449
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
15971
16450
|
var InnerOffthreadVideo = (props) => {
|
|
15972
16451
|
const {
|
|
15973
16452
|
startFrom,
|
|
@@ -15986,7 +16465,7 @@ var InnerOffthreadVideo = (props) => {
|
|
|
15986
16465
|
if (environment.isClientSideRendering) {
|
|
15987
16466
|
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");
|
|
15988
16467
|
}
|
|
15989
|
-
const onDuration =
|
|
16468
|
+
const onDuration = useCallback24(() => {
|
|
15990
16469
|
return;
|
|
15991
16470
|
}, []);
|
|
15992
16471
|
if (typeof props.src !== "string") {
|
|
@@ -16011,15 +16490,15 @@ var InnerOffthreadVideo = (props) => {
|
|
|
16011
16490
|
trimBefore: trimBeforeValue
|
|
16012
16491
|
});
|
|
16013
16492
|
if (typeof trimBeforeValue !== "undefined" || typeof effectiveTrimAfter !== "undefined") {
|
|
16014
|
-
return /* @__PURE__ */
|
|
16493
|
+
return /* @__PURE__ */ jsx44(Html5MediaTrimContext.Provider, {
|
|
16015
16494
|
value: trimBeforeValue ?? 0,
|
|
16016
|
-
children: /* @__PURE__ */
|
|
16495
|
+
children: /* @__PURE__ */ jsx44(Sequence, {
|
|
16017
16496
|
layout: "none",
|
|
16018
16497
|
from: 0 - (trimBeforeValue ?? 0),
|
|
16019
16498
|
showInTimeline: false,
|
|
16020
16499
|
durationInFrames: effectiveTrimAfter === undefined ? undefined : (trimBeforeValue ?? 0) + (effectiveTrimAfter - (trimBeforeValue ?? 0)) / (props.playbackRate ?? 1),
|
|
16021
16500
|
name,
|
|
16022
|
-
children: /* @__PURE__ */
|
|
16501
|
+
children: /* @__PURE__ */ jsx44(InnerOffthreadVideo, {
|
|
16023
16502
|
pauseWhenBuffering: shouldPauseWhenBuffering,
|
|
16024
16503
|
...otherProps,
|
|
16025
16504
|
trimAfter: undefined,
|
|
@@ -16036,7 +16515,7 @@ var InnerOffthreadVideo = (props) => {
|
|
|
16036
16515
|
}
|
|
16037
16516
|
validateMediaProps(props, "Video");
|
|
16038
16517
|
if (environment.isRendering) {
|
|
16039
|
-
return /* @__PURE__ */
|
|
16518
|
+
return /* @__PURE__ */ jsx44(OffthreadVideoForRendering, {
|
|
16040
16519
|
pauseWhenBuffering: shouldPauseWhenBuffering,
|
|
16041
16520
|
...otherProps,
|
|
16042
16521
|
trimAfter: undefined,
|
|
@@ -16059,7 +16538,7 @@ var InnerOffthreadVideo = (props) => {
|
|
|
16059
16538
|
delayRenderTimeoutInMilliseconds,
|
|
16060
16539
|
...propsForPreview
|
|
16061
16540
|
} = otherProps;
|
|
16062
|
-
return /* @__PURE__ */
|
|
16541
|
+
return /* @__PURE__ */ jsx44(VideoForPreview, {
|
|
16063
16542
|
_remotionInternalStack: _remotionInternalStack ?? null,
|
|
16064
16543
|
onDuration,
|
|
16065
16544
|
onlyWarnForMediaSeekingError: true,
|
|
@@ -16109,7 +16588,7 @@ var OffthreadVideo = ({
|
|
|
16109
16588
|
if (imageFormat) {
|
|
16110
16589
|
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
16111
16590
|
}
|
|
16112
|
-
return /* @__PURE__ */
|
|
16591
|
+
return /* @__PURE__ */ jsx44(InnerOffthreadVideo, {
|
|
16113
16592
|
acceptableTimeShiftInSeconds,
|
|
16114
16593
|
allowAmplificationDuringRender: allowAmplificationDuringRender ?? true,
|
|
16115
16594
|
audioStreamIndex: audioStreamIndex ?? 0,
|
|
@@ -16183,31 +16662,31 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
16183
16662
|
};
|
|
16184
16663
|
|
|
16185
16664
|
// src/wrap-remotion-context.tsx
|
|
16186
|
-
import
|
|
16187
|
-
import { jsx as
|
|
16665
|
+
import React54, { useCallback as useCallback25, useMemo as useMemo49, useRef as useRef31, useState as useState27 } from "react";
|
|
16666
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
16188
16667
|
function useRemotionContexts() {
|
|
16189
|
-
const compositionManagerCtx =
|
|
16190
|
-
const videoContext =
|
|
16191
|
-
const timelineContext =
|
|
16192
|
-
const setTimelineContext =
|
|
16193
|
-
const sequenceContext =
|
|
16194
|
-
const defaultPremountInSeconds =
|
|
16195
|
-
const timelineTrackContext =
|
|
16196
|
-
const canUseRemotionHooksContext =
|
|
16197
|
-
const preloadContext =
|
|
16198
|
-
const resolveCompositionContext =
|
|
16199
|
-
const renderAssetManagerContext =
|
|
16200
|
-
const sequenceManagerActionsContext =
|
|
16201
|
-
const sequenceManagerRefContext =
|
|
16202
|
-
const sequenceRegistryContext =
|
|
16203
|
-
const sequenceRegistryScopeContext =
|
|
16204
|
-
const sequenceRegistrationContext =
|
|
16205
|
-
const disableSequenceRegistrationContext =
|
|
16206
|
-
const remotionEnvironmentContext =
|
|
16207
|
-
const visualModePropStatusesRefContext =
|
|
16208
|
-
const bufferManagerContext =
|
|
16209
|
-
const logLevelContext =
|
|
16210
|
-
return
|
|
16668
|
+
const compositionManagerCtx = React54.useContext(CompositionManager);
|
|
16669
|
+
const videoContext = React54.useContext(VideoContext);
|
|
16670
|
+
const timelineContext = React54.useContext(TimelineContext);
|
|
16671
|
+
const setTimelineContext = React54.useContext(SetTimelineContext);
|
|
16672
|
+
const sequenceContext = React54.useContext(SequenceContext);
|
|
16673
|
+
const defaultPremountInSeconds = React54.useContext(DefaultPremountContext);
|
|
16674
|
+
const timelineTrackContext = React54.useContext(TimelineTrackContext);
|
|
16675
|
+
const canUseRemotionHooksContext = React54.useContext(CanUseRemotionHooks);
|
|
16676
|
+
const preloadContext = React54.useContext(PreloadContext);
|
|
16677
|
+
const resolveCompositionContext = React54.useContext(ResolveCompositionContext);
|
|
16678
|
+
const renderAssetManagerContext = React54.useContext(RenderAssetManager);
|
|
16679
|
+
const sequenceManagerActionsContext = React54.useContext(SequenceManagerActionsContext);
|
|
16680
|
+
const sequenceManagerRefContext = React54.useContext(SequenceManagerRefContext);
|
|
16681
|
+
const sequenceRegistryContext = React54.useContext(SequenceRegistryContext);
|
|
16682
|
+
const sequenceRegistryScopeContext = React54.useContext(SequenceRegistryScopeContext);
|
|
16683
|
+
const sequenceRegistrationContext = React54.useContext(SequenceRegistrationContext);
|
|
16684
|
+
const disableSequenceRegistrationContext = React54.useContext(DisableSequenceRegistrationContext);
|
|
16685
|
+
const remotionEnvironmentContext = React54.useContext(RemotionEnvironmentContext);
|
|
16686
|
+
const visualModePropStatusesRefContext = React54.useContext(VisualModePropStatusesRefContext);
|
|
16687
|
+
const bufferManagerContext = React54.useContext(BufferingContextReact);
|
|
16688
|
+
const logLevelContext = React54.useContext(LogLevelContext);
|
|
16689
|
+
return useMemo49(() => ({
|
|
16211
16690
|
compositionManagerCtx,
|
|
16212
16691
|
videoContext,
|
|
16213
16692
|
timelineContext,
|
|
@@ -16258,8 +16737,8 @@ var ForwardedSequenceRegistry = ({
|
|
|
16258
16737
|
contexts,
|
|
16259
16738
|
children
|
|
16260
16739
|
}) => {
|
|
16261
|
-
const [scopeId] =
|
|
16262
|
-
const [observerAvailable, setObserverAvailable] =
|
|
16740
|
+
const [scopeId] = useState27(() => String(Math.random()));
|
|
16741
|
+
const [observerAvailable, setObserverAvailable] = useState27(isCommitRegistrationObserverInstalled);
|
|
16263
16742
|
const observedCommitRef = useRef31(false);
|
|
16264
16743
|
const observerFailedRef = useRef31(false);
|
|
16265
16744
|
const unmountedRef = useRef31(false);
|
|
@@ -16268,14 +16747,14 @@ var ForwardedSequenceRegistry = ({
|
|
|
16268
16747
|
const scope = contexts.sequenceRegistryScopeContext;
|
|
16269
16748
|
const activeRegistryRef = useRef31(registry);
|
|
16270
16749
|
const commitRegistrationEnabled = scope?.commitRegistrationRequested === true && registry !== null && observerAvailable;
|
|
16271
|
-
const onCommitSequences =
|
|
16750
|
+
const onCommitSequences = useCallback25((sequences, sequenceIds) => {
|
|
16272
16751
|
if (observerFailedRef.current && sequenceIds.length > 0) {
|
|
16273
16752
|
return;
|
|
16274
16753
|
}
|
|
16275
16754
|
observedCommitRef.current = true;
|
|
16276
16755
|
scope?.onCommitSequences(scopeId, sequences, sequenceIds);
|
|
16277
16756
|
}, [scope, scopeId]);
|
|
16278
|
-
const useIsomorphicLayoutEffect = typeof window === "undefined" ?
|
|
16757
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? React54.useEffect : React54.useLayoutEffect;
|
|
16279
16758
|
useIsomorphicLayoutEffect(() => {
|
|
16280
16759
|
if (scope === null || typeof window === "undefined") {
|
|
16281
16760
|
return;
|
|
@@ -16314,19 +16793,19 @@ var ForwardedSequenceRegistry = ({
|
|
|
16314
16793
|
});
|
|
16315
16794
|
};
|
|
16316
16795
|
}, [scope, scopeId, registry, commitRegistrationEnabled]);
|
|
16317
|
-
const metadata =
|
|
16796
|
+
const metadata = useMemo49(() => ({
|
|
16318
16797
|
type: "sequence-manager",
|
|
16319
16798
|
id: scopeId,
|
|
16320
16799
|
onCommit: commitRegistrationEnabled ? onCommitSequences : null
|
|
16321
16800
|
}), [commitRegistrationEnabled, onCommitSequences, scopeId]);
|
|
16322
|
-
return /* @__PURE__ */
|
|
16801
|
+
return /* @__PURE__ */ jsx45(SequenceRegistryScopeProvider, {
|
|
16323
16802
|
value: scope,
|
|
16324
16803
|
_remotionCommitMetadata: metadata,
|
|
16325
|
-
children: /* @__PURE__ */
|
|
16804
|
+
children: /* @__PURE__ */ jsx45(SequenceManagerActionsContext.Provider, {
|
|
16326
16805
|
value: contexts.sequenceManagerActionsContext,
|
|
16327
|
-
children: /* @__PURE__ */
|
|
16806
|
+
children: /* @__PURE__ */ jsx45(SequenceRegistryContext.Provider, {
|
|
16328
16807
|
value: registry,
|
|
16329
|
-
children: /* @__PURE__ */
|
|
16808
|
+
children: /* @__PURE__ */ jsx45(SequenceCommitRegistrationContext.Provider, {
|
|
16330
16809
|
value: commitRegistrationEnabled,
|
|
16331
16810
|
children
|
|
16332
16811
|
})
|
|
@@ -16336,43 +16815,43 @@ var ForwardedSequenceRegistry = ({
|
|
|
16336
16815
|
};
|
|
16337
16816
|
var RemotionContextProvider = (props) => {
|
|
16338
16817
|
const { children, contexts } = props;
|
|
16339
|
-
return /* @__PURE__ */
|
|
16818
|
+
return /* @__PURE__ */ jsx45(LogLevelContext.Provider, {
|
|
16340
16819
|
value: contexts.logLevelContext,
|
|
16341
|
-
children: /* @__PURE__ */
|
|
16820
|
+
children: /* @__PURE__ */ jsx45(CanUseRemotionHooks.Provider, {
|
|
16342
16821
|
value: contexts.canUseRemotionHooksContext,
|
|
16343
|
-
children: /* @__PURE__ */
|
|
16822
|
+
children: /* @__PURE__ */ jsx45(PreloadContext.Provider, {
|
|
16344
16823
|
value: contexts.preloadContext,
|
|
16345
|
-
children: /* @__PURE__ */
|
|
16824
|
+
children: /* @__PURE__ */ jsx45(CompositionManager.Provider, {
|
|
16346
16825
|
value: contexts.compositionManagerCtx,
|
|
16347
|
-
children: /* @__PURE__ */
|
|
16826
|
+
children: /* @__PURE__ */ jsx45(SequenceManagerRefContext.Provider, {
|
|
16348
16827
|
value: contexts.sequenceManagerRefContext,
|
|
16349
|
-
children: /* @__PURE__ */
|
|
16828
|
+
children: /* @__PURE__ */ jsx45(RemotionEnvironmentContext.Provider, {
|
|
16350
16829
|
value: contexts.remotionEnvironmentContext,
|
|
16351
|
-
children: /* @__PURE__ */
|
|
16830
|
+
children: /* @__PURE__ */ jsx45(SequenceRegistrationContext.Provider, {
|
|
16352
16831
|
value: contexts.sequenceRegistrationContext,
|
|
16353
|
-
children: /* @__PURE__ */
|
|
16832
|
+
children: /* @__PURE__ */ jsx45(DisableSequenceRegistrationContext.Provider, {
|
|
16354
16833
|
value: contexts.disableSequenceRegistrationContext,
|
|
16355
|
-
children: /* @__PURE__ */
|
|
16834
|
+
children: /* @__PURE__ */ jsx45(ForwardedSequenceRegistry, {
|
|
16356
16835
|
contexts,
|
|
16357
|
-
children: /* @__PURE__ */
|
|
16836
|
+
children: /* @__PURE__ */ jsx45(VisualModePropStatusesRefContext.Provider, {
|
|
16358
16837
|
value: contexts.visualModePropStatusesRefContext,
|
|
16359
|
-
children: /* @__PURE__ */
|
|
16838
|
+
children: /* @__PURE__ */ jsx45(RenderAssetManager.Provider, {
|
|
16360
16839
|
value: contexts.renderAssetManagerContext,
|
|
16361
|
-
children: /* @__PURE__ */
|
|
16840
|
+
children: /* @__PURE__ */ jsx45(ResolveCompositionContext.Provider, {
|
|
16362
16841
|
value: contexts.resolveCompositionContext,
|
|
16363
|
-
children: /* @__PURE__ */
|
|
16842
|
+
children: /* @__PURE__ */ jsx45(TimelineContext.Provider, {
|
|
16364
16843
|
value: contexts.timelineContext,
|
|
16365
|
-
children: /* @__PURE__ */
|
|
16844
|
+
children: /* @__PURE__ */ jsx45(SetTimelineContext.Provider, {
|
|
16366
16845
|
value: contexts.setTimelineContext,
|
|
16367
|
-
children: /* @__PURE__ */
|
|
16846
|
+
children: /* @__PURE__ */ jsx45(SequenceContext.Provider, {
|
|
16368
16847
|
value: contexts.sequenceContext,
|
|
16369
|
-
children: /* @__PURE__ */
|
|
16848
|
+
children: /* @__PURE__ */ jsx45(BufferingContextReact.Provider, {
|
|
16370
16849
|
value: contexts.bufferManagerContext,
|
|
16371
|
-
children: /* @__PURE__ */
|
|
16850
|
+
children: /* @__PURE__ */ jsx45(TimelineTrackContext.Provider, {
|
|
16372
16851
|
value: contexts.timelineTrackContext,
|
|
16373
|
-
children: /* @__PURE__ */
|
|
16852
|
+
children: /* @__PURE__ */ jsx45(DefaultPremountContext.Provider, {
|
|
16374
16853
|
value: contexts.defaultPremountInSeconds,
|
|
16375
|
-
children: /* @__PURE__ */
|
|
16854
|
+
children: /* @__PURE__ */ jsx45(VideoContext.Provider, {
|
|
16376
16855
|
value: contexts.videoContext,
|
|
16377
16856
|
children
|
|
16378
16857
|
})
|
|
@@ -16399,6 +16878,8 @@ var RemotionContextProvider = (props) => {
|
|
|
16399
16878
|
// src/internals.ts
|
|
16400
16879
|
var compositionSelectorRef = createRef3();
|
|
16401
16880
|
var Internals = {
|
|
16881
|
+
HtmlInCanvasFallback,
|
|
16882
|
+
useHtmlInCanvasUnsupportedMessage,
|
|
16402
16883
|
OptimisticSequenceDeletion,
|
|
16403
16884
|
usePendingSequenceDeletions,
|
|
16404
16885
|
createElementSourceProxy,
|
|
@@ -16437,6 +16918,7 @@ var Internals = {
|
|
|
16437
16918
|
CompositionSetters,
|
|
16438
16919
|
VisualModePropStatusesContext,
|
|
16439
16920
|
VisualModePropStatusesRefContext,
|
|
16921
|
+
VisualModePropStatusesSubscriptionContext,
|
|
16440
16922
|
VisualModeBatchSettersContext,
|
|
16441
16923
|
VisualModeDragOverridesContext,
|
|
16442
16924
|
VisualModeDragOverridesRefContext,
|
|
@@ -16574,6 +17056,7 @@ var Internals = {
|
|
|
16574
17056
|
DelayRenderContextType,
|
|
16575
17057
|
TimelineContext,
|
|
16576
17058
|
usePlaying,
|
|
17059
|
+
PlaybackPitchContext,
|
|
16577
17060
|
PlaybackRateContext,
|
|
16578
17061
|
AbsoluteTimeContext,
|
|
16579
17062
|
RenderAssetManagerProvider,
|
|
@@ -16584,8 +17067,10 @@ var Internals = {
|
|
|
16584
17067
|
cleanupEffectChainState,
|
|
16585
17068
|
runEffectChain,
|
|
16586
17069
|
useMemoizedEffects,
|
|
17070
|
+
subscribeToEffectSource,
|
|
16587
17071
|
useMemoizedEffectDefinitions,
|
|
16588
17072
|
createEffect,
|
|
17073
|
+
createCurveSampler,
|
|
16589
17074
|
createWebGLContextError,
|
|
16590
17075
|
createWebGL2ContextError,
|
|
16591
17076
|
computeEffectiveSchemaValuesDotNotation,
|
|
@@ -16614,17 +17099,17 @@ Object.assign(Internals, { useSyncExternalStore: useSyncExternalStore2 });
|
|
|
16614
17099
|
// src/font-face-registry.ts
|
|
16615
17100
|
var fontDataByUrl = new Map;
|
|
16616
17101
|
// src/series/index.tsx
|
|
16617
|
-
import
|
|
17102
|
+
import React56, {
|
|
16618
17103
|
forwardRef as forwardRef15,
|
|
16619
|
-
useMemo as
|
|
17104
|
+
useMemo as useMemo50
|
|
16620
17105
|
} from "react";
|
|
16621
17106
|
|
|
16622
17107
|
// src/series/flatten-children.tsx
|
|
16623
|
-
import
|
|
17108
|
+
import React55 from "react";
|
|
16624
17109
|
var flattenChildren = (children) => {
|
|
16625
|
-
const childrenArray =
|
|
17110
|
+
const childrenArray = React55.Children.toArray(children);
|
|
16626
17111
|
return childrenArray.reduce((flatChildren, child) => {
|
|
16627
|
-
if (child.type ===
|
|
17112
|
+
if (child.type === React55.Fragment) {
|
|
16628
17113
|
return flatChildren.concat(flattenChildren(child.props.children));
|
|
16629
17114
|
}
|
|
16630
17115
|
flatChildren.push(child);
|
|
@@ -16633,7 +17118,7 @@ var flattenChildren = (children) => {
|
|
|
16633
17118
|
};
|
|
16634
17119
|
|
|
16635
17120
|
// src/series/index.tsx
|
|
16636
|
-
import { jsx as
|
|
17121
|
+
import { jsx as jsx46, jsxs as jsxs5, Fragment } from "react/jsx-runtime";
|
|
16637
17122
|
var seriesSequenceSchema = {
|
|
16638
17123
|
durationInFrames: Interactive.baseSchema.durationInFrames,
|
|
16639
17124
|
name: Interactive.sequenceSchema.name,
|
|
@@ -16649,7 +17134,7 @@ var SeriesSequenceInner = forwardRef15(({ offset = 0, className = "", _remotionI
|
|
|
16649
17134
|
if (_remotionInternalRender) {
|
|
16650
17135
|
return _remotionInternalRender({ ...props, offset, className: className || undefined }, ref);
|
|
16651
17136
|
}
|
|
16652
|
-
return /* @__PURE__ */
|
|
17137
|
+
return /* @__PURE__ */ jsx46(IsNotInsideSeriesProvider, {
|
|
16653
17138
|
children: props.children
|
|
16654
17139
|
});
|
|
16655
17140
|
});
|
|
@@ -16688,7 +17173,7 @@ var validateSeriesSequenceProps = ({
|
|
|
16688
17173
|
};
|
|
16689
17174
|
var SeriesInner = (props) => {
|
|
16690
17175
|
const pendingDeletions = usePendingSequenceDeletions();
|
|
16691
|
-
const childrenValue =
|
|
17176
|
+
const childrenValue = useMemo50(() => {
|
|
16692
17177
|
const flattenedChildren = flattenChildren(props.children).filter((child) => !OptimisticSequenceDeletion.isElementDeleted(child, pendingDeletions));
|
|
16693
17178
|
const renderChildren = (i, startFrame) => {
|
|
16694
17179
|
if (i === flattenedChildren.length) {
|
|
@@ -16712,7 +17197,7 @@ var SeriesInner = (props) => {
|
|
|
16712
17197
|
index: i,
|
|
16713
17198
|
childrenLength: flattenedChildren.length
|
|
16714
17199
|
});
|
|
16715
|
-
return
|
|
17200
|
+
return React56.cloneElement(castedElement, {
|
|
16716
17201
|
_remotionInternalRender: (resolvedProps, ref) => {
|
|
16717
17202
|
const durationInFramesProp = resolvedProps.durationInFrames;
|
|
16718
17203
|
const timelineDurationInFrames = durationInFramesProp / (resolvedProps.playbackRate ?? 1);
|
|
@@ -16736,9 +17221,9 @@ var SeriesInner = (props) => {
|
|
|
16736
17221
|
});
|
|
16737
17222
|
const currentStartFrame = startFrame + offset;
|
|
16738
17223
|
const nextStartFrame = startFrame + timelineDurationInFrames + offset;
|
|
16739
|
-
return /* @__PURE__ */
|
|
17224
|
+
return /* @__PURE__ */ jsxs5(Fragment, {
|
|
16740
17225
|
children: [
|
|
16741
|
-
/* @__PURE__ */
|
|
17226
|
+
/* @__PURE__ */ jsx46(SequenceWithoutSchemaWithRef, {
|
|
16742
17227
|
ref,
|
|
16743
17228
|
name: name || "<Series.Sequence>",
|
|
16744
17229
|
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series",
|
|
@@ -16750,7 +17235,7 @@ var SeriesInner = (props) => {
|
|
|
16750
17235
|
role: "clip",
|
|
16751
17236
|
seriesOffset: offset
|
|
16752
17237
|
},
|
|
16753
|
-
children: /* @__PURE__ */
|
|
17238
|
+
children: /* @__PURE__ */ jsx46(IsNotInsideSeriesProvider, {
|
|
16754
17239
|
children: sequenceChildren
|
|
16755
17240
|
})
|
|
16756
17241
|
}),
|
|
@@ -16762,12 +17247,12 @@ var SeriesInner = (props) => {
|
|
|
16762
17247
|
};
|
|
16763
17248
|
return renderChildren(0, 0);
|
|
16764
17249
|
}, [props.children, pendingDeletions]);
|
|
16765
|
-
return /* @__PURE__ */
|
|
17250
|
+
return /* @__PURE__ */ jsx46(TrackWithoutSchema, {
|
|
16766
17251
|
layout: "none",
|
|
16767
17252
|
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series",
|
|
16768
17253
|
...props,
|
|
16769
17254
|
name: props.name ?? "<Series>",
|
|
16770
|
-
children: /* @__PURE__ */
|
|
17255
|
+
children: /* @__PURE__ */ jsx46(IsInsideSeriesContainer, {
|
|
16771
17256
|
children: childrenValue
|
|
16772
17257
|
})
|
|
16773
17258
|
});
|
|
@@ -16881,18 +17366,18 @@ var staticFile = (path) => {
|
|
|
16881
17366
|
return preparsed;
|
|
16882
17367
|
};
|
|
16883
17368
|
// src/Still.tsx
|
|
16884
|
-
import
|
|
17369
|
+
import React57 from "react";
|
|
16885
17370
|
var Still = (props) => {
|
|
16886
17371
|
const newProps = {
|
|
16887
17372
|
...props,
|
|
16888
17373
|
durationInFrames: 1,
|
|
16889
17374
|
fps: 1
|
|
16890
17375
|
};
|
|
16891
|
-
return
|
|
17376
|
+
return React57.createElement(Composition, newProps);
|
|
16892
17377
|
};
|
|
16893
17378
|
addSequenceStackTraces(Still);
|
|
16894
17379
|
// src/video/html5-video.tsx
|
|
16895
|
-
import { forwardRef as forwardRef17,
|
|
17380
|
+
import { forwardRef as forwardRef17, useContext as useContext53, useMemo as useMemo52 } from "react";
|
|
16896
17381
|
|
|
16897
17382
|
// src/video/VideoForRendering.tsx
|
|
16898
17383
|
import {
|
|
@@ -16900,8 +17385,8 @@ import {
|
|
|
16900
17385
|
useContext as useContext52,
|
|
16901
17386
|
useEffect as useEffect22,
|
|
16902
17387
|
useImperativeHandle as useImperativeHandle11,
|
|
16903
|
-
useLayoutEffect as
|
|
16904
|
-
useMemo as
|
|
17388
|
+
useLayoutEffect as useLayoutEffect23,
|
|
17389
|
+
useMemo as useMemo51,
|
|
16905
17390
|
useRef as useRef32
|
|
16906
17391
|
} from "react";
|
|
16907
17392
|
|
|
@@ -17030,7 +17515,7 @@ var seekToTimeMultipleUntilRight = ({
|
|
|
17030
17515
|
};
|
|
17031
17516
|
|
|
17032
17517
|
// src/video/VideoForRendering.tsx
|
|
17033
|
-
import { jsx as
|
|
17518
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
17034
17519
|
var VideoForRenderingForwardFunction = ({
|
|
17035
17520
|
onError,
|
|
17036
17521
|
volume: volumeProp,
|
|
@@ -17045,7 +17530,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
17045
17530
|
loopVolumeCurveBehavior,
|
|
17046
17531
|
audioStreamIndex,
|
|
17047
17532
|
onVideoFrame,
|
|
17048
|
-
preservePitch
|
|
17533
|
+
preservePitch,
|
|
17049
17534
|
...props
|
|
17050
17535
|
}, ref) => {
|
|
17051
17536
|
const absoluteFrame = useTimelinePosition();
|
|
@@ -17061,7 +17546,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
17061
17546
|
const mountTime = useMountTime();
|
|
17062
17547
|
const { delayRender, continueRender } = useDelayRender();
|
|
17063
17548
|
const { registerRenderAsset, unregisterRenderAsset } = useContext52(RenderAssetManager);
|
|
17064
|
-
const id =
|
|
17549
|
+
const id = useMemo51(() => `video-${random(props.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
17065
17550
|
props.src,
|
|
17066
17551
|
sequenceContext?.cumulatedFrom,
|
|
17067
17552
|
sequenceContext?.relativeFrom,
|
|
@@ -17099,7 +17584,8 @@ var VideoForRenderingForwardFunction = ({
|
|
|
17099
17584
|
playbackRate: (playbackRate ?? 1) * sequencePlaybackRate,
|
|
17100
17585
|
toneFrequency: toneFrequency ?? 1,
|
|
17101
17586
|
audioStartFrame,
|
|
17102
|
-
audioStreamIndex: audioStreamIndex ?? 0
|
|
17587
|
+
audioStreamIndex: audioStreamIndex ?? 0,
|
|
17588
|
+
preservePitch: preservePitch ?? true
|
|
17103
17589
|
});
|
|
17104
17590
|
return () => unregisterRenderAsset(id);
|
|
17105
17591
|
}, [
|
|
@@ -17115,7 +17601,8 @@ var VideoForRenderingForwardFunction = ({
|
|
|
17115
17601
|
toneFrequency,
|
|
17116
17602
|
audioStartFrame,
|
|
17117
17603
|
sequencePlaybackRate,
|
|
17118
|
-
audioStreamIndex
|
|
17604
|
+
audioStreamIndex,
|
|
17605
|
+
preservePitch
|
|
17119
17606
|
]);
|
|
17120
17607
|
useImperativeHandle11(ref, () => {
|
|
17121
17608
|
return videoRef.current;
|
|
@@ -17211,7 +17698,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
17211
17698
|
]);
|
|
17212
17699
|
const { src } = props;
|
|
17213
17700
|
if (environment.isRendering) {
|
|
17214
|
-
|
|
17701
|
+
useLayoutEffect23(() => {
|
|
17215
17702
|
if (window.process?.env?.NODE_ENV === "test") {
|
|
17216
17703
|
return;
|
|
17217
17704
|
}
|
|
@@ -17245,7 +17732,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
17245
17732
|
delayRender
|
|
17246
17733
|
]);
|
|
17247
17734
|
}
|
|
17248
|
-
return /* @__PURE__ */
|
|
17735
|
+
return /* @__PURE__ */ jsx47("video", {
|
|
17249
17736
|
ref: videoRef,
|
|
17250
17737
|
disableRemotePlayback: true,
|
|
17251
17738
|
...props
|
|
@@ -17254,7 +17741,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
17254
17741
|
var VideoForRendering = forwardRef16(VideoForRenderingForwardFunction);
|
|
17255
17742
|
|
|
17256
17743
|
// src/video/html5-video.tsx
|
|
17257
|
-
import { jsx as
|
|
17744
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
17258
17745
|
var VideoForwardingFunction = (props, ref) => {
|
|
17259
17746
|
const {
|
|
17260
17747
|
startFrom,
|
|
@@ -17286,9 +17773,7 @@ var VideoForwardingFunction = (props, ref) => {
|
|
|
17286
17773
|
throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
17287
17774
|
}
|
|
17288
17775
|
const preloadedSrc = usePreload(props.src);
|
|
17289
|
-
const onDuration =
|
|
17290
|
-
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
17291
|
-
}, [setDurations]);
|
|
17776
|
+
const onDuration = useMemo52(() => onMediaDuration.bind(null, setDurations), [setDurations]);
|
|
17292
17777
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props.src)];
|
|
17293
17778
|
validateMediaTrimProps({ startFrom, endAt, trimBefore, trimAfter });
|
|
17294
17779
|
if (durationInFrames !== undefined) {
|
|
@@ -17311,14 +17796,14 @@ var VideoForwardingFunction = (props, ref) => {
|
|
|
17311
17796
|
const loopDuration = effectiveTrimAfter ?? (durationFetched === undefined ? undefined : durationFetched * fps);
|
|
17312
17797
|
if (loop && loopDuration !== undefined) {
|
|
17313
17798
|
if (!Number.isFinite(loopDuration)) {
|
|
17314
|
-
return /* @__PURE__ */
|
|
17799
|
+
return /* @__PURE__ */ jsx48(Html5Video, {
|
|
17315
17800
|
...propsOtherThanLoop,
|
|
17316
17801
|
ref,
|
|
17317
17802
|
_remotionInternalStack,
|
|
17318
17803
|
_remotionInternalNativeLoopPassed: true
|
|
17319
17804
|
});
|
|
17320
17805
|
}
|
|
17321
|
-
return /* @__PURE__ */
|
|
17806
|
+
return /* @__PURE__ */ jsx48(Loop, {
|
|
17322
17807
|
durationInFrames: calculateMediaDuration({
|
|
17323
17808
|
trimAfter: effectiveTrimAfter,
|
|
17324
17809
|
mediaDurationInFrames: loopDuration,
|
|
@@ -17328,7 +17813,7 @@ var VideoForwardingFunction = (props, ref) => {
|
|
|
17328
17813
|
layout: "none",
|
|
17329
17814
|
name,
|
|
17330
17815
|
showInTimeline: false,
|
|
17331
|
-
children: /* @__PURE__ */
|
|
17816
|
+
children: /* @__PURE__ */ jsx48(Html5Video, {
|
|
17332
17817
|
...propsOtherThanLoop,
|
|
17333
17818
|
ref,
|
|
17334
17819
|
_remotionInternalStack,
|
|
@@ -17337,15 +17822,15 @@ var VideoForwardingFunction = (props, ref) => {
|
|
|
17337
17822
|
});
|
|
17338
17823
|
}
|
|
17339
17824
|
if (typeof trimBeforeValue !== "undefined" || typeof effectiveTrimAfter !== "undefined") {
|
|
17340
|
-
return /* @__PURE__ */
|
|
17825
|
+
return /* @__PURE__ */ jsx48(Html5MediaTrimContext.Provider, {
|
|
17341
17826
|
value: trimBeforeValue ?? 0,
|
|
17342
|
-
children: /* @__PURE__ */
|
|
17827
|
+
children: /* @__PURE__ */ jsx48(Sequence, {
|
|
17343
17828
|
layout: "none",
|
|
17344
17829
|
from: 0 - (trimBeforeValue ?? 0),
|
|
17345
17830
|
showInTimeline: false,
|
|
17346
17831
|
durationInFrames: effectiveTrimAfter === undefined ? undefined : (trimBeforeValue ?? 0) + (effectiveTrimAfter - (trimBeforeValue ?? 0)) / (props.playbackRate ?? 1),
|
|
17347
17832
|
name,
|
|
17348
|
-
children: /* @__PURE__ */
|
|
17833
|
+
children: /* @__PURE__ */ jsx48(Html5Video, {
|
|
17349
17834
|
pauseWhenBuffering: shouldPauseWhenBuffering,
|
|
17350
17835
|
onVideoFrame,
|
|
17351
17836
|
...otherProps,
|
|
@@ -17362,14 +17847,14 @@ var VideoForwardingFunction = (props, ref) => {
|
|
|
17362
17847
|
volume: props.volume
|
|
17363
17848
|
}, "Html5Video");
|
|
17364
17849
|
if (environment.isRendering) {
|
|
17365
|
-
return /* @__PURE__ */
|
|
17850
|
+
return /* @__PURE__ */ jsx48(VideoForRendering, {
|
|
17366
17851
|
onDuration,
|
|
17367
17852
|
onVideoFrame: onVideoFrame ?? null,
|
|
17368
17853
|
...otherProps,
|
|
17369
17854
|
ref
|
|
17370
17855
|
});
|
|
17371
17856
|
}
|
|
17372
|
-
return /* @__PURE__ */
|
|
17857
|
+
return /* @__PURE__ */ jsx48(VideoForPreview, {
|
|
17373
17858
|
onlyWarnForMediaSeekingError: false,
|
|
17374
17859
|
...otherProps,
|
|
17375
17860
|
ref,
|