remotion 4.0.413 → 4.0.415
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/RemotionRoot.d.ts +1 -0
- package/dist/cjs/RemotionRoot.js +4 -25
- package/dist/cjs/ResolveCompositionConfig.d.ts +0 -4
- package/dist/cjs/ResolveCompositionConfig.js +1 -272
- package/dist/cjs/internals.d.ts +32 -4
- package/dist/cjs/internals.js +2 -2
- package/dist/cjs/nonce.d.ts +0 -6
- package/dist/cjs/nonce.js +1 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +494 -785
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/esm/index.mjs
CHANGED
|
@@ -110,7 +110,7 @@ function truthy(value) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// src/version.ts
|
|
113
|
-
var VERSION = "4.0.
|
|
113
|
+
var VERSION = "4.0.415";
|
|
114
114
|
|
|
115
115
|
// src/multiple-versions-warning.ts
|
|
116
116
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -150,9 +150,9 @@ var Null = () => {
|
|
|
150
150
|
import {
|
|
151
151
|
forwardRef as forwardRef2,
|
|
152
152
|
useContext as useContext13,
|
|
153
|
-
useEffect as
|
|
153
|
+
useEffect as useEffect2,
|
|
154
154
|
useMemo as useMemo10,
|
|
155
|
-
useState as
|
|
155
|
+
useState as useState5
|
|
156
156
|
} from "react";
|
|
157
157
|
|
|
158
158
|
// src/AbsoluteFill.tsx
|
|
@@ -308,11 +308,11 @@ var SequenceManagerProvider = ({ children }) => {
|
|
|
308
308
|
|
|
309
309
|
// src/TimelineContext.tsx
|
|
310
310
|
import {
|
|
311
|
-
createContext as
|
|
311
|
+
createContext as createContext9,
|
|
312
312
|
useLayoutEffect,
|
|
313
313
|
useMemo as useMemo7,
|
|
314
|
-
useRef
|
|
315
|
-
useState as
|
|
314
|
+
useRef,
|
|
315
|
+
useState as useState3
|
|
316
316
|
} from "react";
|
|
317
317
|
|
|
318
318
|
// src/random.ts
|
|
@@ -359,7 +359,7 @@ __export(exports_timeline_position_state, {
|
|
|
359
359
|
getInitialFrameState: () => getInitialFrameState,
|
|
360
360
|
getFrameForComposition: () => getFrameForComposition
|
|
361
361
|
});
|
|
362
|
-
import { useContext as
|
|
362
|
+
import { useContext as useContext5, useMemo as useMemo6 } from "react";
|
|
363
363
|
|
|
364
364
|
// src/use-remotion-environment.ts
|
|
365
365
|
import { useContext as useContext2, useState as useState2 } from "react";
|
|
@@ -376,7 +376,7 @@ var useRemotionEnvironment = () => {
|
|
|
376
376
|
};
|
|
377
377
|
|
|
378
378
|
// src/use-video.ts
|
|
379
|
-
import { useContext as
|
|
379
|
+
import { useContext as useContext4, useMemo as useMemo5 } from "react";
|
|
380
380
|
|
|
381
381
|
// src/CompositionManagerContext.tsx
|
|
382
382
|
import { createContext as createContext4 } from "react";
|
|
@@ -409,16 +409,7 @@ var CompositionSetters = createContext4({
|
|
|
409
409
|
});
|
|
410
410
|
|
|
411
411
|
// src/ResolveCompositionConfig.tsx
|
|
412
|
-
import {
|
|
413
|
-
createContext as createContext7,
|
|
414
|
-
createRef,
|
|
415
|
-
useCallback as useCallback3,
|
|
416
|
-
useContext as useContext4,
|
|
417
|
-
useEffect as useEffect2,
|
|
418
|
-
useImperativeHandle as useImperativeHandle2,
|
|
419
|
-
useMemo as useMemo4,
|
|
420
|
-
useState as useState4
|
|
421
|
-
} from "react";
|
|
412
|
+
import { createContext as createContext6, createRef, useContext as useContext3, useMemo as useMemo4 } from "react";
|
|
422
413
|
|
|
423
414
|
// src/EditorProps.tsx
|
|
424
415
|
import React5, {
|
|
@@ -597,58 +588,6 @@ var getInputProps = () => {
|
|
|
597
588
|
return parsed;
|
|
598
589
|
};
|
|
599
590
|
|
|
600
|
-
// src/nonce.ts
|
|
601
|
-
import { createContext as createContext6, useContext as useContext3, useEffect, useRef, useState as useState3 } from "react";
|
|
602
|
-
var NonceContext = createContext6({
|
|
603
|
-
getNonce: () => 0,
|
|
604
|
-
fastRefreshes: 0,
|
|
605
|
-
manualRefreshes: 0
|
|
606
|
-
});
|
|
607
|
-
var SetNonceContext = createContext6({
|
|
608
|
-
increaseManualRefreshes: () => {}
|
|
609
|
-
});
|
|
610
|
-
var useNonce = () => {
|
|
611
|
-
const context = useContext3(NonceContext);
|
|
612
|
-
const [nonce, setNonce] = useState3(() => context.getNonce());
|
|
613
|
-
const lastContext = useRef(context);
|
|
614
|
-
useEffect(() => {
|
|
615
|
-
if (lastContext.current === context) {
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
lastContext.current = context;
|
|
619
|
-
setNonce(context.getNonce);
|
|
620
|
-
}, [context]);
|
|
621
|
-
return nonce;
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
// src/codec.ts
|
|
625
|
-
var validCodecs = [
|
|
626
|
-
"h264",
|
|
627
|
-
"h265",
|
|
628
|
-
"vp8",
|
|
629
|
-
"vp9",
|
|
630
|
-
"mp3",
|
|
631
|
-
"aac",
|
|
632
|
-
"wav",
|
|
633
|
-
"prores",
|
|
634
|
-
"h264-mkv",
|
|
635
|
-
"h264-ts",
|
|
636
|
-
"gif"
|
|
637
|
-
];
|
|
638
|
-
|
|
639
|
-
// src/validation/validate-default-codec.ts
|
|
640
|
-
function validateCodec(defaultCodec, location, name) {
|
|
641
|
-
if (typeof defaultCodec === "undefined") {
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
if (typeof defaultCodec !== "string") {
|
|
645
|
-
throw new TypeError(`The "${name}" prop ${location} must be a string, but you passed a value of type ${typeof defaultCodec}.`);
|
|
646
|
-
}
|
|
647
|
-
if (!validCodecs.includes(defaultCodec)) {
|
|
648
|
-
throw new Error(`The "${name}" prop ${location} must be one of ${validCodecs.join(", ")}, but you passed ${defaultCodec}.`);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
591
|
// src/validation/validate-dimensions.ts
|
|
653
592
|
function validateDimension(amount, nameOfProp, location) {
|
|
654
593
|
if (typeof amount !== "number") {
|
|
@@ -707,412 +646,17 @@ function validateFps(fps, location, isGif) {
|
|
|
707
646
|
}
|
|
708
647
|
}
|
|
709
648
|
|
|
710
|
-
// src/resolve-video-config.ts
|
|
711
|
-
var validateCalculated = ({
|
|
712
|
-
calculated,
|
|
713
|
-
compositionId,
|
|
714
|
-
compositionFps,
|
|
715
|
-
compositionHeight,
|
|
716
|
-
compositionWidth,
|
|
717
|
-
compositionDurationInFrames
|
|
718
|
-
}) => {
|
|
719
|
-
const calculateMetadataErrorLocation = `calculated by calculateMetadata() for the composition "${compositionId}"`;
|
|
720
|
-
const defaultErrorLocation = `of the "<Composition />" component with the id "${compositionId}"`;
|
|
721
|
-
const width = calculated?.width ?? compositionWidth ?? undefined;
|
|
722
|
-
validateDimension(width, "width", calculated?.width ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
723
|
-
const height = calculated?.height ?? compositionHeight ?? undefined;
|
|
724
|
-
validateDimension(height, "height", calculated?.height ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
725
|
-
const fps = calculated?.fps ?? compositionFps ?? null;
|
|
726
|
-
validateFps(fps, calculated?.fps ? calculateMetadataErrorLocation : defaultErrorLocation, false);
|
|
727
|
-
const durationInFrames = calculated?.durationInFrames ?? compositionDurationInFrames ?? null;
|
|
728
|
-
validateDurationInFrames(durationInFrames, {
|
|
729
|
-
allowFloats: false,
|
|
730
|
-
component: `of the "<Composition />" component with the id "${compositionId}"`
|
|
731
|
-
});
|
|
732
|
-
const defaultCodec = calculated?.defaultCodec;
|
|
733
|
-
validateCodec(defaultCodec, calculateMetadataErrorLocation, "defaultCodec");
|
|
734
|
-
const defaultOutName = calculated?.defaultOutName;
|
|
735
|
-
const defaultVideoImageFormat = calculated?.defaultVideoImageFormat;
|
|
736
|
-
const defaultPixelFormat = calculated?.defaultPixelFormat;
|
|
737
|
-
const defaultProResProfile = calculated?.defaultProResProfile;
|
|
738
|
-
return {
|
|
739
|
-
width,
|
|
740
|
-
height,
|
|
741
|
-
fps,
|
|
742
|
-
durationInFrames,
|
|
743
|
-
defaultCodec,
|
|
744
|
-
defaultOutName,
|
|
745
|
-
defaultVideoImageFormat,
|
|
746
|
-
defaultPixelFormat,
|
|
747
|
-
defaultProResProfile
|
|
748
|
-
};
|
|
749
|
-
};
|
|
750
|
-
var resolveVideoConfig = ({
|
|
751
|
-
calculateMetadata,
|
|
752
|
-
signal,
|
|
753
|
-
defaultProps,
|
|
754
|
-
inputProps: originalProps,
|
|
755
|
-
compositionId,
|
|
756
|
-
compositionDurationInFrames,
|
|
757
|
-
compositionFps,
|
|
758
|
-
compositionHeight,
|
|
759
|
-
compositionWidth
|
|
760
|
-
}) => {
|
|
761
|
-
const calculatedProm = calculateMetadata ? calculateMetadata({
|
|
762
|
-
defaultProps,
|
|
763
|
-
props: originalProps,
|
|
764
|
-
abortSignal: signal,
|
|
765
|
-
compositionId,
|
|
766
|
-
isRendering: getRemotionEnvironment().isRendering
|
|
767
|
-
}) : null;
|
|
768
|
-
if (calculatedProm !== null && typeof calculatedProm === "object" && "then" in calculatedProm) {
|
|
769
|
-
return calculatedProm.then((c) => {
|
|
770
|
-
const {
|
|
771
|
-
height,
|
|
772
|
-
width,
|
|
773
|
-
durationInFrames,
|
|
774
|
-
fps,
|
|
775
|
-
defaultCodec,
|
|
776
|
-
defaultOutName,
|
|
777
|
-
defaultVideoImageFormat,
|
|
778
|
-
defaultPixelFormat,
|
|
779
|
-
defaultProResProfile
|
|
780
|
-
} = validateCalculated({
|
|
781
|
-
calculated: c,
|
|
782
|
-
compositionDurationInFrames,
|
|
783
|
-
compositionFps,
|
|
784
|
-
compositionHeight,
|
|
785
|
-
compositionWidth,
|
|
786
|
-
compositionId
|
|
787
|
-
});
|
|
788
|
-
return {
|
|
789
|
-
width,
|
|
790
|
-
height,
|
|
791
|
-
fps,
|
|
792
|
-
durationInFrames,
|
|
793
|
-
id: compositionId,
|
|
794
|
-
defaultProps: serializeThenDeserializeInStudio(defaultProps),
|
|
795
|
-
props: serializeThenDeserializeInStudio(c.props ?? originalProps),
|
|
796
|
-
defaultCodec: defaultCodec ?? null,
|
|
797
|
-
defaultOutName: defaultOutName ?? null,
|
|
798
|
-
defaultVideoImageFormat: defaultVideoImageFormat ?? null,
|
|
799
|
-
defaultPixelFormat: defaultPixelFormat ?? null,
|
|
800
|
-
defaultProResProfile: defaultProResProfile ?? null
|
|
801
|
-
};
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
const data = validateCalculated({
|
|
805
|
-
calculated: calculatedProm,
|
|
806
|
-
compositionDurationInFrames,
|
|
807
|
-
compositionFps,
|
|
808
|
-
compositionHeight,
|
|
809
|
-
compositionWidth,
|
|
810
|
-
compositionId
|
|
811
|
-
});
|
|
812
|
-
if (calculatedProm === null) {
|
|
813
|
-
return {
|
|
814
|
-
...data,
|
|
815
|
-
id: compositionId,
|
|
816
|
-
defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
|
|
817
|
-
props: serializeThenDeserializeInStudio(originalProps),
|
|
818
|
-
defaultCodec: null,
|
|
819
|
-
defaultOutName: null,
|
|
820
|
-
defaultVideoImageFormat: null,
|
|
821
|
-
defaultPixelFormat: null,
|
|
822
|
-
defaultProResProfile: null
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
return {
|
|
826
|
-
...data,
|
|
827
|
-
id: compositionId,
|
|
828
|
-
defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
|
|
829
|
-
props: serializeThenDeserializeInStudio(calculatedProm.props ?? originalProps),
|
|
830
|
-
defaultCodec: calculatedProm.defaultCodec ?? null,
|
|
831
|
-
defaultOutName: calculatedProm.defaultOutName ?? null,
|
|
832
|
-
defaultVideoImageFormat: calculatedProm.defaultVideoImageFormat ?? null,
|
|
833
|
-
defaultPixelFormat: calculatedProm.defaultPixelFormat ?? null,
|
|
834
|
-
defaultProResProfile: calculatedProm.defaultProResProfile ?? null
|
|
835
|
-
};
|
|
836
|
-
};
|
|
837
|
-
var resolveVideoConfigOrCatch = (params) => {
|
|
838
|
-
try {
|
|
839
|
-
const promiseOrReturnValue = resolveVideoConfig(params);
|
|
840
|
-
return {
|
|
841
|
-
type: "success",
|
|
842
|
-
result: promiseOrReturnValue
|
|
843
|
-
};
|
|
844
|
-
} catch (err) {
|
|
845
|
-
return {
|
|
846
|
-
type: "error",
|
|
847
|
-
error: err
|
|
848
|
-
};
|
|
849
|
-
}
|
|
850
|
-
};
|
|
851
|
-
|
|
852
649
|
// src/ResolveCompositionConfig.tsx
|
|
853
|
-
|
|
854
|
-
var ResolveCompositionContext = createContext7(null);
|
|
650
|
+
var ResolveCompositionContext = createContext6(null);
|
|
855
651
|
var resolveCompositionsRef = createRef();
|
|
856
652
|
var needsResolution = (composition) => {
|
|
857
653
|
return Boolean(composition.calculateMetadata);
|
|
858
654
|
};
|
|
859
655
|
var PROPS_UPDATED_EXTERNALLY = "remotion.propsUpdatedExternally";
|
|
860
|
-
var ResolveCompositionConfigInStudio = ({ children }) => {
|
|
861
|
-
const [currentRenderModalComposition, setCurrentRenderModalComposition] = useState4(null);
|
|
862
|
-
const { compositions, canvasContent, currentCompositionMetadata } = useContext4(CompositionManager);
|
|
863
|
-
const { fastRefreshes, manualRefreshes } = useContext4(NonceContext);
|
|
864
|
-
if (manualRefreshes) {}
|
|
865
|
-
const selectedComposition = useMemo4(() => {
|
|
866
|
-
return compositions.find((c) => canvasContent && canvasContent.type === "composition" && canvasContent.compositionId === c.id);
|
|
867
|
-
}, [canvasContent, compositions]);
|
|
868
|
-
const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
|
|
869
|
-
const { props: allEditorProps } = useContext4(EditorPropsContext);
|
|
870
|
-
const env = useRemotionEnvironment();
|
|
871
|
-
const inputProps = useMemo4(() => {
|
|
872
|
-
return typeof window === "undefined" || env.isPlayer ? {} : getInputProps() ?? {};
|
|
873
|
-
}, [env.isPlayer]);
|
|
874
|
-
const [resolvedConfigs, setResolvedConfigs] = useState4({});
|
|
875
|
-
const selectedEditorProps = useMemo4(() => {
|
|
876
|
-
return selectedComposition ? allEditorProps[selectedComposition.id] ?? {} : {};
|
|
877
|
-
}, [allEditorProps, selectedComposition]);
|
|
878
|
-
const renderModalProps = useMemo4(() => {
|
|
879
|
-
return renderModalComposition ? allEditorProps[renderModalComposition.id] ?? {} : {};
|
|
880
|
-
}, [allEditorProps, renderModalComposition]);
|
|
881
|
-
const hasResolution = Boolean(currentCompositionMetadata);
|
|
882
|
-
const doResolution = useCallback3(({
|
|
883
|
-
calculateMetadata,
|
|
884
|
-
combinedProps,
|
|
885
|
-
compositionDurationInFrames,
|
|
886
|
-
compositionFps,
|
|
887
|
-
compositionHeight,
|
|
888
|
-
compositionId,
|
|
889
|
-
compositionWidth,
|
|
890
|
-
defaultProps
|
|
891
|
-
}) => {
|
|
892
|
-
const controller = new AbortController;
|
|
893
|
-
if (hasResolution) {
|
|
894
|
-
return controller;
|
|
895
|
-
}
|
|
896
|
-
const { signal } = controller;
|
|
897
|
-
const result = resolveVideoConfigOrCatch({
|
|
898
|
-
compositionId,
|
|
899
|
-
calculateMetadata,
|
|
900
|
-
inputProps: combinedProps,
|
|
901
|
-
signal,
|
|
902
|
-
defaultProps,
|
|
903
|
-
compositionDurationInFrames,
|
|
904
|
-
compositionFps,
|
|
905
|
-
compositionHeight,
|
|
906
|
-
compositionWidth
|
|
907
|
-
});
|
|
908
|
-
if (result.type === "error") {
|
|
909
|
-
setResolvedConfigs((r) => ({
|
|
910
|
-
...r,
|
|
911
|
-
[compositionId]: {
|
|
912
|
-
type: "error",
|
|
913
|
-
error: result.error
|
|
914
|
-
}
|
|
915
|
-
}));
|
|
916
|
-
return controller;
|
|
917
|
-
}
|
|
918
|
-
const promOrNot = result.result;
|
|
919
|
-
if (typeof promOrNot === "object" && "then" in promOrNot) {
|
|
920
|
-
setResolvedConfigs((r) => {
|
|
921
|
-
const prev = r[compositionId];
|
|
922
|
-
if (prev?.type === "success" || prev?.type === "success-and-refreshing") {
|
|
923
|
-
return {
|
|
924
|
-
...r,
|
|
925
|
-
[compositionId]: {
|
|
926
|
-
type: "success-and-refreshing",
|
|
927
|
-
result: prev.result
|
|
928
|
-
}
|
|
929
|
-
};
|
|
930
|
-
}
|
|
931
|
-
return {
|
|
932
|
-
...r,
|
|
933
|
-
[compositionId]: {
|
|
934
|
-
type: "loading"
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
});
|
|
938
|
-
promOrNot.then((c) => {
|
|
939
|
-
if (controller.signal.aborted) {
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
setResolvedConfigs((r) => ({
|
|
943
|
-
...r,
|
|
944
|
-
[compositionId]: {
|
|
945
|
-
type: "success",
|
|
946
|
-
result: c
|
|
947
|
-
}
|
|
948
|
-
}));
|
|
949
|
-
}).catch((err) => {
|
|
950
|
-
if (controller.signal.aborted) {
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
setResolvedConfigs((r) => ({
|
|
954
|
-
...r,
|
|
955
|
-
[compositionId]: {
|
|
956
|
-
type: "error",
|
|
957
|
-
error: err
|
|
958
|
-
}
|
|
959
|
-
}));
|
|
960
|
-
});
|
|
961
|
-
} else {
|
|
962
|
-
setResolvedConfigs((r) => ({
|
|
963
|
-
...r,
|
|
964
|
-
[compositionId]: {
|
|
965
|
-
type: "success",
|
|
966
|
-
result: promOrNot
|
|
967
|
-
}
|
|
968
|
-
}));
|
|
969
|
-
}
|
|
970
|
-
return controller;
|
|
971
|
-
}, [hasResolution]);
|
|
972
|
-
const currentComposition = canvasContent?.type === "composition" ? canvasContent.compositionId : null;
|
|
973
|
-
useImperativeHandle2(resolveCompositionsRef, () => {
|
|
974
|
-
return {
|
|
975
|
-
setCurrentRenderModalComposition: (id) => {
|
|
976
|
-
setCurrentRenderModalComposition(id);
|
|
977
|
-
},
|
|
978
|
-
reloadCurrentlySelectedComposition: () => {
|
|
979
|
-
if (!currentComposition) {
|
|
980
|
-
return;
|
|
981
|
-
}
|
|
982
|
-
const composition = compositions.find((c) => c.id === currentComposition);
|
|
983
|
-
if (!composition) {
|
|
984
|
-
throw new Error(`Could not find composition with id ${currentComposition}`);
|
|
985
|
-
}
|
|
986
|
-
const editorProps = allEditorProps[currentComposition] ?? {};
|
|
987
|
-
const defaultProps = {
|
|
988
|
-
...composition.defaultProps ?? {},
|
|
989
|
-
...editorProps ?? {}
|
|
990
|
-
};
|
|
991
|
-
const props = {
|
|
992
|
-
...defaultProps,
|
|
993
|
-
...inputProps ?? {}
|
|
994
|
-
};
|
|
995
|
-
doResolution({
|
|
996
|
-
defaultProps,
|
|
997
|
-
calculateMetadata: composition.calculateMetadata,
|
|
998
|
-
combinedProps: props,
|
|
999
|
-
compositionDurationInFrames: composition.durationInFrames ?? null,
|
|
1000
|
-
compositionFps: composition.fps ?? null,
|
|
1001
|
-
compositionHeight: composition.height ?? null,
|
|
1002
|
-
compositionWidth: composition.width ?? null,
|
|
1003
|
-
compositionId: composition.id
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1006
|
-
};
|
|
1007
|
-
}, [
|
|
1008
|
-
allEditorProps,
|
|
1009
|
-
compositions,
|
|
1010
|
-
currentComposition,
|
|
1011
|
-
doResolution,
|
|
1012
|
-
inputProps
|
|
1013
|
-
]);
|
|
1014
|
-
const isTheSame = selectedComposition?.id === renderModalComposition?.id;
|
|
1015
|
-
const currentDefaultProps = useMemo4(() => {
|
|
1016
|
-
return {
|
|
1017
|
-
...selectedComposition?.defaultProps ?? {},
|
|
1018
|
-
...selectedEditorProps ?? {}
|
|
1019
|
-
};
|
|
1020
|
-
}, [selectedComposition?.defaultProps, selectedEditorProps]);
|
|
1021
|
-
const originalProps = useMemo4(() => {
|
|
1022
|
-
return {
|
|
1023
|
-
...currentDefaultProps,
|
|
1024
|
-
...inputProps ?? {}
|
|
1025
|
-
};
|
|
1026
|
-
}, [currentDefaultProps, inputProps]);
|
|
1027
|
-
const canResolve = selectedComposition && needsResolution(selectedComposition);
|
|
1028
|
-
const shouldIgnoreUpdate = typeof window !== "undefined" && window.remotion_ignoreFastRefreshUpdate && fastRefreshes <= window.remotion_ignoreFastRefreshUpdate;
|
|
1029
|
-
useEffect2(() => {
|
|
1030
|
-
if (shouldIgnoreUpdate) {
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
if (canResolve) {
|
|
1034
|
-
const controller = doResolution({
|
|
1035
|
-
calculateMetadata: selectedComposition.calculateMetadata,
|
|
1036
|
-
combinedProps: originalProps,
|
|
1037
|
-
compositionDurationInFrames: selectedComposition.durationInFrames ?? null,
|
|
1038
|
-
compositionFps: selectedComposition.fps ?? null,
|
|
1039
|
-
compositionHeight: selectedComposition.height ?? null,
|
|
1040
|
-
compositionWidth: selectedComposition.width ?? null,
|
|
1041
|
-
defaultProps: currentDefaultProps,
|
|
1042
|
-
compositionId: selectedComposition.id
|
|
1043
|
-
});
|
|
1044
|
-
return () => {
|
|
1045
|
-
controller.abort();
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
}, [
|
|
1049
|
-
canResolve,
|
|
1050
|
-
currentDefaultProps,
|
|
1051
|
-
doResolution,
|
|
1052
|
-
originalProps,
|
|
1053
|
-
selectedComposition?.calculateMetadata,
|
|
1054
|
-
selectedComposition?.durationInFrames,
|
|
1055
|
-
selectedComposition?.fps,
|
|
1056
|
-
selectedComposition?.height,
|
|
1057
|
-
selectedComposition?.id,
|
|
1058
|
-
selectedComposition?.width,
|
|
1059
|
-
shouldIgnoreUpdate
|
|
1060
|
-
]);
|
|
1061
|
-
useEffect2(() => {
|
|
1062
|
-
if (renderModalComposition && !isTheSame) {
|
|
1063
|
-
const combinedProps = {
|
|
1064
|
-
...renderModalComposition.defaultProps ?? {},
|
|
1065
|
-
...renderModalProps ?? {},
|
|
1066
|
-
...inputProps ?? {}
|
|
1067
|
-
};
|
|
1068
|
-
const controller = doResolution({
|
|
1069
|
-
calculateMetadata: renderModalComposition.calculateMetadata,
|
|
1070
|
-
compositionDurationInFrames: renderModalComposition.durationInFrames ?? null,
|
|
1071
|
-
compositionFps: renderModalComposition.fps ?? null,
|
|
1072
|
-
compositionHeight: renderModalComposition.height ?? null,
|
|
1073
|
-
compositionId: renderModalComposition.id,
|
|
1074
|
-
compositionWidth: renderModalComposition.width ?? null,
|
|
1075
|
-
defaultProps: currentDefaultProps,
|
|
1076
|
-
combinedProps
|
|
1077
|
-
});
|
|
1078
|
-
return () => {
|
|
1079
|
-
controller.abort();
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
}, [
|
|
1083
|
-
currentDefaultProps,
|
|
1084
|
-
doResolution,
|
|
1085
|
-
inputProps,
|
|
1086
|
-
isTheSame,
|
|
1087
|
-
renderModalComposition,
|
|
1088
|
-
renderModalProps
|
|
1089
|
-
]);
|
|
1090
|
-
const resolvedConfigsIncludingStaticOnes = useMemo4(() => {
|
|
1091
|
-
const staticComps = compositions.filter((c) => {
|
|
1092
|
-
return c.calculateMetadata === null;
|
|
1093
|
-
});
|
|
1094
|
-
return {
|
|
1095
|
-
...resolvedConfigs,
|
|
1096
|
-
...staticComps.reduce((acc, curr) => {
|
|
1097
|
-
return {
|
|
1098
|
-
...acc,
|
|
1099
|
-
[curr.id]: {
|
|
1100
|
-
type: "success",
|
|
1101
|
-
result: { ...curr, defaultProps: curr.defaultProps ?? {} }
|
|
1102
|
-
}
|
|
1103
|
-
};
|
|
1104
|
-
}, {})
|
|
1105
|
-
};
|
|
1106
|
-
}, [compositions, resolvedConfigs]);
|
|
1107
|
-
return /* @__PURE__ */ jsx5(ResolveCompositionContext.Provider, {
|
|
1108
|
-
value: resolvedConfigsIncludingStaticOnes,
|
|
1109
|
-
children
|
|
1110
|
-
});
|
|
1111
|
-
};
|
|
1112
656
|
var useResolvedVideoConfig = (preferredCompositionId) => {
|
|
1113
|
-
const context =
|
|
1114
|
-
const { props: allEditorProps } =
|
|
1115
|
-
const { compositions, canvasContent, currentCompositionMetadata } =
|
|
657
|
+
const context = useContext3(ResolveCompositionContext);
|
|
658
|
+
const { props: allEditorProps } = useContext3(EditorPropsContext);
|
|
659
|
+
const { compositions, canvasContent, currentCompositionMetadata } = useContext3(CompositionManager);
|
|
1116
660
|
const currentComposition = canvasContent?.type === "composition" ? canvasContent.compositionId : null;
|
|
1117
661
|
const compositionId = preferredCompositionId ?? currentComposition;
|
|
1118
662
|
const composition = compositions.find((c) => c.id === compositionId);
|
|
@@ -1182,7 +726,7 @@ var useResolvedVideoConfig = (preferredCompositionId) => {
|
|
|
1182
726
|
|
|
1183
727
|
// src/use-video.ts
|
|
1184
728
|
var useVideo = () => {
|
|
1185
|
-
const { canvasContent, compositions, currentCompositionMetadata } =
|
|
729
|
+
const { canvasContent, compositions, currentCompositionMetadata } = useContext4(CompositionManager);
|
|
1186
730
|
const selected = compositions.find((c) => {
|
|
1187
731
|
return canvasContent?.type === "composition" && c.id === canvasContent.compositionId;
|
|
1188
732
|
});
|
|
@@ -1235,7 +779,7 @@ var getFrameForComposition = (composition) => {
|
|
|
1235
779
|
};
|
|
1236
780
|
var useTimelinePosition = () => {
|
|
1237
781
|
const videoConfig = useVideo();
|
|
1238
|
-
const state =
|
|
782
|
+
const state = useContext5(TimelineContext);
|
|
1239
783
|
const env = useRemotionEnvironment();
|
|
1240
784
|
if (!videoConfig) {
|
|
1241
785
|
return typeof window === "undefined" ? 0 : window.remotion_initialFrame ?? 0;
|
|
@@ -1244,17 +788,17 @@ var useTimelinePosition = () => {
|
|
|
1244
788
|
return Math.min(videoConfig.durationInFrames - 1, unclamped);
|
|
1245
789
|
};
|
|
1246
790
|
var useTimelineSetFrame = () => {
|
|
1247
|
-
const { setFrame } =
|
|
791
|
+
const { setFrame } = useContext5(SetTimelineContext);
|
|
1248
792
|
return setFrame;
|
|
1249
793
|
};
|
|
1250
794
|
var usePlayingState = () => {
|
|
1251
|
-
const { playing, imperativePlaying } =
|
|
1252
|
-
const { setPlaying } =
|
|
795
|
+
const { playing, imperativePlaying } = useContext5(TimelineContext);
|
|
796
|
+
const { setPlaying } = useContext5(SetTimelineContext);
|
|
1253
797
|
return useMemo6(() => [playing, setPlaying, imperativePlaying], [imperativePlaying, playing, setPlaying]);
|
|
1254
798
|
};
|
|
1255
799
|
|
|
1256
800
|
// src/use-delay-render.tsx
|
|
1257
|
-
import { createContext as
|
|
801
|
+
import { createContext as createContext8, useCallback as useCallback3, useContext as useContext7 } from "react";
|
|
1258
802
|
|
|
1259
803
|
// src/cancel-render.ts
|
|
1260
804
|
var getErrorStackWithMessage = (error) => {
|
|
@@ -1472,9 +1016,9 @@ var continueRender = (handle) => {
|
|
|
1472
1016
|
};
|
|
1473
1017
|
|
|
1474
1018
|
// src/log-level-context.tsx
|
|
1475
|
-
import { createContext as
|
|
1019
|
+
import { createContext as createContext7 } from "react";
|
|
1476
1020
|
import * as React6 from "react";
|
|
1477
|
-
var LogLevelContext =
|
|
1021
|
+
var LogLevelContext = createContext7({
|
|
1478
1022
|
logLevel: "info",
|
|
1479
1023
|
mountTime: 0
|
|
1480
1024
|
});
|
|
@@ -1494,12 +1038,12 @@ var useMountTime = () => {
|
|
|
1494
1038
|
};
|
|
1495
1039
|
|
|
1496
1040
|
// src/use-delay-render.tsx
|
|
1497
|
-
var DelayRenderContextType =
|
|
1041
|
+
var DelayRenderContextType = createContext8(null);
|
|
1498
1042
|
var useDelayRender = () => {
|
|
1499
1043
|
const environment = useRemotionEnvironment();
|
|
1500
|
-
const scope =
|
|
1044
|
+
const scope = useContext7(DelayRenderContextType) ?? (typeof window !== "undefined" ? window : undefined);
|
|
1501
1045
|
const logLevel = useLogLevel();
|
|
1502
|
-
const delayRender2 =
|
|
1046
|
+
const delayRender2 = useCallback3((label, options) => {
|
|
1503
1047
|
if (!scope) {
|
|
1504
1048
|
return Math.random();
|
|
1505
1049
|
}
|
|
@@ -1510,7 +1054,7 @@ var useDelayRender = () => {
|
|
|
1510
1054
|
options: options ?? {}
|
|
1511
1055
|
});
|
|
1512
1056
|
}, [environment, scope]);
|
|
1513
|
-
const continueRender2 =
|
|
1057
|
+
const continueRender2 = useCallback3((handle) => {
|
|
1514
1058
|
if (!scope) {
|
|
1515
1059
|
return;
|
|
1516
1060
|
}
|
|
@@ -1521,15 +1065,15 @@ var useDelayRender = () => {
|
|
|
1521
1065
|
logLevel
|
|
1522
1066
|
});
|
|
1523
1067
|
}, [environment, logLevel, scope]);
|
|
1524
|
-
const cancelRender2 =
|
|
1068
|
+
const cancelRender2 = useCallback3((err) => {
|
|
1525
1069
|
return cancelRenderInternal(scope ?? (typeof window !== "undefined" ? window : undefined), err);
|
|
1526
1070
|
}, [scope]);
|
|
1527
1071
|
return { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 };
|
|
1528
1072
|
};
|
|
1529
1073
|
|
|
1530
1074
|
// src/TimelineContext.tsx
|
|
1531
|
-
import { jsx as
|
|
1532
|
-
var SetTimelineContext =
|
|
1075
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1076
|
+
var SetTimelineContext = createContext9({
|
|
1533
1077
|
setFrame: () => {
|
|
1534
1078
|
throw new Error("default");
|
|
1535
1079
|
},
|
|
@@ -1537,7 +1081,7 @@ var SetTimelineContext = createContext10({
|
|
|
1537
1081
|
throw new Error("default");
|
|
1538
1082
|
}
|
|
1539
1083
|
});
|
|
1540
|
-
var TimelineContext =
|
|
1084
|
+
var TimelineContext = createContext9({
|
|
1541
1085
|
frame: {},
|
|
1542
1086
|
playing: false,
|
|
1543
1087
|
playbackRate: 1,
|
|
@@ -1551,12 +1095,12 @@ var TimelineContext = createContext10({
|
|
|
1551
1095
|
audioAndVideoTags: { current: [] }
|
|
1552
1096
|
});
|
|
1553
1097
|
var TimelineContextProvider = ({ children, frameState }) => {
|
|
1554
|
-
const [playing, setPlaying] =
|
|
1555
|
-
const imperativePlaying =
|
|
1556
|
-
const [playbackRate, setPlaybackRate] =
|
|
1557
|
-
const audioAndVideoTags =
|
|
1558
|
-
const [remotionRootId] =
|
|
1559
|
-
const [_frame, setFrame] =
|
|
1098
|
+
const [playing, setPlaying] = useState3(false);
|
|
1099
|
+
const imperativePlaying = useRef(false);
|
|
1100
|
+
const [playbackRate, setPlaybackRate] = useState3(1);
|
|
1101
|
+
const audioAndVideoTags = useRef([]);
|
|
1102
|
+
const [remotionRootId] = useState3(() => String(random(null)));
|
|
1103
|
+
const [_frame, setFrame] = useState3(() => getInitialFrameState());
|
|
1560
1104
|
const frame = frameState ?? _frame;
|
|
1561
1105
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
1562
1106
|
if (typeof window !== "undefined") {
|
|
@@ -1602,24 +1146,43 @@ var TimelineContextProvider = ({ children, frameState }) => {
|
|
|
1602
1146
|
setPlaying
|
|
1603
1147
|
};
|
|
1604
1148
|
}, []);
|
|
1605
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ jsx5(TimelineContext.Provider, {
|
|
1606
1150
|
value: timelineContextValue,
|
|
1607
|
-
children: /* @__PURE__ */
|
|
1151
|
+
children: /* @__PURE__ */ jsx5(SetTimelineContext.Provider, {
|
|
1608
1152
|
value: setTimelineContextValue,
|
|
1609
1153
|
children
|
|
1610
1154
|
})
|
|
1611
1155
|
});
|
|
1612
1156
|
};
|
|
1613
1157
|
|
|
1158
|
+
// src/nonce.ts
|
|
1159
|
+
import { createContext as createContext10, useContext as useContext8, useEffect, useRef as useRef2, useState as useState4 } from "react";
|
|
1160
|
+
var NonceContext = createContext10({
|
|
1161
|
+
getNonce: () => 0
|
|
1162
|
+
});
|
|
1163
|
+
var useNonce = () => {
|
|
1164
|
+
const context = useContext8(NonceContext);
|
|
1165
|
+
const [nonce, setNonce] = useState4(() => context.getNonce());
|
|
1166
|
+
const lastContext = useRef2(context);
|
|
1167
|
+
useEffect(() => {
|
|
1168
|
+
if (lastContext.current === context) {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
lastContext.current = context;
|
|
1172
|
+
setNonce(context.getNonce);
|
|
1173
|
+
}, [context]);
|
|
1174
|
+
return nonce;
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1614
1177
|
// src/use-video-config.ts
|
|
1615
1178
|
import { useContext as useContext10 } from "react";
|
|
1616
1179
|
|
|
1617
1180
|
// src/CanUseRemotionHooks.tsx
|
|
1618
1181
|
import { createContext as createContext11 } from "react";
|
|
1619
|
-
import { jsx as
|
|
1182
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1620
1183
|
var CanUseRemotionHooks = createContext11(false);
|
|
1621
1184
|
var CanUseRemotionHooksProvider = ({ children }) => {
|
|
1622
|
-
return /* @__PURE__ */
|
|
1185
|
+
return /* @__PURE__ */ jsx6(CanUseRemotionHooks.Provider, {
|
|
1623
1186
|
value: true,
|
|
1624
1187
|
children
|
|
1625
1188
|
});
|
|
@@ -1710,7 +1273,7 @@ var useCurrentFrame = () => {
|
|
|
1710
1273
|
};
|
|
1711
1274
|
|
|
1712
1275
|
// src/freeze.tsx
|
|
1713
|
-
import { jsx as
|
|
1276
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1714
1277
|
var Freeze = ({
|
|
1715
1278
|
frame: frameToFreeze,
|
|
1716
1279
|
children,
|
|
@@ -1768,9 +1331,9 @@ var Freeze = ({
|
|
|
1768
1331
|
cumulatedFrom: 0
|
|
1769
1332
|
};
|
|
1770
1333
|
}, [sequenceContext, isActive]);
|
|
1771
|
-
return /* @__PURE__ */
|
|
1334
|
+
return /* @__PURE__ */ jsx7(TimelineContext.Provider, {
|
|
1772
1335
|
value: timelineValue,
|
|
1773
|
-
children: /* @__PURE__ */
|
|
1336
|
+
children: /* @__PURE__ */ jsx7(SequenceContext.Provider, {
|
|
1774
1337
|
value: newSequenceContext,
|
|
1775
1338
|
children
|
|
1776
1339
|
})
|
|
@@ -1778,7 +1341,7 @@ var Freeze = ({
|
|
|
1778
1341
|
};
|
|
1779
1342
|
|
|
1780
1343
|
// src/Sequence.tsx
|
|
1781
|
-
import { jsx as
|
|
1344
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1782
1345
|
var RegularSequenceRefForwardingFunction = ({
|
|
1783
1346
|
from = 0,
|
|
1784
1347
|
durationInFrames = Infinity,
|
|
@@ -1794,7 +1357,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1794
1357
|
...other
|
|
1795
1358
|
}, ref) => {
|
|
1796
1359
|
const { layout = "absolute-fill" } = other;
|
|
1797
|
-
const [id] =
|
|
1360
|
+
const [id] = useState5(() => String(Math.random()));
|
|
1798
1361
|
const parentSequence = useContext13(SequenceContext);
|
|
1799
1362
|
const { rootId } = useContext13(TimelineContext);
|
|
1800
1363
|
const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
|
|
@@ -1860,7 +1423,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1860
1423
|
return name ?? "";
|
|
1861
1424
|
}, [name]);
|
|
1862
1425
|
const env = useRemotionEnvironment();
|
|
1863
|
-
|
|
1426
|
+
useEffect2(() => {
|
|
1864
1427
|
if (!env.isStudio) {
|
|
1865
1428
|
return;
|
|
1866
1429
|
}
|
|
@@ -1919,9 +1482,9 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1919
1482
|
if (isSequenceHidden) {
|
|
1920
1483
|
return null;
|
|
1921
1484
|
}
|
|
1922
|
-
return /* @__PURE__ */
|
|
1485
|
+
return /* @__PURE__ */ jsx8(SequenceContext.Provider, {
|
|
1923
1486
|
value: contextValue,
|
|
1924
|
-
children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */
|
|
1487
|
+
children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */ jsx8(AbsoluteFill, {
|
|
1925
1488
|
ref,
|
|
1926
1489
|
style: defaultStyle,
|
|
1927
1490
|
className: other.className,
|
|
@@ -1965,10 +1528,10 @@ var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
|
1965
1528
|
styleWhilePremounted,
|
|
1966
1529
|
styleWhilePostmounted
|
|
1967
1530
|
]);
|
|
1968
|
-
return /* @__PURE__ */
|
|
1531
|
+
return /* @__PURE__ */ jsx8(Freeze, {
|
|
1969
1532
|
frame: freezeFrame,
|
|
1970
1533
|
active: isFreezingActive,
|
|
1971
|
-
children: /* @__PURE__ */
|
|
1534
|
+
children: /* @__PURE__ */ jsx8(Sequence, {
|
|
1972
1535
|
ref,
|
|
1973
1536
|
from,
|
|
1974
1537
|
durationInFrames,
|
|
@@ -1986,13 +1549,13 @@ var SequenceRefForwardingFunction = (props, ref) => {
|
|
|
1986
1549
|
const env = useRemotionEnvironment();
|
|
1987
1550
|
if (props.layout !== "none" && !env.isRendering) {
|
|
1988
1551
|
if (props.premountFor || props.postmountFor) {
|
|
1989
|
-
return /* @__PURE__ */
|
|
1552
|
+
return /* @__PURE__ */ jsx8(PremountedPostmountedSequence, {
|
|
1990
1553
|
...props,
|
|
1991
1554
|
ref
|
|
1992
1555
|
});
|
|
1993
1556
|
}
|
|
1994
1557
|
}
|
|
1995
|
-
return /* @__PURE__ */
|
|
1558
|
+
return /* @__PURE__ */ jsx8(RegularSequence, {
|
|
1996
1559
|
...props,
|
|
1997
1560
|
ref
|
|
1998
1561
|
});
|
|
@@ -2001,16 +1564,16 @@ var Sequence = forwardRef2(SequenceRefForwardingFunction);
|
|
|
2001
1564
|
// src/animated-image/AnimatedImage.tsx
|
|
2002
1565
|
import {
|
|
2003
1566
|
forwardRef as forwardRef3,
|
|
2004
|
-
useEffect as
|
|
2005
|
-
useImperativeHandle as
|
|
1567
|
+
useEffect as useEffect3,
|
|
1568
|
+
useImperativeHandle as useImperativeHandle3,
|
|
2006
1569
|
useLayoutEffect as useLayoutEffect2,
|
|
2007
1570
|
useRef as useRef4,
|
|
2008
|
-
useState as
|
|
1571
|
+
useState as useState6
|
|
2009
1572
|
} from "react";
|
|
2010
1573
|
|
|
2011
1574
|
// src/animated-image/canvas.tsx
|
|
2012
|
-
import React11, { useCallback as
|
|
2013
|
-
import { jsx as
|
|
1575
|
+
import React11, { useCallback as useCallback4, useImperativeHandle as useImperativeHandle2, useRef as useRef3 } from "react";
|
|
1576
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2014
1577
|
var calcArgs = (fit, frameSize, canvasSize) => {
|
|
2015
1578
|
switch (fit) {
|
|
2016
1579
|
case "fill": {
|
|
@@ -2061,7 +1624,7 @@ var calcArgs = (fit, frameSize, canvasSize) => {
|
|
|
2061
1624
|
};
|
|
2062
1625
|
var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref) => {
|
|
2063
1626
|
const canvasRef = useRef3(null);
|
|
2064
|
-
const draw =
|
|
1627
|
+
const draw = useCallback4((imageData) => {
|
|
2065
1628
|
const canvas = canvasRef.current;
|
|
2066
1629
|
const canvasWidth = width ?? imageData.displayWidth;
|
|
2067
1630
|
const canvasHeight = height ?? imageData.displayHeight;
|
|
@@ -2082,7 +1645,7 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref
|
|
|
2082
1645
|
height: canvasHeight
|
|
2083
1646
|
}));
|
|
2084
1647
|
}, [fit, height, width]);
|
|
2085
|
-
|
|
1648
|
+
useImperativeHandle2(ref, () => {
|
|
2086
1649
|
return {
|
|
2087
1650
|
draw,
|
|
2088
1651
|
getCanvas: () => {
|
|
@@ -2100,7 +1663,7 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref
|
|
|
2100
1663
|
}
|
|
2101
1664
|
};
|
|
2102
1665
|
}, [draw]);
|
|
2103
|
-
return /* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ jsx9("canvas", {
|
|
2104
1667
|
ref: canvasRef,
|
|
2105
1668
|
className,
|
|
2106
1669
|
style
|
|
@@ -2259,7 +1822,7 @@ var resolveAnimatedImageSource = (src) => {
|
|
|
2259
1822
|
};
|
|
2260
1823
|
|
|
2261
1824
|
// src/animated-image/AnimatedImage.tsx
|
|
2262
|
-
import { jsx as
|
|
1825
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2263
1826
|
var AnimatedImage = forwardRef3(({
|
|
2264
1827
|
src,
|
|
2265
1828
|
width,
|
|
@@ -2271,7 +1834,7 @@ var AnimatedImage = forwardRef3(({
|
|
|
2271
1834
|
...props
|
|
2272
1835
|
}, canvasRef) => {
|
|
2273
1836
|
const mountState = useRef4({ isMounted: true });
|
|
2274
|
-
|
|
1837
|
+
useEffect3(() => {
|
|
2275
1838
|
const { current } = mountState;
|
|
2276
1839
|
current.isMounted = true;
|
|
2277
1840
|
return () => {
|
|
@@ -2279,24 +1842,24 @@ var AnimatedImage = forwardRef3(({
|
|
|
2279
1842
|
};
|
|
2280
1843
|
}, []);
|
|
2281
1844
|
const resolvedSrc = resolveAnimatedImageSource(src);
|
|
2282
|
-
const [imageDecoder, setImageDecoder] =
|
|
1845
|
+
const [imageDecoder, setImageDecoder] = useState6(null);
|
|
2283
1846
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
2284
|
-
const [decodeHandle] =
|
|
1847
|
+
const [decodeHandle] = useState6(() => delayRender2(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
|
|
2285
1848
|
const frame = useCurrentFrame();
|
|
2286
1849
|
const { fps } = useVideoConfig();
|
|
2287
1850
|
const currentTime = frame / playbackRate / fps;
|
|
2288
1851
|
const currentTimeRef = useRef4(currentTime);
|
|
2289
1852
|
currentTimeRef.current = currentTime;
|
|
2290
1853
|
const ref = useRef4(null);
|
|
2291
|
-
|
|
1854
|
+
useImperativeHandle3(canvasRef, () => {
|
|
2292
1855
|
const c = ref.current?.getCanvas();
|
|
2293
1856
|
if (!c) {
|
|
2294
1857
|
throw new Error("Canvas ref is not set");
|
|
2295
1858
|
}
|
|
2296
1859
|
return c;
|
|
2297
1860
|
}, []);
|
|
2298
|
-
const [initialLoopBehavior] =
|
|
2299
|
-
|
|
1861
|
+
const [initialLoopBehavior] = useState6(() => loopBehavior);
|
|
1862
|
+
useEffect3(() => {
|
|
2300
1863
|
const controller = new AbortController;
|
|
2301
1864
|
decodeImage({
|
|
2302
1865
|
resolvedSrc,
|
|
@@ -2359,7 +1922,7 @@ var AnimatedImage = forwardRef3(({
|
|
|
2359
1922
|
continueRender2,
|
|
2360
1923
|
delayRender2
|
|
2361
1924
|
]);
|
|
2362
|
-
return /* @__PURE__ */
|
|
1925
|
+
return /* @__PURE__ */ jsx10(Canvas, {
|
|
2363
1926
|
ref,
|
|
2364
1927
|
width,
|
|
2365
1928
|
height,
|
|
@@ -2368,17 +1931,17 @@ var AnimatedImage = forwardRef3(({
|
|
|
2368
1931
|
});
|
|
2369
1932
|
});
|
|
2370
1933
|
// src/Artifact.tsx
|
|
2371
|
-
import { useContext as useContext14, useLayoutEffect as useLayoutEffect4, useState as
|
|
1934
|
+
import { useContext as useContext14, useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
|
|
2372
1935
|
|
|
2373
1936
|
// src/RenderAssetManager.tsx
|
|
2374
1937
|
import {
|
|
2375
1938
|
createContext as createContext12,
|
|
2376
|
-
useCallback as
|
|
2377
|
-
useImperativeHandle as
|
|
1939
|
+
useCallback as useCallback5,
|
|
1940
|
+
useImperativeHandle as useImperativeHandle4,
|
|
2378
1941
|
useLayoutEffect as useLayoutEffect3,
|
|
2379
1942
|
useMemo as useMemo11,
|
|
2380
1943
|
useRef as useRef5,
|
|
2381
|
-
useState as
|
|
1944
|
+
useState as useState7
|
|
2382
1945
|
} from "react";
|
|
2383
1946
|
|
|
2384
1947
|
// src/validation/validate-artifact.ts
|
|
@@ -2413,7 +1976,7 @@ var validateRenderAsset = (artifact) => {
|
|
|
2413
1976
|
};
|
|
2414
1977
|
|
|
2415
1978
|
// src/RenderAssetManager.tsx
|
|
2416
|
-
import { jsx as
|
|
1979
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2417
1980
|
var RenderAssetManager = createContext12({
|
|
2418
1981
|
registerRenderAsset: () => {
|
|
2419
1982
|
return;
|
|
@@ -2424,15 +1987,15 @@ var RenderAssetManager = createContext12({
|
|
|
2424
1987
|
renderAssets: []
|
|
2425
1988
|
});
|
|
2426
1989
|
var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
2427
|
-
const [renderAssets, setRenderAssets] =
|
|
1990
|
+
const [renderAssets, setRenderAssets] = useState7([]);
|
|
2428
1991
|
const renderAssetsRef = useRef5([]);
|
|
2429
|
-
const registerRenderAsset =
|
|
1992
|
+
const registerRenderAsset = useCallback5((renderAsset) => {
|
|
2430
1993
|
validateRenderAsset(renderAsset);
|
|
2431
1994
|
renderAssetsRef.current = [...renderAssetsRef.current, renderAsset];
|
|
2432
1995
|
setRenderAssets(renderAssetsRef.current);
|
|
2433
1996
|
}, []);
|
|
2434
1997
|
if (collectAssets) {
|
|
2435
|
-
|
|
1998
|
+
useImperativeHandle4(collectAssets, () => {
|
|
2436
1999
|
return {
|
|
2437
2000
|
collectAssets: () => {
|
|
2438
2001
|
const assets = renderAssetsRef.current;
|
|
@@ -2443,7 +2006,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
2443
2006
|
};
|
|
2444
2007
|
}, []);
|
|
2445
2008
|
}
|
|
2446
|
-
const unregisterRenderAsset =
|
|
2009
|
+
const unregisterRenderAsset = useCallback5((id) => {
|
|
2447
2010
|
renderAssetsRef.current = renderAssetsRef.current.filter((a) => a.id !== id);
|
|
2448
2011
|
setRenderAssets(renderAssetsRef.current);
|
|
2449
2012
|
}, []);
|
|
@@ -2464,7 +2027,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
|
|
|
2464
2027
|
renderAssets
|
|
2465
2028
|
};
|
|
2466
2029
|
}, [renderAssets, registerRenderAsset, unregisterRenderAsset]);
|
|
2467
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx11(RenderAssetManager.Provider, {
|
|
2468
2031
|
value: contextValue,
|
|
2469
2032
|
children
|
|
2470
2033
|
});
|
|
@@ -2476,7 +2039,7 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
|
2476
2039
|
const { registerRenderAsset, unregisterRenderAsset } = useContext14(RenderAssetManager);
|
|
2477
2040
|
const env = useRemotionEnvironment();
|
|
2478
2041
|
const frame = useCurrentFrame();
|
|
2479
|
-
const [id] =
|
|
2042
|
+
const [id] = useState8(() => {
|
|
2480
2043
|
return String(Math.random());
|
|
2481
2044
|
});
|
|
2482
2045
|
useLayoutEffect4(() => {
|
|
@@ -2530,7 +2093,7 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
|
|
|
2530
2093
|
};
|
|
2531
2094
|
Artifact.Thumbnail = ArtifactThumbnail;
|
|
2532
2095
|
// src/audio/Audio.tsx
|
|
2533
|
-
import { forwardRef as forwardRef6, useCallback as
|
|
2096
|
+
import { forwardRef as forwardRef6, useCallback as useCallback10, useContext as useContext27 } from "react";
|
|
2534
2097
|
|
|
2535
2098
|
// src/absolute-src.ts
|
|
2536
2099
|
var getAbsoluteSrc = (relativeSrc) => {
|
|
@@ -2563,7 +2126,7 @@ var calculateMediaDuration = ({
|
|
|
2563
2126
|
|
|
2564
2127
|
// src/loop/index.tsx
|
|
2565
2128
|
import React12, { createContext as createContext13, useMemo as useMemo12 } from "react";
|
|
2566
|
-
import { jsx as
|
|
2129
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2567
2130
|
var LoopContext = createContext13(null);
|
|
2568
2131
|
var useLoop = () => {
|
|
2569
2132
|
return React12.useContext(LoopContext);
|
|
@@ -2604,9 +2167,9 @@ var Loop = ({ durationInFrames, times = Infinity, children, name, ...props }) =>
|
|
|
2604
2167
|
durationInFrames
|
|
2605
2168
|
};
|
|
2606
2169
|
}, [currentFrame, durationInFrames]);
|
|
2607
|
-
return /* @__PURE__ */
|
|
2170
|
+
return /* @__PURE__ */ jsx12(LoopContext.Provider, {
|
|
2608
2171
|
value: loopContext,
|
|
2609
|
-
children: /* @__PURE__ */
|
|
2172
|
+
children: /* @__PURE__ */ jsx12(Sequence, {
|
|
2610
2173
|
durationInFrames,
|
|
2611
2174
|
from,
|
|
2612
2175
|
name: name ?? "<Loop>",
|
|
@@ -2634,8 +2197,8 @@ var playbackLogging = ({
|
|
|
2634
2197
|
};
|
|
2635
2198
|
|
|
2636
2199
|
// src/prefetch-state.tsx
|
|
2637
|
-
import { createContext as createContext14, useEffect as
|
|
2638
|
-
import { jsx as
|
|
2200
|
+
import { createContext as createContext14, useEffect as useEffect4, useState as useState9 } from "react";
|
|
2201
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2639
2202
|
var PreloadContext = createContext14({});
|
|
2640
2203
|
var preloads = {};
|
|
2641
2204
|
var updaters = [];
|
|
@@ -2644,8 +2207,8 @@ var setPreloads = (updater) => {
|
|
|
2644
2207
|
updaters.forEach((u) => u());
|
|
2645
2208
|
};
|
|
2646
2209
|
var PrefetchProvider = ({ children }) => {
|
|
2647
|
-
const [_preloads, _setPreloads] =
|
|
2648
|
-
|
|
2210
|
+
const [_preloads, _setPreloads] = useState9(() => preloads);
|
|
2211
|
+
useEffect4(() => {
|
|
2649
2212
|
const updaterFunction = () => {
|
|
2650
2213
|
_setPreloads(preloads);
|
|
2651
2214
|
};
|
|
@@ -2654,7 +2217,7 @@ var PrefetchProvider = ({ children }) => {
|
|
|
2654
2217
|
updaters = updaters.filter((u) => u !== updaterFunction);
|
|
2655
2218
|
};
|
|
2656
2219
|
}, []);
|
|
2657
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ jsx13(PreloadContext.Provider, {
|
|
2658
2221
|
value: _preloads,
|
|
2659
2222
|
children
|
|
2660
2223
|
});
|
|
@@ -2950,7 +2513,7 @@ var resolveTrimProps = ({
|
|
|
2950
2513
|
|
|
2951
2514
|
// src/video/duration-state.tsx
|
|
2952
2515
|
import { createContext as createContext15, useMemo as useMemo13, useReducer } from "react";
|
|
2953
|
-
import { jsx as
|
|
2516
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2954
2517
|
var durationReducer = (state, action) => {
|
|
2955
2518
|
switch (action.type) {
|
|
2956
2519
|
case "got-duration": {
|
|
@@ -2981,7 +2544,7 @@ var DurationsContextProvider = ({ children }) => {
|
|
|
2981
2544
|
setDurations
|
|
2982
2545
|
};
|
|
2983
2546
|
}, [durations]);
|
|
2984
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ jsx14(DurationsContext.Provider, {
|
|
2985
2548
|
value,
|
|
2986
2549
|
children
|
|
2987
2550
|
});
|
|
@@ -2991,11 +2554,11 @@ var DurationsContextProvider = ({ children }) => {
|
|
|
2991
2554
|
import React18, {
|
|
2992
2555
|
forwardRef as forwardRef4,
|
|
2993
2556
|
useContext as useContext25,
|
|
2994
|
-
useEffect as
|
|
2995
|
-
useImperativeHandle as
|
|
2557
|
+
useEffect as useEffect11,
|
|
2558
|
+
useImperativeHandle as useImperativeHandle5,
|
|
2996
2559
|
useMemo as useMemo21,
|
|
2997
2560
|
useRef as useRef13,
|
|
2998
|
-
useState as
|
|
2561
|
+
useState as useState14
|
|
2999
2562
|
} from "react";
|
|
3000
2563
|
|
|
3001
2564
|
// src/get-cross-origin-value.ts
|
|
@@ -3023,11 +2586,11 @@ import { useContext as useContext17, useLayoutEffect as useLayoutEffect5, useRef
|
|
|
3023
2586
|
import React15, {
|
|
3024
2587
|
createContext as createContext16,
|
|
3025
2588
|
createRef as createRef2,
|
|
3026
|
-
useCallback as
|
|
2589
|
+
useCallback as useCallback6,
|
|
3027
2590
|
useContext as useContext16,
|
|
3028
2591
|
useMemo as useMemo15,
|
|
3029
2592
|
useRef as useRef6,
|
|
3030
|
-
useState as
|
|
2593
|
+
useState as useState10
|
|
3031
2594
|
} from "react";
|
|
3032
2595
|
|
|
3033
2596
|
// src/play-and-handle-not-allowed-error.ts
|
|
@@ -3163,7 +2726,7 @@ var useSingletonAudioContext = ({
|
|
|
3163
2726
|
};
|
|
3164
2727
|
|
|
3165
2728
|
// src/audio/shared-audio-tags.tsx
|
|
3166
|
-
import { jsx as
|
|
2729
|
+
import { jsx as jsx15, jsxs } from "react/jsx-runtime";
|
|
3167
2730
|
var EMPTY_AUDIO = "data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV";
|
|
3168
2731
|
var compareProps = (obj1, obj2) => {
|
|
3169
2732
|
const keysA = Object.keys(obj1).sort();
|
|
@@ -3193,7 +2756,7 @@ var didPropChange = (key, newProp, prevProp) => {
|
|
|
3193
2756
|
var SharedAudioContext = createContext16(null);
|
|
3194
2757
|
var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, audioEnabled }) => {
|
|
3195
2758
|
const audios = useRef6([]);
|
|
3196
|
-
const [initialNumberOfAudioTags] =
|
|
2759
|
+
const [initialNumberOfAudioTags] = useState10(numberOfAudioTags);
|
|
3197
2760
|
if (numberOfAudioTags !== initialNumberOfAudioTags) {
|
|
3198
2761
|
throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");
|
|
3199
2762
|
}
|
|
@@ -3227,7 +2790,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
|
|
|
3227
2790
|
};
|
|
3228
2791
|
}, [refs]);
|
|
3229
2792
|
const takenAudios = useRef6(new Array(numberOfAudioTags).fill(false));
|
|
3230
|
-
const rerenderAudios =
|
|
2793
|
+
const rerenderAudios = useCallback6(() => {
|
|
3231
2794
|
refs.forEach(({ ref, id }) => {
|
|
3232
2795
|
const data = audios.current?.find((a) => a.id === id);
|
|
3233
2796
|
const { current } = ref;
|
|
@@ -3248,7 +2811,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
|
|
|
3248
2811
|
});
|
|
3249
2812
|
});
|
|
3250
2813
|
}, [refs]);
|
|
3251
|
-
const registerAudio =
|
|
2814
|
+
const registerAudio = useCallback6((options) => {
|
|
3252
2815
|
const { aud, audioId, premounting, postmounting } = options;
|
|
3253
2816
|
const found = audios.current?.find((a) => a.audioId === audioId);
|
|
3254
2817
|
if (found) {
|
|
@@ -3277,7 +2840,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
|
|
|
3277
2840
|
rerenderAudios();
|
|
3278
2841
|
return newElem;
|
|
3279
2842
|
}, [numberOfAudioTags, refs, rerenderAudios]);
|
|
3280
|
-
const unregisterAudio =
|
|
2843
|
+
const unregisterAudio = useCallback6((id) => {
|
|
3281
2844
|
const cloned = [...takenAudios.current];
|
|
3282
2845
|
const index = refs.findIndex((r) => r.id === id);
|
|
3283
2846
|
if (index === -1) {
|
|
@@ -3288,7 +2851,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
|
|
|
3288
2851
|
audios.current = audios.current?.filter((a) => a.id !== id);
|
|
3289
2852
|
rerenderAudios();
|
|
3290
2853
|
}, [refs, rerenderAudios]);
|
|
3291
|
-
const updateAudio =
|
|
2854
|
+
const updateAudio = useCallback6(({
|
|
3292
2855
|
aud,
|
|
3293
2856
|
audioId,
|
|
3294
2857
|
id,
|
|
@@ -3324,7 +2887,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
|
|
|
3324
2887
|
}, [rerenderAudios]);
|
|
3325
2888
|
const mountTime = useMountTime();
|
|
3326
2889
|
const env = useRemotionEnvironment();
|
|
3327
|
-
const playAllAudios =
|
|
2890
|
+
const playAllAudios = useCallback6(() => {
|
|
3328
2891
|
refs.forEach((ref) => {
|
|
3329
2892
|
const audio = audios.current.find((a) => a.el === ref.ref);
|
|
3330
2893
|
if (audio?.premounting) {
|
|
@@ -3363,7 +2926,7 @@ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHin
|
|
|
3363
2926
|
value,
|
|
3364
2927
|
children: [
|
|
3365
2928
|
refs.map(({ id, ref }) => {
|
|
3366
|
-
return /* @__PURE__ */
|
|
2929
|
+
return /* @__PURE__ */ jsx15("audio", {
|
|
3367
2930
|
ref,
|
|
3368
2931
|
preload: "metadata",
|
|
3369
2932
|
src: EMPTY_AUDIO
|
|
@@ -3380,7 +2943,7 @@ var useSharedAudio = ({
|
|
|
3380
2943
|
postmounting
|
|
3381
2944
|
}) => {
|
|
3382
2945
|
const ctx = useContext16(SharedAudioContext);
|
|
3383
|
-
const [elem] =
|
|
2946
|
+
const [elem] = useState10(() => {
|
|
3384
2947
|
if (ctx && ctx.numberOfAudioTags > 0) {
|
|
3385
2948
|
return ctx.registerAudio({ aud, audioId, premounting, postmounting });
|
|
3386
2949
|
}
|
|
@@ -3615,7 +3178,7 @@ var useVolume = ({
|
|
|
3615
3178
|
};
|
|
3616
3179
|
|
|
3617
3180
|
// src/use-media-in-timeline.ts
|
|
3618
|
-
import { useContext as useContext19, useEffect as
|
|
3181
|
+
import { useContext as useContext19, useEffect as useEffect5, useMemo as useMemo16, useState as useState11 } from "react";
|
|
3619
3182
|
|
|
3620
3183
|
// src/audio/use-audio-frame.ts
|
|
3621
3184
|
import { useContext as useContext18 } from "react";
|
|
@@ -3693,7 +3256,7 @@ var useBasicMediaInTimeline = ({
|
|
|
3693
3256
|
const startsAt = useMediaStartsAt();
|
|
3694
3257
|
const parentSequence = useContext19(SequenceContext);
|
|
3695
3258
|
const videoConfig = useVideoConfig();
|
|
3696
|
-
const [initialVolume] =
|
|
3259
|
+
const [initialVolume] = useState11(() => volume);
|
|
3697
3260
|
const mediaDuration = calculateMediaDuration({
|
|
3698
3261
|
mediaDurationInFrames: videoConfig.durationInFrames,
|
|
3699
3262
|
playbackRate,
|
|
@@ -3713,7 +3276,7 @@ var useBasicMediaInTimeline = ({
|
|
|
3713
3276
|
});
|
|
3714
3277
|
}).join(",");
|
|
3715
3278
|
}, [duration, startsAt, volume, mediaVolume]);
|
|
3716
|
-
|
|
3279
|
+
useEffect5(() => {
|
|
3717
3280
|
if (typeof volume === "number" && volume !== initialVolume) {
|
|
3718
3281
|
warnOnce2(`Remotion: The ${mediaType} with src ${src} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`);
|
|
3719
3282
|
}
|
|
@@ -3767,7 +3330,7 @@ var useMediaInTimeline = ({
|
|
|
3767
3330
|
trimBefore: undefined,
|
|
3768
3331
|
playbackRate
|
|
3769
3332
|
});
|
|
3770
|
-
|
|
3333
|
+
useEffect5(() => {
|
|
3771
3334
|
if (!src) {
|
|
3772
3335
|
throw new Error("No src passed");
|
|
3773
3336
|
}
|
|
@@ -3826,38 +3389,38 @@ var useMediaInTimeline = ({
|
|
|
3826
3389
|
|
|
3827
3390
|
// src/use-media-playback.ts
|
|
3828
3391
|
import {
|
|
3829
|
-
useCallback as
|
|
3392
|
+
useCallback as useCallback9,
|
|
3830
3393
|
useContext as useContext22,
|
|
3831
|
-
useEffect as
|
|
3394
|
+
useEffect as useEffect9,
|
|
3832
3395
|
useLayoutEffect as useLayoutEffect7,
|
|
3833
3396
|
useRef as useRef12
|
|
3834
3397
|
} from "react";
|
|
3835
3398
|
|
|
3836
3399
|
// src/buffer-until-first-frame.ts
|
|
3837
|
-
import { useCallback as
|
|
3400
|
+
import { useCallback as useCallback8, useMemo as useMemo19, useRef as useRef10 } from "react";
|
|
3838
3401
|
|
|
3839
3402
|
// src/use-buffer-state.ts
|
|
3840
3403
|
import { useContext as useContext21, useMemo as useMemo18 } from "react";
|
|
3841
3404
|
|
|
3842
3405
|
// src/buffering.tsx
|
|
3843
3406
|
import React16, {
|
|
3844
|
-
useCallback as
|
|
3407
|
+
useCallback as useCallback7,
|
|
3845
3408
|
useContext as useContext20,
|
|
3846
|
-
useEffect as
|
|
3409
|
+
useEffect as useEffect6,
|
|
3847
3410
|
useLayoutEffect as useLayoutEffect6,
|
|
3848
3411
|
useMemo as useMemo17,
|
|
3849
3412
|
useRef as useRef9,
|
|
3850
|
-
useState as
|
|
3413
|
+
useState as useState12
|
|
3851
3414
|
} from "react";
|
|
3852
|
-
import { jsx as
|
|
3415
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3853
3416
|
var useBufferManager = (logLevel, mountTime) => {
|
|
3854
|
-
const [blocks, setBlocks] =
|
|
3855
|
-
const [onBufferingCallbacks, setOnBufferingCallbacks] =
|
|
3856
|
-
const [onResumeCallbacks, setOnResumeCallbacks] =
|
|
3417
|
+
const [blocks, setBlocks] = useState12([]);
|
|
3418
|
+
const [onBufferingCallbacks, setOnBufferingCallbacks] = useState12([]);
|
|
3419
|
+
const [onResumeCallbacks, setOnResumeCallbacks] = useState12([]);
|
|
3857
3420
|
const env = useRemotionEnvironment();
|
|
3858
3421
|
const rendering = env.isRendering;
|
|
3859
3422
|
const buffering = useRef9(false);
|
|
3860
|
-
const addBlock =
|
|
3423
|
+
const addBlock = useCallback7((block) => {
|
|
3861
3424
|
if (rendering) {
|
|
3862
3425
|
return {
|
|
3863
3426
|
unblock: () => {
|
|
@@ -3878,7 +3441,7 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3878
3441
|
}
|
|
3879
3442
|
};
|
|
3880
3443
|
}, [rendering]);
|
|
3881
|
-
const listenForBuffering =
|
|
3444
|
+
const listenForBuffering = useCallback7((callback) => {
|
|
3882
3445
|
setOnBufferingCallbacks((c) => [...c, callback]);
|
|
3883
3446
|
return {
|
|
3884
3447
|
remove: () => {
|
|
@@ -3886,7 +3449,7 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3886
3449
|
}
|
|
3887
3450
|
};
|
|
3888
3451
|
}, []);
|
|
3889
|
-
const listenForResume =
|
|
3452
|
+
const listenForResume = useCallback7((callback) => {
|
|
3890
3453
|
setOnResumeCallbacks((c) => [...c, callback]);
|
|
3891
3454
|
return {
|
|
3892
3455
|
remove: () => {
|
|
@@ -3894,7 +3457,7 @@ var useBufferManager = (logLevel, mountTime) => {
|
|
|
3894
3457
|
}
|
|
3895
3458
|
};
|
|
3896
3459
|
}, []);
|
|
3897
|
-
|
|
3460
|
+
useEffect6(() => {
|
|
3898
3461
|
if (rendering) {
|
|
3899
3462
|
return;
|
|
3900
3463
|
}
|
|
@@ -3932,14 +3495,14 @@ var BufferingContextReact = React16.createContext(null);
|
|
|
3932
3495
|
var BufferingProvider = ({ children }) => {
|
|
3933
3496
|
const { logLevel, mountTime } = useContext20(LogLevelContext);
|
|
3934
3497
|
const bufferManager = useBufferManager(logLevel ?? "info", mountTime);
|
|
3935
|
-
return /* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ jsx16(BufferingContextReact.Provider, {
|
|
3936
3499
|
value: bufferManager,
|
|
3937
3500
|
children
|
|
3938
3501
|
});
|
|
3939
3502
|
};
|
|
3940
3503
|
var useIsPlayerBuffering = (bufferManager) => {
|
|
3941
|
-
const [isBuffering, setIsBuffering] =
|
|
3942
|
-
|
|
3504
|
+
const [isBuffering, setIsBuffering] = useState12(bufferManager.buffering.current);
|
|
3505
|
+
useEffect6(() => {
|
|
3943
3506
|
const onBuffer = () => {
|
|
3944
3507
|
setIsBuffering(true);
|
|
3945
3508
|
};
|
|
@@ -3992,7 +3555,7 @@ var useBufferUntilFirstFrame = ({
|
|
|
3992
3555
|
}) => {
|
|
3993
3556
|
const bufferingRef = useRef10(false);
|
|
3994
3557
|
const { delayPlayback } = useBufferState();
|
|
3995
|
-
const bufferUntilFirstFrame =
|
|
3558
|
+
const bufferUntilFirstFrame = useCallback8((requestedTime) => {
|
|
3996
3559
|
if (mediaType !== "video") {
|
|
3997
3560
|
return;
|
|
3998
3561
|
}
|
|
@@ -4108,7 +3671,7 @@ var seek = ({
|
|
|
4108
3671
|
};
|
|
4109
3672
|
|
|
4110
3673
|
// src/use-media-buffering.ts
|
|
4111
|
-
import { useEffect as
|
|
3674
|
+
import { useEffect as useEffect7, useState as useState13 } from "react";
|
|
4112
3675
|
var useMediaBuffering = ({
|
|
4113
3676
|
element,
|
|
4114
3677
|
shouldBuffer,
|
|
@@ -4119,8 +3682,8 @@ var useMediaBuffering = ({
|
|
|
4119
3682
|
src
|
|
4120
3683
|
}) => {
|
|
4121
3684
|
const buffer = useBufferState();
|
|
4122
|
-
const [isBuffering, setIsBuffering] =
|
|
4123
|
-
|
|
3685
|
+
const [isBuffering, setIsBuffering] = useState13(false);
|
|
3686
|
+
useEffect7(() => {
|
|
4124
3687
|
let cleanupFns = [];
|
|
4125
3688
|
const { current } = element;
|
|
4126
3689
|
if (!current) {
|
|
@@ -4248,7 +3811,7 @@ var useMediaBuffering = ({
|
|
|
4248
3811
|
};
|
|
4249
3812
|
|
|
4250
3813
|
// src/use-request-video-callback-time.ts
|
|
4251
|
-
import { useEffect as
|
|
3814
|
+
import { useEffect as useEffect8, useRef as useRef11 } from "react";
|
|
4252
3815
|
var useRequestVideoCallbackTime = ({
|
|
4253
3816
|
mediaRef,
|
|
4254
3817
|
mediaType,
|
|
@@ -4256,7 +3819,7 @@ var useRequestVideoCallbackTime = ({
|
|
|
4256
3819
|
onVariableFpsVideoDetected
|
|
4257
3820
|
}) => {
|
|
4258
3821
|
const currentTime = useRef11(null);
|
|
4259
|
-
|
|
3822
|
+
useEffect8(() => {
|
|
4260
3823
|
const { current } = mediaRef;
|
|
4261
3824
|
if (current) {
|
|
4262
3825
|
currentTime.current = {
|
|
@@ -4499,7 +4062,7 @@ var useMediaPlayback = ({
|
|
|
4499
4062
|
throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
|
|
4500
4063
|
}
|
|
4501
4064
|
const isVariableFpsVideoMap = useRef12({});
|
|
4502
|
-
const onVariableFpsVideoDetected =
|
|
4065
|
+
const onVariableFpsVideoDetected = useCallback9(() => {
|
|
4503
4066
|
if (!src) {
|
|
4504
4067
|
return;
|
|
4505
4068
|
}
|
|
@@ -4550,7 +4113,7 @@ var useMediaPlayback = ({
|
|
|
4550
4113
|
return acceptableTimeshift ?? defaultAcceptableTimeshift;
|
|
4551
4114
|
})();
|
|
4552
4115
|
const isPlayerBuffering = useIsPlayerBuffering(buffering);
|
|
4553
|
-
|
|
4116
|
+
useEffect9(() => {
|
|
4554
4117
|
if (mediaRef.current?.paused) {
|
|
4555
4118
|
return;
|
|
4556
4119
|
}
|
|
@@ -4595,7 +4158,7 @@ var useMediaPlayback = ({
|
|
|
4595
4158
|
mediaRef.current.playbackRate = playbackRateToSet;
|
|
4596
4159
|
}
|
|
4597
4160
|
}, [mediaRef, playbackRate]);
|
|
4598
|
-
|
|
4161
|
+
useEffect9(() => {
|
|
4599
4162
|
const tagName = mediaType === "audio" ? "<Html5Audio>" : "<Html5Video>";
|
|
4600
4163
|
if (!mediaRef.current) {
|
|
4601
4164
|
throw new Error(`No ${mediaType} ref found`);
|
|
@@ -4714,7 +4277,7 @@ var useMediaPlayback = ({
|
|
|
4714
4277
|
};
|
|
4715
4278
|
|
|
4716
4279
|
// src/use-media-tag.ts
|
|
4717
|
-
import { useContext as useContext23, useEffect as
|
|
4280
|
+
import { useContext as useContext23, useEffect as useEffect10 } from "react";
|
|
4718
4281
|
var useMediaTag = ({
|
|
4719
4282
|
mediaRef,
|
|
4720
4283
|
id,
|
|
@@ -4727,7 +4290,7 @@ var useMediaTag = ({
|
|
|
4727
4290
|
const logLevel = useLogLevel();
|
|
4728
4291
|
const mountTime = useMountTime();
|
|
4729
4292
|
const env = useRemotionEnvironment();
|
|
4730
|
-
|
|
4293
|
+
useEffect10(() => {
|
|
4731
4294
|
const tag = {
|
|
4732
4295
|
id,
|
|
4733
4296
|
play: (reason) => {
|
|
@@ -4804,9 +4367,9 @@ var warnAboutTooHighVolume = (volume) => {
|
|
|
4804
4367
|
};
|
|
4805
4368
|
|
|
4806
4369
|
// src/audio/AudioForPreview.tsx
|
|
4807
|
-
import { jsx as
|
|
4370
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
4808
4371
|
var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
4809
|
-
const [initialShouldPreMountAudioElements] =
|
|
4372
|
+
const [initialShouldPreMountAudioElements] = useState14(props.shouldPreMountAudioTags);
|
|
4810
4373
|
if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
|
|
4811
4374
|
throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");
|
|
4812
4375
|
}
|
|
@@ -4851,7 +4414,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4851
4414
|
}
|
|
4852
4415
|
const preloadedSrc = usePreload(src);
|
|
4853
4416
|
const sequenceContext = useContext25(SequenceContext);
|
|
4854
|
-
const [timelineId] =
|
|
4417
|
+
const [timelineId] = useState14(() => String(Math.random()));
|
|
4855
4418
|
const isSequenceHidden = hidden[timelineId] ?? false;
|
|
4856
4419
|
const userPreferredVolume = evaluateVolume({
|
|
4857
4420
|
frame: volumePropFrame,
|
|
@@ -4949,12 +4512,12 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4949
4512
|
});
|
|
4950
4513
|
};
|
|
4951
4514
|
}, [cleanupOnMediaTagUnmount]);
|
|
4952
|
-
|
|
4515
|
+
useImperativeHandle5(ref, () => {
|
|
4953
4516
|
return audioRef.current;
|
|
4954
4517
|
}, [audioRef]);
|
|
4955
4518
|
const currentOnDurationCallback = useRef13(onDuration);
|
|
4956
4519
|
currentOnDurationCallback.current = onDuration;
|
|
4957
|
-
|
|
4520
|
+
useEffect11(() => {
|
|
4958
4521
|
const { current } = audioRef;
|
|
4959
4522
|
if (!current) {
|
|
4960
4523
|
return;
|
|
@@ -4974,7 +4537,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4974
4537
|
if (initialShouldPreMountAudioElements) {
|
|
4975
4538
|
return null;
|
|
4976
4539
|
}
|
|
4977
|
-
return /* @__PURE__ */
|
|
4540
|
+
return /* @__PURE__ */ jsx17("audio", {
|
|
4978
4541
|
ref: audioRef,
|
|
4979
4542
|
preload: "metadata",
|
|
4980
4543
|
crossOrigin: crossOriginValue,
|
|
@@ -4987,13 +4550,13 @@ var AudioForPreview = forwardRef4(AudioForDevelopmentForwardRefFunction);
|
|
|
4987
4550
|
import {
|
|
4988
4551
|
forwardRef as forwardRef5,
|
|
4989
4552
|
useContext as useContext26,
|
|
4990
|
-
useEffect as
|
|
4991
|
-
useImperativeHandle as
|
|
4553
|
+
useEffect as useEffect12,
|
|
4554
|
+
useImperativeHandle as useImperativeHandle6,
|
|
4992
4555
|
useLayoutEffect as useLayoutEffect8,
|
|
4993
4556
|
useMemo as useMemo22,
|
|
4994
4557
|
useRef as useRef14
|
|
4995
4558
|
} from "react";
|
|
4996
|
-
import { jsx as
|
|
4559
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
4997
4560
|
var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
4998
4561
|
const audioRef = useRef14(null);
|
|
4999
4562
|
const {
|
|
@@ -5032,10 +4595,10 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
5032
4595
|
mediaVolume: 1
|
|
5033
4596
|
});
|
|
5034
4597
|
warnAboutTooHighVolume(volume);
|
|
5035
|
-
|
|
4598
|
+
useImperativeHandle6(ref, () => {
|
|
5036
4599
|
return audioRef.current;
|
|
5037
4600
|
}, []);
|
|
5038
|
-
|
|
4601
|
+
useEffect12(() => {
|
|
5039
4602
|
if (!props.src) {
|
|
5040
4603
|
throw new Error("No src passed");
|
|
5041
4604
|
}
|
|
@@ -5119,7 +4682,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
5119
4682
|
if (!needsToRenderAudioTag) {
|
|
5120
4683
|
return null;
|
|
5121
4684
|
}
|
|
5122
|
-
return /* @__PURE__ */
|
|
4685
|
+
return /* @__PURE__ */ jsx18("audio", {
|
|
5123
4686
|
ref: audioRef,
|
|
5124
4687
|
...nativeProps,
|
|
5125
4688
|
onError: onNativeError
|
|
@@ -5128,7 +4691,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
5128
4691
|
var AudioForRendering = forwardRef5(AudioForRenderingRefForwardingFunction);
|
|
5129
4692
|
|
|
5130
4693
|
// src/audio/Audio.tsx
|
|
5131
|
-
import { jsx as
|
|
4694
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
5132
4695
|
var AudioRefForwardingFunction = (props, ref) => {
|
|
5133
4696
|
const audioContext = useContext27(SharedAudioContext);
|
|
5134
4697
|
const {
|
|
@@ -5154,7 +4717,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5154
4717
|
throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
|
|
5155
4718
|
}
|
|
5156
4719
|
const preloadedSrc = usePreload(props.src);
|
|
5157
|
-
const onError =
|
|
4720
|
+
const onError = useCallback10((e) => {
|
|
5158
4721
|
console.log(e.currentTarget.error);
|
|
5159
4722
|
const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
|
|
5160
4723
|
if (loop) {
|
|
@@ -5168,7 +4731,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5168
4731
|
console.warn(errMessage);
|
|
5169
4732
|
}
|
|
5170
4733
|
}, [loop, onRemotionError, preloadedSrc]);
|
|
5171
|
-
const onDuration =
|
|
4734
|
+
const onDuration = useCallback10((src, durationInSeconds) => {
|
|
5172
4735
|
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
5173
4736
|
}, [setDurations]);
|
|
5174
4737
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props.src)];
|
|
@@ -5181,14 +4744,14 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5181
4744
|
});
|
|
5182
4745
|
if (loop && durationFetched !== undefined) {
|
|
5183
4746
|
if (!Number.isFinite(durationFetched)) {
|
|
5184
|
-
return /* @__PURE__ */
|
|
4747
|
+
return /* @__PURE__ */ jsx19(Html5Audio, {
|
|
5185
4748
|
...propsOtherThanLoop,
|
|
5186
4749
|
ref,
|
|
5187
4750
|
_remotionInternalNativeLoopPassed: true
|
|
5188
4751
|
});
|
|
5189
4752
|
}
|
|
5190
4753
|
const duration = durationFetched * fps;
|
|
5191
|
-
return /* @__PURE__ */
|
|
4754
|
+
return /* @__PURE__ */ jsx19(Loop, {
|
|
5192
4755
|
layout: "none",
|
|
5193
4756
|
durationInFrames: calculateMediaDuration({
|
|
5194
4757
|
trimAfter: trimAfterValue,
|
|
@@ -5196,7 +4759,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5196
4759
|
playbackRate: props.playbackRate ?? 1,
|
|
5197
4760
|
trimBefore: trimBeforeValue
|
|
5198
4761
|
}),
|
|
5199
|
-
children: /* @__PURE__ */
|
|
4762
|
+
children: /* @__PURE__ */ jsx19(Html5Audio, {
|
|
5200
4763
|
...propsOtherThanLoop,
|
|
5201
4764
|
ref,
|
|
5202
4765
|
_remotionInternalNativeLoopPassed: true
|
|
@@ -5204,13 +4767,13 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5204
4767
|
});
|
|
5205
4768
|
}
|
|
5206
4769
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
5207
|
-
return /* @__PURE__ */
|
|
4770
|
+
return /* @__PURE__ */ jsx19(Sequence, {
|
|
5208
4771
|
layout: "none",
|
|
5209
4772
|
from: 0 - (trimBeforeValue ?? 0),
|
|
5210
4773
|
showInTimeline: false,
|
|
5211
4774
|
durationInFrames: trimAfterValue,
|
|
5212
4775
|
name,
|
|
5213
|
-
children: /* @__PURE__ */
|
|
4776
|
+
children: /* @__PURE__ */ jsx19(Html5Audio, {
|
|
5214
4777
|
_remotionInternalNeedsDurationCalculation: Boolean(loop),
|
|
5215
4778
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
5216
4779
|
...otherProps,
|
|
@@ -5220,7 +4783,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5220
4783
|
}
|
|
5221
4784
|
validateMediaProps({ playbackRate: props.playbackRate, volume: props.volume }, "Html5Audio");
|
|
5222
4785
|
if (environment.isRendering) {
|
|
5223
|
-
return /* @__PURE__ */
|
|
4786
|
+
return /* @__PURE__ */ jsx19(AudioForRendering, {
|
|
5224
4787
|
onDuration,
|
|
5225
4788
|
...props,
|
|
5226
4789
|
ref,
|
|
@@ -5228,7 +4791,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
5228
4791
|
_remotionInternalNeedsDurationCalculation: Boolean(loop)
|
|
5229
4792
|
});
|
|
5230
4793
|
}
|
|
5231
|
-
return /* @__PURE__ */
|
|
4794
|
+
return /* @__PURE__ */ jsx19(AudioForPreview, {
|
|
5232
4795
|
_remotionInternalNativeLoopPassed: props._remotionInternalNativeLoopPassed ?? false,
|
|
5233
4796
|
_remotionInternalStack: stack ?? null,
|
|
5234
4797
|
shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0,
|
|
@@ -5245,11 +4808,11 @@ var Html5Audio = forwardRef6(AudioRefForwardingFunction);
|
|
|
5245
4808
|
addSequenceStackTraces(Html5Audio);
|
|
5246
4809
|
var Audio = Html5Audio;
|
|
5247
4810
|
// src/Composition.tsx
|
|
5248
|
-
import { Suspense, useContext as useContext29, useEffect as
|
|
4811
|
+
import { Suspense, useContext as useContext29, useEffect as useEffect14 } from "react";
|
|
5249
4812
|
import { createPortal } from "react-dom";
|
|
5250
4813
|
|
|
5251
4814
|
// src/Folder.tsx
|
|
5252
|
-
import { createContext as createContext18, useContext as useContext28, useEffect as
|
|
4815
|
+
import { createContext as createContext18, useContext as useContext28, useEffect as useEffect13, useMemo as useMemo23 } from "react";
|
|
5253
4816
|
|
|
5254
4817
|
// src/validation/validate-folder-name.ts
|
|
5255
4818
|
var getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
|
|
@@ -5268,7 +4831,7 @@ var validateFolderName = (name) => {
|
|
|
5268
4831
|
var invalidFolderNameErrorMessage = `Folder name must match ${String(getRegex())}`;
|
|
5269
4832
|
|
|
5270
4833
|
// src/Folder.tsx
|
|
5271
|
-
import { jsx as
|
|
4834
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
5272
4835
|
var FolderContext = createContext18({
|
|
5273
4836
|
folderName: null,
|
|
5274
4837
|
parentName: null
|
|
@@ -5285,20 +4848,20 @@ var Folder = ({ name, children }) => {
|
|
|
5285
4848
|
parentName
|
|
5286
4849
|
};
|
|
5287
4850
|
}, [name, parentName]);
|
|
5288
|
-
|
|
4851
|
+
useEffect13(() => {
|
|
5289
4852
|
registerFolder(name, parentName);
|
|
5290
4853
|
return () => {
|
|
5291
4854
|
unregisterFolder(name, parentName);
|
|
5292
4855
|
};
|
|
5293
4856
|
}, [name, parent.folderName, parentName, registerFolder, unregisterFolder]);
|
|
5294
|
-
return /* @__PURE__ */
|
|
4857
|
+
return /* @__PURE__ */ jsx20(FolderContext.Provider, {
|
|
5295
4858
|
value,
|
|
5296
4859
|
children
|
|
5297
4860
|
});
|
|
5298
4861
|
};
|
|
5299
4862
|
|
|
5300
4863
|
// src/loading-indicator.tsx
|
|
5301
|
-
import { jsx as
|
|
4864
|
+
import { jsx as jsx21, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5302
4865
|
var rotate = {
|
|
5303
4866
|
transform: `rotate(90deg)`
|
|
5304
4867
|
};
|
|
@@ -5317,7 +4880,7 @@ var Loading = () => {
|
|
|
5317
4880
|
style: container,
|
|
5318
4881
|
id: "remotion-comp-loading",
|
|
5319
4882
|
children: [
|
|
5320
|
-
/* @__PURE__ */
|
|
4883
|
+
/* @__PURE__ */ jsx21("style", {
|
|
5321
4884
|
type: "text/css",
|
|
5322
4885
|
children: `
|
|
5323
4886
|
@keyframes anim {
|
|
@@ -5334,12 +4897,12 @@ var Loading = () => {
|
|
|
5334
4897
|
}
|
|
5335
4898
|
`
|
|
5336
4899
|
}),
|
|
5337
|
-
/* @__PURE__ */
|
|
4900
|
+
/* @__PURE__ */ jsx21("svg", {
|
|
5338
4901
|
width: ICON_SIZE,
|
|
5339
4902
|
height: ICON_SIZE,
|
|
5340
4903
|
viewBox: "-100 -100 400 400",
|
|
5341
4904
|
style: rotate,
|
|
5342
|
-
children: /* @__PURE__ */
|
|
4905
|
+
children: /* @__PURE__ */ jsx21("path", {
|
|
5343
4906
|
fill: "#555",
|
|
5344
4907
|
stroke: "#555",
|
|
5345
4908
|
strokeWidth: "100",
|
|
@@ -5437,10 +5000,10 @@ var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
|
5437
5000
|
};
|
|
5438
5001
|
|
|
5439
5002
|
// src/Composition.tsx
|
|
5440
|
-
import { jsx as
|
|
5003
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5441
5004
|
var Fallback = () => {
|
|
5442
5005
|
const { continueRender: continueRender2, delayRender: delayRender2 } = useDelayRender();
|
|
5443
|
-
|
|
5006
|
+
useEffect14(() => {
|
|
5444
5007
|
const fallback = delayRender2("Waiting for Root component to unsuspend");
|
|
5445
5008
|
return () => continueRender2(fallback);
|
|
5446
5009
|
}, [continueRender2, delayRender2]);
|
|
@@ -5478,7 +5041,7 @@ var InnerComposition = ({
|
|
|
5478
5041
|
throw new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");
|
|
5479
5042
|
}
|
|
5480
5043
|
const { folderName, parentName } = useContext29(FolderContext);
|
|
5481
|
-
|
|
5044
|
+
useEffect14(() => {
|
|
5482
5045
|
if (!id) {
|
|
5483
5046
|
throw new Error("No id for composition passed.");
|
|
5484
5047
|
}
|
|
@@ -5517,7 +5080,7 @@ var InnerComposition = ({
|
|
|
5517
5080
|
registerComposition,
|
|
5518
5081
|
unregisterComposition
|
|
5519
5082
|
]);
|
|
5520
|
-
|
|
5083
|
+
useEffect14(() => {
|
|
5521
5084
|
window.dispatchEvent(new CustomEvent(PROPS_UPDATED_EXTERNALLY, {
|
|
5522
5085
|
detail: {
|
|
5523
5086
|
resetUnsaved: id
|
|
@@ -5530,10 +5093,10 @@ var InnerComposition = ({
|
|
|
5530
5093
|
if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
|
|
5531
5094
|
return null;
|
|
5532
5095
|
}
|
|
5533
|
-
return createPortal(/* @__PURE__ */
|
|
5534
|
-
children: /* @__PURE__ */
|
|
5535
|
-
fallback: /* @__PURE__ */
|
|
5536
|
-
children: /* @__PURE__ */
|
|
5096
|
+
return createPortal(/* @__PURE__ */ jsx22(CanUseRemotionHooksProvider, {
|
|
5097
|
+
children: /* @__PURE__ */ jsx22(Suspense, {
|
|
5098
|
+
fallback: /* @__PURE__ */ jsx22(Loading, {}),
|
|
5099
|
+
children: /* @__PURE__ */ jsx22(Comp, {
|
|
5537
5100
|
...resolved.result.props ?? {}
|
|
5538
5101
|
})
|
|
5539
5102
|
})
|
|
@@ -5544,10 +5107,10 @@ var InnerComposition = ({
|
|
|
5544
5107
|
if (resolved === null || resolved.type !== "success" && resolved.type !== "success-and-refreshing") {
|
|
5545
5108
|
return null;
|
|
5546
5109
|
}
|
|
5547
|
-
return createPortal(/* @__PURE__ */
|
|
5548
|
-
children: /* @__PURE__ */
|
|
5549
|
-
fallback: /* @__PURE__ */
|
|
5550
|
-
children: /* @__PURE__ */
|
|
5110
|
+
return createPortal(/* @__PURE__ */ jsx22(CanUseRemotionHooksProvider, {
|
|
5111
|
+
children: /* @__PURE__ */ jsx22(Suspense, {
|
|
5112
|
+
fallback: /* @__PURE__ */ jsx22(Fallback, {}),
|
|
5113
|
+
children: /* @__PURE__ */ jsx22(Comp, {
|
|
5551
5114
|
...resolved.result.props ?? {}
|
|
5552
5115
|
})
|
|
5553
5116
|
})
|
|
@@ -5560,7 +5123,7 @@ var Composition = (props2) => {
|
|
|
5560
5123
|
if (onlyRenderComposition && onlyRenderComposition !== props2.id) {
|
|
5561
5124
|
return null;
|
|
5562
5125
|
}
|
|
5563
|
-
return /* @__PURE__ */
|
|
5126
|
+
return /* @__PURE__ */ jsx22(InnerComposition, {
|
|
5564
5127
|
...props2
|
|
5565
5128
|
});
|
|
5566
5129
|
};
|
|
@@ -5778,8 +5341,8 @@ var getStaticFiles = () => {
|
|
|
5778
5341
|
return window.remotion_staticFiles;
|
|
5779
5342
|
};
|
|
5780
5343
|
// src/IFrame.tsx
|
|
5781
|
-
import { forwardRef as forwardRef7, useCallback as
|
|
5782
|
-
import { jsx as
|
|
5344
|
+
import { forwardRef as forwardRef7, useCallback as useCallback11, useState as useState15 } from "react";
|
|
5345
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5783
5346
|
var IFrameRefForwarding = ({
|
|
5784
5347
|
onLoad,
|
|
5785
5348
|
onError,
|
|
@@ -5788,15 +5351,15 @@ var IFrameRefForwarding = ({
|
|
|
5788
5351
|
...props2
|
|
5789
5352
|
}, ref) => {
|
|
5790
5353
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
5791
|
-
const [handle] =
|
|
5354
|
+
const [handle] = useState15(() => delayRender2(`Loading <IFrame> with source ${props2.src}`, {
|
|
5792
5355
|
retries: delayRenderRetries ?? undefined,
|
|
5793
5356
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
5794
5357
|
}));
|
|
5795
|
-
const didLoad =
|
|
5358
|
+
const didLoad = useCallback11((e) => {
|
|
5796
5359
|
continueRender2(handle);
|
|
5797
5360
|
onLoad?.(e);
|
|
5798
5361
|
}, [handle, onLoad, continueRender2]);
|
|
5799
|
-
const didGetError =
|
|
5362
|
+
const didGetError = useCallback11((e) => {
|
|
5800
5363
|
continueRender2(handle);
|
|
5801
5364
|
if (onError) {
|
|
5802
5365
|
onError(e);
|
|
@@ -5804,7 +5367,7 @@ var IFrameRefForwarding = ({
|
|
|
5804
5367
|
console.error("Error loading iframe:", e, "Handle the event using the onError() prop to make this message disappear.");
|
|
5805
5368
|
}
|
|
5806
5369
|
}, [handle, onError, continueRender2]);
|
|
5807
|
-
return /* @__PURE__ */
|
|
5370
|
+
return /* @__PURE__ */ jsx23("iframe", {
|
|
5808
5371
|
referrerPolicy: "strict-origin-when-cross-origin",
|
|
5809
5372
|
...props2,
|
|
5810
5373
|
ref,
|
|
@@ -5816,13 +5379,13 @@ var IFrame = forwardRef7(IFrameRefForwarding);
|
|
|
5816
5379
|
// src/Img.tsx
|
|
5817
5380
|
import {
|
|
5818
5381
|
forwardRef as forwardRef8,
|
|
5819
|
-
useCallback as
|
|
5382
|
+
useCallback as useCallback12,
|
|
5820
5383
|
useContext as useContext30,
|
|
5821
|
-
useImperativeHandle as
|
|
5384
|
+
useImperativeHandle as useImperativeHandle7,
|
|
5822
5385
|
useLayoutEffect as useLayoutEffect9,
|
|
5823
5386
|
useRef as useRef15
|
|
5824
5387
|
} from "react";
|
|
5825
|
-
import { jsx as
|
|
5388
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5826
5389
|
function exponentialBackoff(errorCount) {
|
|
5827
5390
|
return 1000 * 2 ** (errorCount - 1);
|
|
5828
5391
|
}
|
|
@@ -5848,11 +5411,11 @@ var ImgRefForwarding = ({
|
|
|
5848
5411
|
if (!_propsValid) {
|
|
5849
5412
|
throw new Error("typecheck error");
|
|
5850
5413
|
}
|
|
5851
|
-
|
|
5414
|
+
useImperativeHandle7(ref, () => {
|
|
5852
5415
|
return imageRef.current;
|
|
5853
5416
|
}, []);
|
|
5854
5417
|
const actualSrc = usePreload(src);
|
|
5855
|
-
const retryIn =
|
|
5418
|
+
const retryIn = useCallback12((timeout) => {
|
|
5856
5419
|
if (!imageRef.current) {
|
|
5857
5420
|
return;
|
|
5858
5421
|
}
|
|
@@ -5869,7 +5432,7 @@ var ImgRefForwarding = ({
|
|
|
5869
5432
|
imageRef.current.setAttribute("src", newSrc);
|
|
5870
5433
|
}, timeout);
|
|
5871
5434
|
}, []);
|
|
5872
|
-
const didGetError =
|
|
5435
|
+
const didGetError = useCallback12((e) => {
|
|
5873
5436
|
if (!errors.current) {
|
|
5874
5437
|
return;
|
|
5875
5438
|
}
|
|
@@ -5962,7 +5525,7 @@ var ImgRefForwarding = ({
|
|
|
5962
5525
|
requestsVideoFrame: false,
|
|
5963
5526
|
isClientSideRendering
|
|
5964
5527
|
});
|
|
5965
|
-
return /* @__PURE__ */
|
|
5528
|
+
return /* @__PURE__ */ jsx24("img", {
|
|
5966
5529
|
...props2,
|
|
5967
5530
|
ref: imageRef,
|
|
5968
5531
|
crossOrigin: crossOriginValue,
|
|
@@ -5980,13 +5543,13 @@ var compositionsRef = React25.createRef();
|
|
|
5980
5543
|
|
|
5981
5544
|
// src/CompositionManagerProvider.tsx
|
|
5982
5545
|
import {
|
|
5983
|
-
useCallback as
|
|
5984
|
-
useImperativeHandle as
|
|
5546
|
+
useCallback as useCallback13,
|
|
5547
|
+
useImperativeHandle as useImperativeHandle8,
|
|
5985
5548
|
useMemo as useMemo25,
|
|
5986
5549
|
useRef as useRef16,
|
|
5987
|
-
useState as
|
|
5550
|
+
useState as useState16
|
|
5988
5551
|
} from "react";
|
|
5989
|
-
import { jsx as
|
|
5552
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
5990
5553
|
var CompositionManagerProvider = ({
|
|
5991
5554
|
children,
|
|
5992
5555
|
onlyRenderComposition,
|
|
@@ -5994,18 +5557,18 @@ var CompositionManagerProvider = ({
|
|
|
5994
5557
|
initialCompositions,
|
|
5995
5558
|
initialCanvasContent
|
|
5996
5559
|
}) => {
|
|
5997
|
-
const [folders, setFolders] =
|
|
5998
|
-
const [canvasContent, setCanvasContent] =
|
|
5999
|
-
const [compositions, setCompositions] =
|
|
5560
|
+
const [folders, setFolders] = useState16([]);
|
|
5561
|
+
const [canvasContent, setCanvasContent] = useState16(initialCanvasContent);
|
|
5562
|
+
const [compositions, setCompositions] = useState16(initialCompositions);
|
|
6000
5563
|
const currentcompositionsRef = useRef16(compositions);
|
|
6001
|
-
const updateCompositions =
|
|
5564
|
+
const updateCompositions = useCallback13((updateComps) => {
|
|
6002
5565
|
setCompositions((comps) => {
|
|
6003
5566
|
const updated = updateComps(comps);
|
|
6004
5567
|
currentcompositionsRef.current = updated;
|
|
6005
5568
|
return updated;
|
|
6006
5569
|
});
|
|
6007
5570
|
}, []);
|
|
6008
|
-
const registerComposition =
|
|
5571
|
+
const registerComposition = useCallback13((comp) => {
|
|
6009
5572
|
updateCompositions((comps) => {
|
|
6010
5573
|
if (comps.find((c2) => c2.id === comp.id)) {
|
|
6011
5574
|
throw new Error(`Multiple composition with id ${comp.id} are registered.`);
|
|
@@ -6014,12 +5577,12 @@ var CompositionManagerProvider = ({
|
|
|
6014
5577
|
return value;
|
|
6015
5578
|
});
|
|
6016
5579
|
}, [updateCompositions]);
|
|
6017
|
-
const unregisterComposition =
|
|
5580
|
+
const unregisterComposition = useCallback13((id) => {
|
|
6018
5581
|
setCompositions((comps) => {
|
|
6019
5582
|
return comps.filter((c2) => c2.id !== id);
|
|
6020
5583
|
});
|
|
6021
5584
|
}, []);
|
|
6022
|
-
const registerFolder =
|
|
5585
|
+
const registerFolder = useCallback13((name, parent) => {
|
|
6023
5586
|
setFolders((prevFolders) => {
|
|
6024
5587
|
return [
|
|
6025
5588
|
...prevFolders,
|
|
@@ -6030,17 +5593,17 @@ var CompositionManagerProvider = ({
|
|
|
6030
5593
|
];
|
|
6031
5594
|
});
|
|
6032
5595
|
}, []);
|
|
6033
|
-
const unregisterFolder =
|
|
5596
|
+
const unregisterFolder = useCallback13((name, parent) => {
|
|
6034
5597
|
setFolders((prevFolders) => {
|
|
6035
5598
|
return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
|
|
6036
5599
|
});
|
|
6037
5600
|
}, []);
|
|
6038
|
-
|
|
5601
|
+
useImperativeHandle8(compositionsRef, () => {
|
|
6039
5602
|
return {
|
|
6040
5603
|
getCompositions: () => currentcompositionsRef.current
|
|
6041
5604
|
};
|
|
6042
5605
|
}, []);
|
|
6043
|
-
const updateCompositionDefaultProps =
|
|
5606
|
+
const updateCompositionDefaultProps = useCallback13((id, newDefaultProps) => {
|
|
6044
5607
|
setCompositions((comps) => {
|
|
6045
5608
|
const updated = comps.map((c2) => {
|
|
6046
5609
|
if (c2.id === id) {
|
|
@@ -6080,9 +5643,9 @@ var CompositionManagerProvider = ({
|
|
|
6080
5643
|
canvasContent
|
|
6081
5644
|
};
|
|
6082
5645
|
}, [compositions, folders, currentCompositionMetadata, canvasContent]);
|
|
6083
|
-
return /* @__PURE__ */
|
|
5646
|
+
return /* @__PURE__ */ jsx25(CompositionManager.Provider, {
|
|
6084
5647
|
value: compositionManagerContextValue,
|
|
6085
|
-
children: /* @__PURE__ */
|
|
5648
|
+
children: /* @__PURE__ */ jsx25(CompositionSetters.Provider, {
|
|
6086
5649
|
value: compositionManagerSetters,
|
|
6087
5650
|
children
|
|
6088
5651
|
})
|
|
@@ -6191,11 +5754,11 @@ var waitForRoot = (fn) => {
|
|
|
6191
5754
|
};
|
|
6192
5755
|
|
|
6193
5756
|
// src/RemotionRoot.tsx
|
|
6194
|
-
import {
|
|
5757
|
+
import { useMemo as useMemo27 } from "react";
|
|
6195
5758
|
|
|
6196
5759
|
// src/use-media-enabled.tsx
|
|
6197
5760
|
import { createContext as createContext19, useContext as useContext31, useMemo as useMemo26 } from "react";
|
|
6198
|
-
import { jsx as
|
|
5761
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
6199
5762
|
var MediaEnabledContext = createContext19(null);
|
|
6200
5763
|
var useVideoEnabled = () => {
|
|
6201
5764
|
const context = useContext31(MediaEnabledContext);
|
|
@@ -6223,14 +5786,14 @@ var MediaEnabledProvider = ({
|
|
|
6223
5786
|
audioEnabled
|
|
6224
5787
|
}) => {
|
|
6225
5788
|
const value = useMemo26(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
|
|
6226
|
-
return /* @__PURE__ */
|
|
5789
|
+
return /* @__PURE__ */ jsx26(MediaEnabledContext.Provider, {
|
|
6227
5790
|
value,
|
|
6228
5791
|
children
|
|
6229
5792
|
});
|
|
6230
5793
|
};
|
|
6231
5794
|
|
|
6232
5795
|
// src/RemotionRoot.tsx
|
|
6233
|
-
import { jsx as
|
|
5796
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6234
5797
|
var RemotionRootContexts = ({
|
|
6235
5798
|
children,
|
|
6236
5799
|
numberOfAudioTags,
|
|
@@ -6238,61 +5801,37 @@ var RemotionRootContexts = ({
|
|
|
6238
5801
|
audioLatencyHint,
|
|
6239
5802
|
videoEnabled,
|
|
6240
5803
|
audioEnabled,
|
|
6241
|
-
frameState
|
|
5804
|
+
frameState,
|
|
5805
|
+
nonceContextSeed
|
|
6242
5806
|
}) => {
|
|
6243
|
-
const [fastRefreshes, setFastRefreshes] = useState18(0);
|
|
6244
|
-
const [manualRefreshes, setManualRefreshes] = useState18(0);
|
|
6245
5807
|
const nonceContext = useMemo27(() => {
|
|
6246
5808
|
let counter = 0;
|
|
6247
5809
|
return {
|
|
6248
|
-
getNonce: () => counter
|
|
6249
|
-
fastRefreshes,
|
|
6250
|
-
manualRefreshes
|
|
6251
|
-
};
|
|
6252
|
-
}, [fastRefreshes, manualRefreshes]);
|
|
6253
|
-
const setNonceContext = useMemo27(() => {
|
|
6254
|
-
return {
|
|
6255
|
-
increaseManualRefreshes: () => {
|
|
6256
|
-
setManualRefreshes((i) => i + 1);
|
|
6257
|
-
}
|
|
5810
|
+
getNonce: () => counter++
|
|
6258
5811
|
};
|
|
6259
|
-
}, []);
|
|
6260
|
-
useEffect16(() => {
|
|
6261
|
-
if (typeof __webpack_module__ !== "undefined") {
|
|
6262
|
-
if (__webpack_module__.hot) {
|
|
6263
|
-
__webpack_module__.hot.addStatusHandler((status) => {
|
|
6264
|
-
if (status === "idle") {
|
|
6265
|
-
setFastRefreshes((i) => i + 1);
|
|
6266
|
-
}
|
|
6267
|
-
});
|
|
6268
|
-
}
|
|
6269
|
-
}
|
|
6270
|
-
}, []);
|
|
5812
|
+
}, [nonceContextSeed]);
|
|
6271
5813
|
const logging = useMemo27(() => {
|
|
6272
5814
|
return { logLevel, mountTime: Date.now() };
|
|
6273
5815
|
}, [logLevel]);
|
|
6274
|
-
return /* @__PURE__ */
|
|
5816
|
+
return /* @__PURE__ */ jsx27(LogLevelContext.Provider, {
|
|
6275
5817
|
value: logging,
|
|
6276
|
-
children: /* @__PURE__ */
|
|
5818
|
+
children: /* @__PURE__ */ jsx27(NonceContext.Provider, {
|
|
6277
5819
|
value: nonceContext,
|
|
6278
|
-
children: /* @__PURE__ */
|
|
6279
|
-
|
|
6280
|
-
children: /* @__PURE__ */
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
children: /* @__PURE__ */ jsx28(BufferingProvider, {
|
|
6294
|
-
children
|
|
6295
|
-
})
|
|
5820
|
+
children: /* @__PURE__ */ jsx27(TimelineContextProvider, {
|
|
5821
|
+
frameState,
|
|
5822
|
+
children: /* @__PURE__ */ jsx27(MediaEnabledProvider, {
|
|
5823
|
+
videoEnabled,
|
|
5824
|
+
audioEnabled,
|
|
5825
|
+
children: /* @__PURE__ */ jsx27(EditorPropsProvider, {
|
|
5826
|
+
children: /* @__PURE__ */ jsx27(PrefetchProvider, {
|
|
5827
|
+
children: /* @__PURE__ */ jsx27(SequenceManagerProvider, {
|
|
5828
|
+
children: /* @__PURE__ */ jsx27(SharedAudioContextProvider, {
|
|
5829
|
+
numberOfAudioTags,
|
|
5830
|
+
audioLatencyHint,
|
|
5831
|
+
audioEnabled,
|
|
5832
|
+
children: /* @__PURE__ */ jsx27(DurationsContextProvider, {
|
|
5833
|
+
children: /* @__PURE__ */ jsx27(BufferingProvider, {
|
|
5834
|
+
children
|
|
6296
5835
|
})
|
|
6297
5836
|
})
|
|
6298
5837
|
})
|
|
@@ -6305,6 +5844,176 @@ var RemotionRootContexts = ({
|
|
|
6305
5844
|
});
|
|
6306
5845
|
};
|
|
6307
5846
|
|
|
5847
|
+
// src/codec.ts
|
|
5848
|
+
var validCodecs = [
|
|
5849
|
+
"h264",
|
|
5850
|
+
"h265",
|
|
5851
|
+
"vp8",
|
|
5852
|
+
"vp9",
|
|
5853
|
+
"mp3",
|
|
5854
|
+
"aac",
|
|
5855
|
+
"wav",
|
|
5856
|
+
"prores",
|
|
5857
|
+
"h264-mkv",
|
|
5858
|
+
"h264-ts",
|
|
5859
|
+
"gif"
|
|
5860
|
+
];
|
|
5861
|
+
|
|
5862
|
+
// src/validation/validate-default-codec.ts
|
|
5863
|
+
function validateCodec(defaultCodec, location, name) {
|
|
5864
|
+
if (typeof defaultCodec === "undefined") {
|
|
5865
|
+
return;
|
|
5866
|
+
}
|
|
5867
|
+
if (typeof defaultCodec !== "string") {
|
|
5868
|
+
throw new TypeError(`The "${name}" prop ${location} must be a string, but you passed a value of type ${typeof defaultCodec}.`);
|
|
5869
|
+
}
|
|
5870
|
+
if (!validCodecs.includes(defaultCodec)) {
|
|
5871
|
+
throw new Error(`The "${name}" prop ${location} must be one of ${validCodecs.join(", ")}, but you passed ${defaultCodec}.`);
|
|
5872
|
+
}
|
|
5873
|
+
}
|
|
5874
|
+
|
|
5875
|
+
// src/resolve-video-config.ts
|
|
5876
|
+
var validateCalculated = ({
|
|
5877
|
+
calculated,
|
|
5878
|
+
compositionId,
|
|
5879
|
+
compositionFps,
|
|
5880
|
+
compositionHeight,
|
|
5881
|
+
compositionWidth,
|
|
5882
|
+
compositionDurationInFrames
|
|
5883
|
+
}) => {
|
|
5884
|
+
const calculateMetadataErrorLocation = `calculated by calculateMetadata() for the composition "${compositionId}"`;
|
|
5885
|
+
const defaultErrorLocation = `of the "<Composition />" component with the id "${compositionId}"`;
|
|
5886
|
+
const width = calculated?.width ?? compositionWidth ?? undefined;
|
|
5887
|
+
validateDimension(width, "width", calculated?.width ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
5888
|
+
const height = calculated?.height ?? compositionHeight ?? undefined;
|
|
5889
|
+
validateDimension(height, "height", calculated?.height ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
5890
|
+
const fps = calculated?.fps ?? compositionFps ?? null;
|
|
5891
|
+
validateFps(fps, calculated?.fps ? calculateMetadataErrorLocation : defaultErrorLocation, false);
|
|
5892
|
+
const durationInFrames = calculated?.durationInFrames ?? compositionDurationInFrames ?? null;
|
|
5893
|
+
validateDurationInFrames(durationInFrames, {
|
|
5894
|
+
allowFloats: false,
|
|
5895
|
+
component: `of the "<Composition />" component with the id "${compositionId}"`
|
|
5896
|
+
});
|
|
5897
|
+
const defaultCodec = calculated?.defaultCodec;
|
|
5898
|
+
validateCodec(defaultCodec, calculateMetadataErrorLocation, "defaultCodec");
|
|
5899
|
+
const defaultOutName = calculated?.defaultOutName;
|
|
5900
|
+
const defaultVideoImageFormat = calculated?.defaultVideoImageFormat;
|
|
5901
|
+
const defaultPixelFormat = calculated?.defaultPixelFormat;
|
|
5902
|
+
const defaultProResProfile = calculated?.defaultProResProfile;
|
|
5903
|
+
return {
|
|
5904
|
+
width,
|
|
5905
|
+
height,
|
|
5906
|
+
fps,
|
|
5907
|
+
durationInFrames,
|
|
5908
|
+
defaultCodec,
|
|
5909
|
+
defaultOutName,
|
|
5910
|
+
defaultVideoImageFormat,
|
|
5911
|
+
defaultPixelFormat,
|
|
5912
|
+
defaultProResProfile
|
|
5913
|
+
};
|
|
5914
|
+
};
|
|
5915
|
+
var resolveVideoConfig = ({
|
|
5916
|
+
calculateMetadata,
|
|
5917
|
+
signal,
|
|
5918
|
+
defaultProps,
|
|
5919
|
+
inputProps: originalProps,
|
|
5920
|
+
compositionId,
|
|
5921
|
+
compositionDurationInFrames,
|
|
5922
|
+
compositionFps,
|
|
5923
|
+
compositionHeight,
|
|
5924
|
+
compositionWidth
|
|
5925
|
+
}) => {
|
|
5926
|
+
const calculatedProm = calculateMetadata ? calculateMetadata({
|
|
5927
|
+
defaultProps,
|
|
5928
|
+
props: originalProps,
|
|
5929
|
+
abortSignal: signal,
|
|
5930
|
+
compositionId,
|
|
5931
|
+
isRendering: getRemotionEnvironment().isRendering
|
|
5932
|
+
}) : null;
|
|
5933
|
+
if (calculatedProm !== null && typeof calculatedProm === "object" && "then" in calculatedProm) {
|
|
5934
|
+
return calculatedProm.then((c2) => {
|
|
5935
|
+
const {
|
|
5936
|
+
height,
|
|
5937
|
+
width,
|
|
5938
|
+
durationInFrames,
|
|
5939
|
+
fps,
|
|
5940
|
+
defaultCodec,
|
|
5941
|
+
defaultOutName,
|
|
5942
|
+
defaultVideoImageFormat,
|
|
5943
|
+
defaultPixelFormat,
|
|
5944
|
+
defaultProResProfile
|
|
5945
|
+
} = validateCalculated({
|
|
5946
|
+
calculated: c2,
|
|
5947
|
+
compositionDurationInFrames,
|
|
5948
|
+
compositionFps,
|
|
5949
|
+
compositionHeight,
|
|
5950
|
+
compositionWidth,
|
|
5951
|
+
compositionId
|
|
5952
|
+
});
|
|
5953
|
+
return {
|
|
5954
|
+
width,
|
|
5955
|
+
height,
|
|
5956
|
+
fps,
|
|
5957
|
+
durationInFrames,
|
|
5958
|
+
id: compositionId,
|
|
5959
|
+
defaultProps: serializeThenDeserializeInStudio(defaultProps),
|
|
5960
|
+
props: serializeThenDeserializeInStudio(c2.props ?? originalProps),
|
|
5961
|
+
defaultCodec: defaultCodec ?? null,
|
|
5962
|
+
defaultOutName: defaultOutName ?? null,
|
|
5963
|
+
defaultVideoImageFormat: defaultVideoImageFormat ?? null,
|
|
5964
|
+
defaultPixelFormat: defaultPixelFormat ?? null,
|
|
5965
|
+
defaultProResProfile: defaultProResProfile ?? null
|
|
5966
|
+
};
|
|
5967
|
+
});
|
|
5968
|
+
}
|
|
5969
|
+
const data = validateCalculated({
|
|
5970
|
+
calculated: calculatedProm,
|
|
5971
|
+
compositionDurationInFrames,
|
|
5972
|
+
compositionFps,
|
|
5973
|
+
compositionHeight,
|
|
5974
|
+
compositionWidth,
|
|
5975
|
+
compositionId
|
|
5976
|
+
});
|
|
5977
|
+
if (calculatedProm === null) {
|
|
5978
|
+
return {
|
|
5979
|
+
...data,
|
|
5980
|
+
id: compositionId,
|
|
5981
|
+
defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
|
|
5982
|
+
props: serializeThenDeserializeInStudio(originalProps),
|
|
5983
|
+
defaultCodec: null,
|
|
5984
|
+
defaultOutName: null,
|
|
5985
|
+
defaultVideoImageFormat: null,
|
|
5986
|
+
defaultPixelFormat: null,
|
|
5987
|
+
defaultProResProfile: null
|
|
5988
|
+
};
|
|
5989
|
+
}
|
|
5990
|
+
return {
|
|
5991
|
+
...data,
|
|
5992
|
+
id: compositionId,
|
|
5993
|
+
defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
|
|
5994
|
+
props: serializeThenDeserializeInStudio(calculatedProm.props ?? originalProps),
|
|
5995
|
+
defaultCodec: calculatedProm.defaultCodec ?? null,
|
|
5996
|
+
defaultOutName: calculatedProm.defaultOutName ?? null,
|
|
5997
|
+
defaultVideoImageFormat: calculatedProm.defaultVideoImageFormat ?? null,
|
|
5998
|
+
defaultPixelFormat: calculatedProm.defaultPixelFormat ?? null,
|
|
5999
|
+
defaultProResProfile: calculatedProm.defaultProResProfile ?? null
|
|
6000
|
+
};
|
|
6001
|
+
};
|
|
6002
|
+
var resolveVideoConfigOrCatch = (params) => {
|
|
6003
|
+
try {
|
|
6004
|
+
const promiseOrReturnValue = resolveVideoConfig(params);
|
|
6005
|
+
return {
|
|
6006
|
+
type: "success",
|
|
6007
|
+
result: promiseOrReturnValue
|
|
6008
|
+
};
|
|
6009
|
+
} catch (err) {
|
|
6010
|
+
return {
|
|
6011
|
+
type: "error",
|
|
6012
|
+
error: err
|
|
6013
|
+
};
|
|
6014
|
+
}
|
|
6015
|
+
};
|
|
6016
|
+
|
|
6308
6017
|
// src/setup-env-variables.ts
|
|
6309
6018
|
var getEnvVariables = () => {
|
|
6310
6019
|
if (getRemotionEnvironment().isRendering) {
|
|
@@ -6390,16 +6099,16 @@ var useCurrentScale = (options) => {
|
|
|
6390
6099
|
};
|
|
6391
6100
|
|
|
6392
6101
|
// src/video/OffthreadVideo.tsx
|
|
6393
|
-
import { useCallback as
|
|
6102
|
+
import { useCallback as useCallback15 } from "react";
|
|
6394
6103
|
|
|
6395
6104
|
// src/video/OffthreadVideoForRendering.tsx
|
|
6396
6105
|
import {
|
|
6397
|
-
useCallback as
|
|
6106
|
+
useCallback as useCallback14,
|
|
6398
6107
|
useContext as useContext32,
|
|
6399
|
-
useEffect as
|
|
6108
|
+
useEffect as useEffect15,
|
|
6400
6109
|
useLayoutEffect as useLayoutEffect10,
|
|
6401
6110
|
useMemo as useMemo28,
|
|
6402
|
-
useState as
|
|
6111
|
+
useState as useState17
|
|
6403
6112
|
} from "react";
|
|
6404
6113
|
|
|
6405
6114
|
// src/video/offthread-video-source.ts
|
|
@@ -6413,7 +6122,7 @@ var getOffthreadVideoSource = ({
|
|
|
6413
6122
|
};
|
|
6414
6123
|
|
|
6415
6124
|
// src/video/OffthreadVideoForRendering.tsx
|
|
6416
|
-
import { jsx as
|
|
6125
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6417
6126
|
var OffthreadVideoForRendering = ({
|
|
6418
6127
|
onError,
|
|
6419
6128
|
volume: volumeProp,
|
|
@@ -6458,7 +6167,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6458
6167
|
mediaVolume: 1
|
|
6459
6168
|
});
|
|
6460
6169
|
warnAboutTooHighVolume(volume);
|
|
6461
|
-
|
|
6170
|
+
useEffect15(() => {
|
|
6462
6171
|
if (!src) {
|
|
6463
6172
|
throw new Error("No src passed");
|
|
6464
6173
|
}
|
|
@@ -6513,7 +6222,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6513
6222
|
toneMapped
|
|
6514
6223
|
});
|
|
6515
6224
|
}, [toneMapped, currentTime, src, transparent]);
|
|
6516
|
-
const [imageSrc, setImageSrc] =
|
|
6225
|
+
const [imageSrc, setImageSrc] = useState17(null);
|
|
6517
6226
|
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
6518
6227
|
useLayoutEffect10(() => {
|
|
6519
6228
|
if (!window.remotion_videoEnabled) {
|
|
@@ -6586,7 +6295,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6586
6295
|
continueRender2,
|
|
6587
6296
|
delayRender2
|
|
6588
6297
|
]);
|
|
6589
|
-
const onErr =
|
|
6298
|
+
const onErr = useCallback14(() => {
|
|
6590
6299
|
if (onError) {
|
|
6591
6300
|
onError?.(new Error("Failed to load image with src " + imageSrc));
|
|
6592
6301
|
} else {
|
|
@@ -6596,7 +6305,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6596
6305
|
const className = useMemo28(() => {
|
|
6597
6306
|
return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
|
|
6598
6307
|
}, [props2.className]);
|
|
6599
|
-
const onImageFrame =
|
|
6308
|
+
const onImageFrame = useCallback14((img) => {
|
|
6600
6309
|
if (onVideoFrame) {
|
|
6601
6310
|
onVideoFrame(img);
|
|
6602
6311
|
}
|
|
@@ -6605,7 +6314,7 @@ var OffthreadVideoForRendering = ({
|
|
|
6605
6314
|
return null;
|
|
6606
6315
|
}
|
|
6607
6316
|
continueRender2(imageSrc.handle);
|
|
6608
|
-
return /* @__PURE__ */
|
|
6317
|
+
return /* @__PURE__ */ jsx28(Img, {
|
|
6609
6318
|
src: imageSrc.src,
|
|
6610
6319
|
delayRenderRetries,
|
|
6611
6320
|
delayRenderTimeoutInMilliseconds,
|
|
@@ -6620,20 +6329,20 @@ var OffthreadVideoForRendering = ({
|
|
|
6620
6329
|
import React30, {
|
|
6621
6330
|
forwardRef as forwardRef9,
|
|
6622
6331
|
useContext as useContext33,
|
|
6623
|
-
useEffect as
|
|
6624
|
-
useImperativeHandle as
|
|
6332
|
+
useEffect as useEffect17,
|
|
6333
|
+
useImperativeHandle as useImperativeHandle9,
|
|
6625
6334
|
useMemo as useMemo29,
|
|
6626
6335
|
useRef as useRef17,
|
|
6627
|
-
useState as
|
|
6336
|
+
useState as useState18
|
|
6628
6337
|
} from "react";
|
|
6629
6338
|
|
|
6630
6339
|
// src/video/emit-video-frame.ts
|
|
6631
|
-
import { useEffect as
|
|
6340
|
+
import { useEffect as useEffect16 } from "react";
|
|
6632
6341
|
var useEmitVideoFrame = ({
|
|
6633
6342
|
ref,
|
|
6634
6343
|
onVideoFrame
|
|
6635
6344
|
}) => {
|
|
6636
|
-
|
|
6345
|
+
useEffect16(() => {
|
|
6637
6346
|
const { current } = ref;
|
|
6638
6347
|
if (!current) {
|
|
6639
6348
|
return;
|
|
@@ -6657,7 +6366,7 @@ var useEmitVideoFrame = ({
|
|
|
6657
6366
|
};
|
|
6658
6367
|
|
|
6659
6368
|
// src/video/VideoForPreview.tsx
|
|
6660
|
-
import { jsx as
|
|
6369
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6661
6370
|
var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
6662
6371
|
const context = useContext33(SharedAudioContext);
|
|
6663
6372
|
if (!context) {
|
|
@@ -6719,7 +6428,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6719
6428
|
const { hidden } = useContext33(SequenceVisibilityToggleContext);
|
|
6720
6429
|
const logLevel = useLogLevel();
|
|
6721
6430
|
const mountTime = useMountTime();
|
|
6722
|
-
const [timelineId] =
|
|
6431
|
+
const [timelineId] = useState18(() => String(Math.random()));
|
|
6723
6432
|
const isSequenceHidden = hidden[timelineId] ?? false;
|
|
6724
6433
|
if (typeof acceptableTimeShift !== "undefined") {
|
|
6725
6434
|
throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
|
|
@@ -6782,16 +6491,16 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6782
6491
|
duration,
|
|
6783
6492
|
fps
|
|
6784
6493
|
});
|
|
6785
|
-
|
|
6494
|
+
useImperativeHandle9(ref, () => {
|
|
6786
6495
|
return videoRef.current;
|
|
6787
6496
|
}, []);
|
|
6788
|
-
|
|
6497
|
+
useState18(() => playbackLogging({
|
|
6789
6498
|
logLevel,
|
|
6790
6499
|
message: `Mounting video with source = ${actualSrc}, v=${VERSION}, user agent=${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
|
|
6791
6500
|
tag: "video",
|
|
6792
6501
|
mountTime
|
|
6793
6502
|
}));
|
|
6794
|
-
|
|
6503
|
+
useEffect17(() => {
|
|
6795
6504
|
const { current } = videoRef;
|
|
6796
6505
|
if (!current) {
|
|
6797
6506
|
return;
|
|
@@ -6822,7 +6531,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6822
6531
|
const currentOnDurationCallback = useRef17(onDuration);
|
|
6823
6532
|
currentOnDurationCallback.current = onDuration;
|
|
6824
6533
|
useEmitVideoFrame({ ref: videoRef, onVideoFrame });
|
|
6825
|
-
|
|
6534
|
+
useEffect17(() => {
|
|
6826
6535
|
const { current } = videoRef;
|
|
6827
6536
|
if (!current) {
|
|
6828
6537
|
return;
|
|
@@ -6839,7 +6548,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6839
6548
|
current.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
6840
6549
|
};
|
|
6841
6550
|
}, [src]);
|
|
6842
|
-
|
|
6551
|
+
useEffect17(() => {
|
|
6843
6552
|
const { current } = videoRef;
|
|
6844
6553
|
if (!current) {
|
|
6845
6554
|
return;
|
|
@@ -6861,7 +6570,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6861
6570
|
requestsVideoFrame: Boolean(onVideoFrame),
|
|
6862
6571
|
isClientSideRendering: false
|
|
6863
6572
|
});
|
|
6864
|
-
return /* @__PURE__ */
|
|
6573
|
+
return /* @__PURE__ */ jsx29("video", {
|
|
6865
6574
|
ref: videoRef,
|
|
6866
6575
|
muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
|
|
6867
6576
|
playsInline: true,
|
|
@@ -6876,7 +6585,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6876
6585
|
var VideoForPreview = forwardRef9(VideoForDevelopmentRefForwardingFunction);
|
|
6877
6586
|
|
|
6878
6587
|
// src/video/OffthreadVideo.tsx
|
|
6879
|
-
import { jsx as
|
|
6588
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6880
6589
|
var InnerOffthreadVideo = (props2) => {
|
|
6881
6590
|
const {
|
|
6882
6591
|
startFrom,
|
|
@@ -6893,7 +6602,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
6893
6602
|
if (environment.isClientSideRendering) {
|
|
6894
6603
|
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");
|
|
6895
6604
|
}
|
|
6896
|
-
const onDuration =
|
|
6605
|
+
const onDuration = useCallback15(() => {
|
|
6897
6606
|
return;
|
|
6898
6607
|
}, []);
|
|
6899
6608
|
if (typeof props2.src !== "string") {
|
|
@@ -6907,13 +6616,13 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
6907
6616
|
trimAfter
|
|
6908
6617
|
});
|
|
6909
6618
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
6910
|
-
return /* @__PURE__ */
|
|
6619
|
+
return /* @__PURE__ */ jsx30(Sequence, {
|
|
6911
6620
|
layout: "none",
|
|
6912
6621
|
from: 0 - (trimBeforeValue ?? 0),
|
|
6913
6622
|
showInTimeline: false,
|
|
6914
6623
|
durationInFrames: trimAfterValue,
|
|
6915
6624
|
name,
|
|
6916
|
-
children: /* @__PURE__ */
|
|
6625
|
+
children: /* @__PURE__ */ jsx30(InnerOffthreadVideo, {
|
|
6917
6626
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6918
6627
|
...otherProps,
|
|
6919
6628
|
trimAfter: undefined,
|
|
@@ -6928,7 +6637,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
6928
6637
|
}
|
|
6929
6638
|
validateMediaProps(props2, "Video");
|
|
6930
6639
|
if (environment.isRendering) {
|
|
6931
|
-
return /* @__PURE__ */
|
|
6640
|
+
return /* @__PURE__ */ jsx30(OffthreadVideoForRendering, {
|
|
6932
6641
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6933
6642
|
...otherProps,
|
|
6934
6643
|
trimAfter: undefined,
|
|
@@ -6950,7 +6659,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
6950
6659
|
delayRenderTimeoutInMilliseconds,
|
|
6951
6660
|
...propsForPreview
|
|
6952
6661
|
} = otherProps;
|
|
6953
|
-
return /* @__PURE__ */
|
|
6662
|
+
return /* @__PURE__ */ jsx30(VideoForPreview, {
|
|
6954
6663
|
_remotionInternalStack: stack ?? null,
|
|
6955
6664
|
onDuration,
|
|
6956
6665
|
onlyWarnForMediaSeekingError: true,
|
|
@@ -6999,7 +6708,7 @@ var OffthreadVideo = ({
|
|
|
6999
6708
|
if (imageFormat) {
|
|
7000
6709
|
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
7001
6710
|
}
|
|
7002
|
-
return /* @__PURE__ */
|
|
6711
|
+
return /* @__PURE__ */ jsx30(InnerOffthreadVideo, {
|
|
7003
6712
|
acceptableTimeShiftInSeconds,
|
|
7004
6713
|
allowAmplificationDuringRender: allowAmplificationDuringRender ?? true,
|
|
7005
6714
|
audioStreamIndex: audioStreamIndex ?? 0,
|
|
@@ -7073,7 +6782,7 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
7073
6782
|
|
|
7074
6783
|
// src/wrap-remotion-context.tsx
|
|
7075
6784
|
import React32, { useMemo as useMemo30 } from "react";
|
|
7076
|
-
import { jsx as
|
|
6785
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
7077
6786
|
function useRemotionContexts() {
|
|
7078
6787
|
const compositionManagerCtx = React32.useContext(CompositionManager);
|
|
7079
6788
|
const timelineContext = React32.useContext(TimelineContext);
|
|
@@ -7117,29 +6826,29 @@ function useRemotionContexts() {
|
|
|
7117
6826
|
}
|
|
7118
6827
|
var RemotionContextProvider = (props2) => {
|
|
7119
6828
|
const { children, contexts } = props2;
|
|
7120
|
-
return /* @__PURE__ */
|
|
6829
|
+
return /* @__PURE__ */ jsx31(LogLevelContext.Provider, {
|
|
7121
6830
|
value: contexts.logLevelContext,
|
|
7122
|
-
children: /* @__PURE__ */
|
|
6831
|
+
children: /* @__PURE__ */ jsx31(CanUseRemotionHooks.Provider, {
|
|
7123
6832
|
value: contexts.canUseRemotionHooksContext,
|
|
7124
|
-
children: /* @__PURE__ */
|
|
6833
|
+
children: /* @__PURE__ */ jsx31(NonceContext.Provider, {
|
|
7125
6834
|
value: contexts.nonceContext,
|
|
7126
|
-
children: /* @__PURE__ */
|
|
6835
|
+
children: /* @__PURE__ */ jsx31(PreloadContext.Provider, {
|
|
7127
6836
|
value: contexts.preloadContext,
|
|
7128
|
-
children: /* @__PURE__ */
|
|
6837
|
+
children: /* @__PURE__ */ jsx31(CompositionManager.Provider, {
|
|
7129
6838
|
value: contexts.compositionManagerCtx,
|
|
7130
|
-
children: /* @__PURE__ */
|
|
6839
|
+
children: /* @__PURE__ */ jsx31(SequenceManager.Provider, {
|
|
7131
6840
|
value: contexts.sequenceManagerContext,
|
|
7132
|
-
children: /* @__PURE__ */
|
|
6841
|
+
children: /* @__PURE__ */ jsx31(RenderAssetManager.Provider, {
|
|
7133
6842
|
value: contexts.renderAssetManagerContext,
|
|
7134
|
-
children: /* @__PURE__ */
|
|
6843
|
+
children: /* @__PURE__ */ jsx31(ResolveCompositionContext.Provider, {
|
|
7135
6844
|
value: contexts.resolveCompositionContext,
|
|
7136
|
-
children: /* @__PURE__ */
|
|
6845
|
+
children: /* @__PURE__ */ jsx31(TimelineContext.Provider, {
|
|
7137
6846
|
value: contexts.timelineContext,
|
|
7138
|
-
children: /* @__PURE__ */
|
|
6847
|
+
children: /* @__PURE__ */ jsx31(SetTimelineContext.Provider, {
|
|
7139
6848
|
value: contexts.setTimelineContext,
|
|
7140
|
-
children: /* @__PURE__ */
|
|
6849
|
+
children: /* @__PURE__ */ jsx31(SequenceContext.Provider, {
|
|
7141
6850
|
value: contexts.sequenceContext,
|
|
7142
|
-
children: /* @__PURE__ */
|
|
6851
|
+
children: /* @__PURE__ */ jsx31(BufferingContextReact.Provider, {
|
|
7143
6852
|
value: contexts.bufferManagerContext,
|
|
7144
6853
|
children
|
|
7145
6854
|
})
|
|
@@ -7211,11 +6920,11 @@ var Internals = {
|
|
|
7211
6920
|
EditorPropsContext,
|
|
7212
6921
|
usePreload,
|
|
7213
6922
|
NonceContext,
|
|
7214
|
-
SetNonceContext,
|
|
7215
6923
|
resolveVideoConfig,
|
|
6924
|
+
resolveVideoConfigOrCatch,
|
|
6925
|
+
ResolveCompositionContext,
|
|
7216
6926
|
useResolvedVideoConfig,
|
|
7217
6927
|
resolveCompositionsRef,
|
|
7218
|
-
ResolveCompositionConfigInStudio,
|
|
7219
6928
|
REMOTION_STUDIO_CONTAINER_ELEMENT,
|
|
7220
6929
|
RenderAssetManager,
|
|
7221
6930
|
persistCurrentFrame,
|
|
@@ -7636,16 +7345,16 @@ var flattenChildren = (children) => {
|
|
|
7636
7345
|
|
|
7637
7346
|
// src/series/is-inside-series.tsx
|
|
7638
7347
|
import React34, { createContext as createContext21 } from "react";
|
|
7639
|
-
import { jsx as
|
|
7348
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
7640
7349
|
var IsInsideSeriesContext = createContext21(false);
|
|
7641
7350
|
var IsInsideSeriesContainer = ({ children }) => {
|
|
7642
|
-
return /* @__PURE__ */
|
|
7351
|
+
return /* @__PURE__ */ jsx32(IsInsideSeriesContext.Provider, {
|
|
7643
7352
|
value: true,
|
|
7644
7353
|
children
|
|
7645
7354
|
});
|
|
7646
7355
|
};
|
|
7647
7356
|
var IsNotInsideSeriesProvider = ({ children }) => {
|
|
7648
|
-
return /* @__PURE__ */
|
|
7357
|
+
return /* @__PURE__ */ jsx32(IsInsideSeriesContext.Provider, {
|
|
7649
7358
|
value: false,
|
|
7650
7359
|
children
|
|
7651
7360
|
});
|
|
@@ -7658,10 +7367,10 @@ var useRequireToBeInsideSeries = () => {
|
|
|
7658
7367
|
};
|
|
7659
7368
|
|
|
7660
7369
|
// src/series/index.tsx
|
|
7661
|
-
import { jsx as
|
|
7370
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
7662
7371
|
var SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
|
|
7663
7372
|
useRequireToBeInsideSeries();
|
|
7664
|
-
return /* @__PURE__ */
|
|
7373
|
+
return /* @__PURE__ */ jsx33(IsNotInsideSeriesProvider, {
|
|
7665
7374
|
children
|
|
7666
7375
|
});
|
|
7667
7376
|
};
|
|
@@ -7711,7 +7420,7 @@ var Series = (props2) => {
|
|
|
7711
7420
|
}
|
|
7712
7421
|
const currentStartFrame = startFrame + offset;
|
|
7713
7422
|
startFrame += durationInFramesProp + offset;
|
|
7714
|
-
return /* @__PURE__ */
|
|
7423
|
+
return /* @__PURE__ */ jsx33(Sequence, {
|
|
7715
7424
|
name: name || "<Series.Sequence>",
|
|
7716
7425
|
from: currentStartFrame,
|
|
7717
7426
|
durationInFrames: durationInFramesProp,
|
|
@@ -7722,14 +7431,14 @@ var Series = (props2) => {
|
|
|
7722
7431
|
});
|
|
7723
7432
|
}, [props2.children]);
|
|
7724
7433
|
if (ENABLE_V5_BREAKING_CHANGES) {
|
|
7725
|
-
return /* @__PURE__ */
|
|
7726
|
-
children: /* @__PURE__ */
|
|
7434
|
+
return /* @__PURE__ */ jsx33(IsInsideSeriesContainer, {
|
|
7435
|
+
children: /* @__PURE__ */ jsx33(Sequence, {
|
|
7727
7436
|
...props2,
|
|
7728
7437
|
children: childrenValue
|
|
7729
7438
|
})
|
|
7730
7439
|
});
|
|
7731
7440
|
}
|
|
7732
|
-
return /* @__PURE__ */
|
|
7441
|
+
return /* @__PURE__ */ jsx33(IsInsideSeriesContainer, {
|
|
7733
7442
|
children: childrenValue
|
|
7734
7443
|
});
|
|
7735
7444
|
};
|
|
@@ -8076,14 +7785,14 @@ var Still = (props2) => {
|
|
|
8076
7785
|
return React36.createElement(Composition, newProps);
|
|
8077
7786
|
};
|
|
8078
7787
|
// src/video/Video.tsx
|
|
8079
|
-
import { forwardRef as forwardRef12, useCallback as
|
|
7788
|
+
import { forwardRef as forwardRef12, useCallback as useCallback16, useContext as useContext35 } from "react";
|
|
8080
7789
|
|
|
8081
7790
|
// src/video/VideoForRendering.tsx
|
|
8082
7791
|
import {
|
|
8083
7792
|
forwardRef as forwardRef11,
|
|
8084
7793
|
useContext as useContext34,
|
|
8085
|
-
useEffect as
|
|
8086
|
-
useImperativeHandle as
|
|
7794
|
+
useEffect as useEffect18,
|
|
7795
|
+
useImperativeHandle as useImperativeHandle10,
|
|
8087
7796
|
useLayoutEffect as useLayoutEffect11,
|
|
8088
7797
|
useMemo as useMemo32,
|
|
8089
7798
|
useRef as useRef18
|
|
@@ -8214,7 +7923,7 @@ var seekToTimeMultipleUntilRight = ({
|
|
|
8214
7923
|
};
|
|
8215
7924
|
|
|
8216
7925
|
// src/video/VideoForRendering.tsx
|
|
8217
|
-
import { jsx as
|
|
7926
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
8218
7927
|
var VideoForRenderingForwardFunction = ({
|
|
8219
7928
|
onError,
|
|
8220
7929
|
volume: volumeProp,
|
|
@@ -8258,7 +7967,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8258
7967
|
mediaVolume: 1
|
|
8259
7968
|
});
|
|
8260
7969
|
warnAboutTooHighVolume(volume);
|
|
8261
|
-
|
|
7970
|
+
useEffect18(() => {
|
|
8262
7971
|
if (!props2.src) {
|
|
8263
7972
|
throw new Error("No src passed");
|
|
8264
7973
|
}
|
|
@@ -8298,10 +8007,10 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8298
8007
|
sequenceContext?.relativeFrom,
|
|
8299
8008
|
audioStreamIndex
|
|
8300
8009
|
]);
|
|
8301
|
-
|
|
8010
|
+
useImperativeHandle10(ref, () => {
|
|
8302
8011
|
return videoRef.current;
|
|
8303
8012
|
}, []);
|
|
8304
|
-
|
|
8013
|
+
useEffect18(() => {
|
|
8305
8014
|
if (!window.remotion_videoEnabled) {
|
|
8306
8015
|
return;
|
|
8307
8016
|
}
|
|
@@ -8419,7 +8128,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8419
8128
|
delayRender2
|
|
8420
8129
|
]);
|
|
8421
8130
|
}
|
|
8422
|
-
return /* @__PURE__ */
|
|
8131
|
+
return /* @__PURE__ */ jsx34("video", {
|
|
8423
8132
|
ref: videoRef,
|
|
8424
8133
|
disableRemotePlayback: true,
|
|
8425
8134
|
...props2
|
|
@@ -8428,7 +8137,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
8428
8137
|
var VideoForRendering = forwardRef11(VideoForRenderingForwardFunction);
|
|
8429
8138
|
|
|
8430
8139
|
// src/video/Video.tsx
|
|
8431
|
-
import { jsx as
|
|
8140
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
8432
8141
|
var VideoForwardingFunction = (props2, ref) => {
|
|
8433
8142
|
const {
|
|
8434
8143
|
startFrom,
|
|
@@ -8457,10 +8166,10 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8457
8166
|
throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props2.src)} instead.`);
|
|
8458
8167
|
}
|
|
8459
8168
|
const preloadedSrc = usePreload(props2.src);
|
|
8460
|
-
const onDuration =
|
|
8169
|
+
const onDuration = useCallback16((src, durationInSeconds) => {
|
|
8461
8170
|
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
8462
8171
|
}, [setDurations]);
|
|
8463
|
-
const onVideoFrame =
|
|
8172
|
+
const onVideoFrame = useCallback16(() => {}, []);
|
|
8464
8173
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props2.src)];
|
|
8465
8174
|
validateMediaTrimProps({ startFrom, endAt, trimBefore, trimAfter });
|
|
8466
8175
|
const { trimBeforeValue, trimAfterValue } = resolveTrimProps({
|
|
@@ -8471,14 +8180,14 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8471
8180
|
});
|
|
8472
8181
|
if (loop && durationFetched !== undefined) {
|
|
8473
8182
|
if (!Number.isFinite(durationFetched)) {
|
|
8474
|
-
return /* @__PURE__ */
|
|
8183
|
+
return /* @__PURE__ */ jsx35(Html5Video, {
|
|
8475
8184
|
...propsOtherThanLoop,
|
|
8476
8185
|
ref,
|
|
8477
8186
|
_remotionInternalNativeLoopPassed: true
|
|
8478
8187
|
});
|
|
8479
8188
|
}
|
|
8480
8189
|
const mediaDuration = durationFetched * fps;
|
|
8481
|
-
return /* @__PURE__ */
|
|
8190
|
+
return /* @__PURE__ */ jsx35(Loop, {
|
|
8482
8191
|
durationInFrames: calculateMediaDuration({
|
|
8483
8192
|
trimAfter: trimAfterValue,
|
|
8484
8193
|
mediaDurationInFrames: mediaDuration,
|
|
@@ -8487,7 +8196,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8487
8196
|
}),
|
|
8488
8197
|
layout: "none",
|
|
8489
8198
|
name,
|
|
8490
|
-
children: /* @__PURE__ */
|
|
8199
|
+
children: /* @__PURE__ */ jsx35(Html5Video, {
|
|
8491
8200
|
...propsOtherThanLoop,
|
|
8492
8201
|
ref,
|
|
8493
8202
|
_remotionInternalNativeLoopPassed: true
|
|
@@ -8495,13 +8204,13 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8495
8204
|
});
|
|
8496
8205
|
}
|
|
8497
8206
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
8498
|
-
return /* @__PURE__ */
|
|
8207
|
+
return /* @__PURE__ */ jsx35(Sequence, {
|
|
8499
8208
|
layout: "none",
|
|
8500
8209
|
from: 0 - (trimBeforeValue ?? 0),
|
|
8501
8210
|
showInTimeline: false,
|
|
8502
8211
|
durationInFrames: trimAfterValue,
|
|
8503
8212
|
name,
|
|
8504
|
-
children: /* @__PURE__ */
|
|
8213
|
+
children: /* @__PURE__ */ jsx35(Html5Video, {
|
|
8505
8214
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
8506
8215
|
...otherProps,
|
|
8507
8216
|
ref
|
|
@@ -8510,14 +8219,14 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8510
8219
|
}
|
|
8511
8220
|
validateMediaProps({ playbackRate: props2.playbackRate, volume: props2.volume }, "Html5Video");
|
|
8512
8221
|
if (environment.isRendering) {
|
|
8513
|
-
return /* @__PURE__ */
|
|
8222
|
+
return /* @__PURE__ */ jsx35(VideoForRendering, {
|
|
8514
8223
|
onDuration,
|
|
8515
8224
|
onVideoFrame: onVideoFrame ?? null,
|
|
8516
8225
|
...otherProps,
|
|
8517
8226
|
ref
|
|
8518
8227
|
});
|
|
8519
8228
|
}
|
|
8520
|
-
return /* @__PURE__ */
|
|
8229
|
+
return /* @__PURE__ */ jsx35(VideoForPreview, {
|
|
8521
8230
|
onlyWarnForMediaSeekingError: false,
|
|
8522
8231
|
...otherProps,
|
|
8523
8232
|
ref,
|