remotion 4.0.61 → 4.0.63
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/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +145 -225
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.63";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function truthy(value) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Automatically generated on publish
|
|
62
|
-
const VERSION = '4.0.
|
|
62
|
+
const VERSION = '4.0.63';
|
|
63
63
|
|
|
64
64
|
const checkMultipleRemotionVersions = () => {
|
|
65
65
|
if (typeof globalThis === 'undefined') {
|
|
@@ -318,11 +318,11 @@ const CompositionManager = createContext({
|
|
|
318
318
|
unregisterComposition: () => undefined,
|
|
319
319
|
registerFolder: () => undefined,
|
|
320
320
|
unregisterFolder: () => undefined,
|
|
321
|
+
currentComposition: null,
|
|
322
|
+
setCurrentComposition: () => undefined,
|
|
321
323
|
setCurrentCompositionMetadata: () => undefined,
|
|
322
324
|
folders: [],
|
|
323
325
|
currentCompositionMetadata: null,
|
|
324
|
-
canvasContent: null,
|
|
325
|
-
setCanvasContent: () => undefined,
|
|
326
326
|
});
|
|
327
327
|
|
|
328
328
|
const problematicCharacters = {
|
|
@@ -515,31 +515,6 @@ const EditorPropsProvider = ({ children }) => {
|
|
|
515
515
|
return (jsx(EditorPropsContext.Provider, { value: ctx, children: children }));
|
|
516
516
|
};
|
|
517
517
|
|
|
518
|
-
const validCodecs = [
|
|
519
|
-
'h264',
|
|
520
|
-
'h265',
|
|
521
|
-
'vp8',
|
|
522
|
-
'vp9',
|
|
523
|
-
'mp3',
|
|
524
|
-
'aac',
|
|
525
|
-
'wav',
|
|
526
|
-
'prores',
|
|
527
|
-
'h264-mkv',
|
|
528
|
-
'gif',
|
|
529
|
-
];
|
|
530
|
-
|
|
531
|
-
function validateDefaultCodec(defaultCodec, location) {
|
|
532
|
-
if (typeof defaultCodec === 'undefined') {
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
if (typeof defaultCodec !== 'string') {
|
|
536
|
-
throw new TypeError(`The "defaultCodec" prop ${location} must be a string, but you passed a value of type ${typeof defaultCodec}.`);
|
|
537
|
-
}
|
|
538
|
-
if (!validCodecs.includes(defaultCodec)) {
|
|
539
|
-
throw new Error(`The "defaultCodec" prop ${location} must be one of ${validCodecs.join(', ')}, but you passed ${defaultCodec}.`);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
|
|
543
518
|
function validateDimension(amount, nameOfProp, location) {
|
|
544
519
|
if (typeof amount !== 'number') {
|
|
545
520
|
throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
|
|
@@ -595,25 +570,6 @@ function validateFps(fps, location, isGif) {
|
|
|
595
570
|
}
|
|
596
571
|
}
|
|
597
572
|
|
|
598
|
-
const validateCalculated = ({ composition, calculated, }) => {
|
|
599
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
600
|
-
const calculateMetadataErrorLocation = `calculated by calculateMetadata() for the composition "${composition.id}"`;
|
|
601
|
-
const defaultErrorLocation = `of the "<Composition />" component with the id "${composition.id}"`;
|
|
602
|
-
const width = (_b = (_a = calculated === null || calculated === void 0 ? void 0 : calculated.width) !== null && _a !== void 0 ? _a : composition.width) !== null && _b !== void 0 ? _b : undefined;
|
|
603
|
-
validateDimension(width, 'width', (calculated === null || calculated === void 0 ? void 0 : calculated.width) ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
604
|
-
const height = (_d = (_c = calculated === null || calculated === void 0 ? void 0 : calculated.height) !== null && _c !== void 0 ? _c : composition.height) !== null && _d !== void 0 ? _d : undefined;
|
|
605
|
-
validateDimension(height, 'height', (calculated === null || calculated === void 0 ? void 0 : calculated.height) ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
606
|
-
const fps = (_f = (_e = calculated === null || calculated === void 0 ? void 0 : calculated.fps) !== null && _e !== void 0 ? _e : composition.fps) !== null && _f !== void 0 ? _f : null;
|
|
607
|
-
validateFps(fps, (calculated === null || calculated === void 0 ? void 0 : calculated.fps) ? calculateMetadataErrorLocation : defaultErrorLocation, false);
|
|
608
|
-
const durationInFrames = (_h = (_g = calculated === null || calculated === void 0 ? void 0 : calculated.durationInFrames) !== null && _g !== void 0 ? _g : composition.durationInFrames) !== null && _h !== void 0 ? _h : null;
|
|
609
|
-
validateDurationInFrames(durationInFrames, {
|
|
610
|
-
allowFloats: false,
|
|
611
|
-
component: `of the "<Composition />" component with the id "${composition.id}"`,
|
|
612
|
-
});
|
|
613
|
-
const defaultCodec = calculated === null || calculated === void 0 ? void 0 : calculated.defaultCodec;
|
|
614
|
-
validateDefaultCodec(defaultCodec, calculateMetadataErrorLocation);
|
|
615
|
-
return { width, height, fps, durationInFrames, defaultCodec };
|
|
616
|
-
};
|
|
617
573
|
const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, inputProps, }) => {
|
|
618
574
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
619
575
|
const calculatedProm = composition.calculateMetadata
|
|
@@ -636,7 +592,7 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
|
|
|
636
592
|
'then' in calculatedProm) {
|
|
637
593
|
return calculatedProm.then((c) => {
|
|
638
594
|
var _a, _b;
|
|
639
|
-
const { height, width, durationInFrames, fps
|
|
595
|
+
const { height, width, durationInFrames, fps } = validateCalculated({
|
|
640
596
|
calculated: c,
|
|
641
597
|
composition,
|
|
642
598
|
});
|
|
@@ -648,7 +604,6 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
|
|
|
648
604
|
id: composition.id,
|
|
649
605
|
defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
|
|
650
606
|
props: (_b = c.props) !== null && _b !== void 0 ? _b : fallbackProps,
|
|
651
|
-
defaultCodec: defaultCodec !== null && defaultCodec !== void 0 ? defaultCodec : null,
|
|
652
607
|
};
|
|
653
608
|
});
|
|
654
609
|
}
|
|
@@ -662,29 +617,39 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
|
|
|
662
617
|
id: composition.id,
|
|
663
618
|
defaultProps: (_d = composition.defaultProps) !== null && _d !== void 0 ? _d : {},
|
|
664
619
|
props: fallbackProps,
|
|
665
|
-
defaultCodec: null,
|
|
666
620
|
};
|
|
667
621
|
}
|
|
668
622
|
return {
|
|
669
623
|
...data,
|
|
670
624
|
id: composition.id,
|
|
671
625
|
defaultProps: (_e = composition.defaultProps) !== null && _e !== void 0 ? _e : {},
|
|
672
|
-
props: (_f = calculatedProm.props) !== null && _f !== void 0 ? _f :
|
|
673
|
-
defaultCodec: (_g = calculatedProm.defaultCodec) !== null && _g !== void 0 ? _g : null,
|
|
626
|
+
props: (_g = (_f = calculatedProm.props) !== null && _f !== void 0 ? _f : composition.defaultProps) !== null && _g !== void 0 ? _g : {},
|
|
674
627
|
};
|
|
675
628
|
};
|
|
629
|
+
const validateCalculated = ({ composition, calculated, }) => {
|
|
630
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
631
|
+
const calculateMetadataErrorLocation = `calculated by calculateMetadata() for the composition "${composition.id}"`;
|
|
632
|
+
const defaultErrorLocation = `of the "<Composition />" component with the id "${composition.id}"`;
|
|
633
|
+
const width = (_b = (_a = calculated === null || calculated === void 0 ? void 0 : calculated.width) !== null && _a !== void 0 ? _a : composition.width) !== null && _b !== void 0 ? _b : undefined;
|
|
634
|
+
validateDimension(width, 'width', (calculated === null || calculated === void 0 ? void 0 : calculated.width) ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
635
|
+
const height = (_d = (_c = calculated === null || calculated === void 0 ? void 0 : calculated.height) !== null && _c !== void 0 ? _c : composition.height) !== null && _d !== void 0 ? _d : undefined;
|
|
636
|
+
validateDimension(height, 'height', (calculated === null || calculated === void 0 ? void 0 : calculated.height) ? calculateMetadataErrorLocation : defaultErrorLocation);
|
|
637
|
+
const fps = (_f = (_e = calculated === null || calculated === void 0 ? void 0 : calculated.fps) !== null && _e !== void 0 ? _e : composition.fps) !== null && _f !== void 0 ? _f : null;
|
|
638
|
+
validateFps(fps, (calculated === null || calculated === void 0 ? void 0 : calculated.fps) ? calculateMetadataErrorLocation : defaultErrorLocation, false);
|
|
639
|
+
const durationInFrames = (_h = (_g = calculated === null || calculated === void 0 ? void 0 : calculated.durationInFrames) !== null && _g !== void 0 ? _g : composition.durationInFrames) !== null && _h !== void 0 ? _h : null;
|
|
640
|
+
validateDurationInFrames(durationInFrames, {
|
|
641
|
+
allowFloats: false,
|
|
642
|
+
component: `of the "<Composition />" component with the id "${composition.id}"`,
|
|
643
|
+
});
|
|
644
|
+
return { width, height, fps, durationInFrames };
|
|
645
|
+
};
|
|
676
646
|
|
|
677
647
|
const ResolveCompositionContext = createContext(null);
|
|
678
648
|
const resolveCompositionsRef = createRef();
|
|
679
|
-
const needsResolution = (composition) => {
|
|
680
|
-
return Boolean(composition.calculateMetadata);
|
|
681
|
-
};
|
|
682
649
|
const ResolveCompositionConfig = ({ children }) => {
|
|
683
650
|
const [currentRenderModalComposition, setCurrentRenderModalComposition] = useState(null);
|
|
684
|
-
const { compositions,
|
|
685
|
-
const selectedComposition = compositions.find((c) =>
|
|
686
|
-
canvasContent.type === 'composition' &&
|
|
687
|
-
canvasContent.compositionId === c.id);
|
|
651
|
+
const { compositions, currentComposition, currentCompositionMetadata } = useContext(CompositionManager);
|
|
652
|
+
const selectedComposition = compositions.find((c) => c.id === currentComposition);
|
|
688
653
|
const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
|
|
689
654
|
const { props: allEditorProps } = useContext(EditorPropsContext);
|
|
690
655
|
const [resolvedConfigs, setResolvedConfigs] = useState({});
|
|
@@ -760,7 +725,6 @@ const ResolveCompositionConfig = ({ children }) => {
|
|
|
760
725
|
}
|
|
761
726
|
return controller;
|
|
762
727
|
}, [currentCompositionMetadata]);
|
|
763
|
-
const currentComposition = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ? canvasContent.compositionId : null;
|
|
764
728
|
useImperativeHandle(resolveCompositionsRef, () => {
|
|
765
729
|
return {
|
|
766
730
|
setCurrentRenderModalComposition: (id) => {
|
|
@@ -817,11 +781,13 @@ const ResolveCompositionConfig = ({ children }) => {
|
|
|
817
781
|
}, [compositions, resolvedConfigs]);
|
|
818
782
|
return (jsx(ResolveCompositionContext.Provider, { value: resolvedConfigsIncludingStaticOnes, children: children }));
|
|
819
783
|
};
|
|
784
|
+
const needsResolution = (composition) => {
|
|
785
|
+
return Boolean(composition.calculateMetadata);
|
|
786
|
+
};
|
|
820
787
|
const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
821
788
|
const context = useContext(ResolveCompositionContext);
|
|
822
789
|
const { props: allEditorProps } = useContext(EditorPropsContext);
|
|
823
|
-
const { compositions,
|
|
824
|
-
const currentComposition = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ? canvasContent.compositionId : null;
|
|
790
|
+
const { compositions, currentComposition, currentCompositionMetadata } = useContext(CompositionManager);
|
|
825
791
|
const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
|
|
826
792
|
const composition = compositions.find((c) => c.id === compositionId);
|
|
827
793
|
const selectedEditorProps = useMemo(() => {
|
|
@@ -841,7 +807,6 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
|
841
807
|
id: composition.id,
|
|
842
808
|
props: currentCompositionMetadata.props,
|
|
843
809
|
defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
|
|
844
|
-
defaultCodec: currentCompositionMetadata.defaultCodec,
|
|
845
810
|
},
|
|
846
811
|
};
|
|
847
812
|
}
|
|
@@ -863,7 +828,6 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
|
863
828
|
? {}
|
|
864
829
|
: (_d = getInputProps()) !== null && _d !== void 0 ? _d : {}),
|
|
865
830
|
},
|
|
866
|
-
defaultCodec: null,
|
|
867
831
|
},
|
|
868
832
|
};
|
|
869
833
|
}
|
|
@@ -875,15 +839,13 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
|
875
839
|
};
|
|
876
840
|
|
|
877
841
|
const useVideo = () => {
|
|
878
|
-
|
|
879
|
-
const
|
|
880
|
-
|
|
881
|
-
return ((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' &&
|
|
882
|
-
c.id === canvasContent.compositionId);
|
|
842
|
+
const context = useContext(CompositionManager);
|
|
843
|
+
const selected = context.compositions.find((c) => {
|
|
844
|
+
return c.id === context.currentComposition;
|
|
883
845
|
});
|
|
884
|
-
const resolved = useResolvedVideoConfig(
|
|
846
|
+
const resolved = useResolvedVideoConfig(context.currentComposition);
|
|
885
847
|
return useMemo(() => {
|
|
886
|
-
var _a;
|
|
848
|
+
var _a, _b;
|
|
887
849
|
if (!resolved) {
|
|
888
850
|
return null;
|
|
889
851
|
}
|
|
@@ -902,10 +864,10 @@ const useVideo = () => {
|
|
|
902
864
|
id: selected.id,
|
|
903
865
|
// We override the selected metadata with the metadata that was passed to renderMedia(),
|
|
904
866
|
// and don't allow it to be changed during render anymore
|
|
905
|
-
...(currentCompositionMetadata !== null &&
|
|
867
|
+
...((_b = context.currentCompositionMetadata) !== null && _b !== void 0 ? _b : {}),
|
|
906
868
|
component: selected.component,
|
|
907
869
|
};
|
|
908
|
-
}, [currentCompositionMetadata, resolved, selected]);
|
|
870
|
+
}, [context.currentCompositionMetadata, resolved, selected]);
|
|
909
871
|
};
|
|
910
872
|
|
|
911
873
|
const TimelineContext = createContext({
|
|
@@ -991,7 +953,7 @@ const useUnsafeVideoConfig = () => {
|
|
|
991
953
|
if (!video) {
|
|
992
954
|
return null;
|
|
993
955
|
}
|
|
994
|
-
const { id, durationInFrames, fps, height, width, defaultProps, props
|
|
956
|
+
const { id, durationInFrames, fps, height, width, defaultProps, props } = video;
|
|
995
957
|
return {
|
|
996
958
|
id,
|
|
997
959
|
width,
|
|
@@ -1000,7 +962,6 @@ const useUnsafeVideoConfig = () => {
|
|
|
1000
962
|
durationInFrames: ctxDuration !== null && ctxDuration !== void 0 ? ctxDuration : durationInFrames,
|
|
1001
963
|
defaultProps,
|
|
1002
964
|
props,
|
|
1003
|
-
defaultCodec,
|
|
1004
965
|
};
|
|
1005
966
|
}, [ctxDuration, video]);
|
|
1006
967
|
};
|
|
@@ -1121,9 +1082,7 @@ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity,
|
|
|
1121
1082
|
nonce,
|
|
1122
1083
|
loopDisplay,
|
|
1123
1084
|
]);
|
|
1124
|
-
|
|
1125
|
-
// https://github.com/remotion-dev/remotion/issues/2958
|
|
1126
|
-
const endThreshold = Math.ceil(cumulatedFrom + from + durationInFrames - 1);
|
|
1085
|
+
const endThreshold = cumulatedFrom + from + durationInFrames - 1;
|
|
1127
1086
|
const content = absoluteFrame < cumulatedFrom + from
|
|
1128
1087
|
? null
|
|
1129
1088
|
: absoluteFrame > endThreshold
|
|
@@ -1143,7 +1102,7 @@ const SequenceRefForwardingFunction = ({ from = 0, durationInFrames = Infinity,
|
|
|
1143
1102
|
};
|
|
1144
1103
|
/**
|
|
1145
1104
|
* @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
|
|
1146
|
-
* @see [Documentation](https://www.remotion.dev/docs/sequence
|
|
1105
|
+
* @see [Documentation](https://www.remotion.dev/docs/sequence]
|
|
1147
1106
|
*/
|
|
1148
1107
|
const Sequence = forwardRef(SequenceRefForwardingFunction);
|
|
1149
1108
|
|
|
@@ -1359,18 +1318,10 @@ const prefetch = (src, options) => {
|
|
|
1359
1318
|
if (!buf) {
|
|
1360
1319
|
return;
|
|
1361
1320
|
}
|
|
1362
|
-
if (!buf.type.startsWith('video/') &&
|
|
1363
|
-
!buf.type.startsWith('audio/') &&
|
|
1364
|
-
!(options === null || options === void 0 ? void 0 : options.contentType)) {
|
|
1365
|
-
console.warn(`Called prefetch() on ${src} which returned a "Content-Type" of ${buf.type}. Prefetched content should have a proper content type (video/... or audio/...) or a contentType passed the options of prefetch(). Otherwise, prefetching will not work properly in all browsers.`);
|
|
1366
|
-
}
|
|
1367
|
-
const actualBlob = (options === null || options === void 0 ? void 0 : options.contentType)
|
|
1368
|
-
? new Blob([buf], { type: options.contentType })
|
|
1369
|
-
: buf;
|
|
1370
1321
|
if (method === 'base64') {
|
|
1371
|
-
return blobToBase64(
|
|
1322
|
+
return blobToBase64(buf);
|
|
1372
1323
|
}
|
|
1373
|
-
return URL.createObjectURL(
|
|
1324
|
+
return URL.createObjectURL(buf);
|
|
1374
1325
|
})
|
|
1375
1326
|
.then((url) => {
|
|
1376
1327
|
if (canceled) {
|
|
@@ -1798,6 +1749,33 @@ const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, })
|
|
|
1798
1749
|
const toSeconds = (time, fps) => {
|
|
1799
1750
|
return Math.round((time / fps) * 100) / 100;
|
|
1800
1751
|
};
|
|
1752
|
+
const isSubsetOfDuration = (prevStartFrom, newStartFrom, prevDuration, newDuration) => {
|
|
1753
|
+
return (prevStartFrom <= newStartFrom &&
|
|
1754
|
+
prevStartFrom + prevDuration >= newStartFrom + newDuration);
|
|
1755
|
+
};
|
|
1756
|
+
const useAppendVideoFragment = ({ actualSrc: initialActualSrc, actualFrom: initialActualFrom, duration: initialDuration, fps, }) => {
|
|
1757
|
+
const actualFromRef = useRef(initialActualFrom);
|
|
1758
|
+
const actualDuration = useRef(initialDuration);
|
|
1759
|
+
const actualSrc = useRef(initialActualSrc);
|
|
1760
|
+
if (!isSubsetOfDuration || initialActualSrc !== actualSrc.current) {
|
|
1761
|
+
actualFromRef.current = initialActualFrom;
|
|
1762
|
+
actualDuration.current = initialDuration;
|
|
1763
|
+
actualSrc.current = initialActualSrc;
|
|
1764
|
+
}
|
|
1765
|
+
const appended = appendVideoFragment({
|
|
1766
|
+
actualSrc: actualSrc.current,
|
|
1767
|
+
actualFrom: actualFromRef.current,
|
|
1768
|
+
duration: actualDuration.current,
|
|
1769
|
+
fps,
|
|
1770
|
+
});
|
|
1771
|
+
return appended;
|
|
1772
|
+
};
|
|
1773
|
+
const isIosSafari = () => {
|
|
1774
|
+
return typeof window === 'undefined'
|
|
1775
|
+
? false
|
|
1776
|
+
: /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
|
|
1777
|
+
Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/));
|
|
1778
|
+
};
|
|
1801
1779
|
// https://github.com/remotion-dev/remotion/issues/1655
|
|
1802
1780
|
const isIOSSafariCase = (actualSrc) => {
|
|
1803
1781
|
return typeof window === 'undefined'
|
|
@@ -1828,33 +1806,6 @@ const appendVideoFragment = ({ actualSrc, actualFrom, duration, fps, }) => {
|
|
|
1828
1806
|
actualSrc += `,${toSeconds(duration, fps)}`;
|
|
1829
1807
|
return actualSrc;
|
|
1830
1808
|
};
|
|
1831
|
-
const isSubsetOfDuration = (prevStartFrom, newStartFrom, prevDuration, newDuration) => {
|
|
1832
|
-
return (prevStartFrom <= newStartFrom &&
|
|
1833
|
-
prevStartFrom + prevDuration >= newStartFrom + newDuration);
|
|
1834
|
-
};
|
|
1835
|
-
const useAppendVideoFragment = ({ actualSrc: initialActualSrc, actualFrom: initialActualFrom, duration: initialDuration, fps, }) => {
|
|
1836
|
-
const actualFromRef = useRef(initialActualFrom);
|
|
1837
|
-
const actualDuration = useRef(initialDuration);
|
|
1838
|
-
const actualSrc = useRef(initialActualSrc);
|
|
1839
|
-
if (!isSubsetOfDuration || initialActualSrc !== actualSrc.current) {
|
|
1840
|
-
actualFromRef.current = initialActualFrom;
|
|
1841
|
-
actualDuration.current = initialDuration;
|
|
1842
|
-
actualSrc.current = initialActualSrc;
|
|
1843
|
-
}
|
|
1844
|
-
const appended = appendVideoFragment({
|
|
1845
|
-
actualSrc: actualSrc.current,
|
|
1846
|
-
actualFrom: actualFromRef.current,
|
|
1847
|
-
duration: actualDuration.current,
|
|
1848
|
-
fps,
|
|
1849
|
-
});
|
|
1850
|
-
return appended;
|
|
1851
|
-
};
|
|
1852
|
-
const isIosSafari = () => {
|
|
1853
|
-
return typeof window === 'undefined'
|
|
1854
|
-
? false
|
|
1855
|
-
: /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
|
|
1856
|
-
Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/));
|
|
1857
|
-
};
|
|
1858
1809
|
|
|
1859
1810
|
const alreadyWarned = {};
|
|
1860
1811
|
const warnAboutNonSeekableMedia = (ref, type) => {
|
|
@@ -2438,7 +2389,6 @@ const continueRender = (handle) => {
|
|
|
2438
2389
|
};
|
|
2439
2390
|
|
|
2440
2391
|
const RenderAssetManager = createContext({
|
|
2441
|
-
// Must be undefined, otherwise error in Player
|
|
2442
2392
|
registerRenderAsset: () => undefined,
|
|
2443
2393
|
unregisterRenderAsset: () => undefined,
|
|
2444
2394
|
renderAssets: [],
|
|
@@ -2486,7 +2436,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
2486
2436
|
var _a;
|
|
2487
2437
|
return `audio-${random((_a = props.src) !== null && _a !== void 0 ? _a : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}`;
|
|
2488
2438
|
}, [props.src, sequenceContext]);
|
|
2489
|
-
const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration,
|
|
2439
|
+
const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, _remotionInternalNeedsDurationCalculation, acceptableTimeShiftInSeconds, ...nativeProps } = props;
|
|
2490
2440
|
const volume = evaluateVolume({
|
|
2491
2441
|
volume: volumeProp,
|
|
2492
2442
|
frame: volumePropFrame,
|
|
@@ -2519,7 +2469,6 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
2519
2469
|
mediaFrame: frame,
|
|
2520
2470
|
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
2521
2471
|
allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
|
|
2522
|
-
toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : null,
|
|
2523
2472
|
});
|
|
2524
2473
|
return () => unregisterRenderAsset(id);
|
|
2525
2474
|
}, [
|
|
@@ -2535,7 +2484,6 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
2535
2484
|
playbackRate,
|
|
2536
2485
|
props.playbackRate,
|
|
2537
2486
|
allowAmplificationDuringRender,
|
|
2538
|
-
toneFrequency,
|
|
2539
2487
|
]);
|
|
2540
2488
|
const { src } = props;
|
|
2541
2489
|
// The <audio> tag is only rendered if the duration needs to be calculated for the `loop`
|
|
@@ -2630,8 +2578,6 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
2630
2578
|
*/
|
|
2631
2579
|
const Audio = forwardRef(AudioRefForwardingFunction);
|
|
2632
2580
|
|
|
2633
|
-
const getRegex$1 = () => /^([a-zA-Z0-9-])+$/g;
|
|
2634
|
-
const isFolderNameValid = (name) => name.match(getRegex$1());
|
|
2635
2581
|
const validateFolderName = (name) => {
|
|
2636
2582
|
if (name === undefined || name === null) {
|
|
2637
2583
|
throw new TypeError('You must pass a name to a <Folder />.');
|
|
@@ -2643,6 +2589,8 @@ const validateFolderName = (name) => {
|
|
|
2643
2589
|
throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${name}`);
|
|
2644
2590
|
}
|
|
2645
2591
|
};
|
|
2592
|
+
const getRegex$1 = () => /^([a-zA-Z0-9-])+$/g;
|
|
2593
|
+
const isFolderNameValid = (name) => name.match(getRegex$1());
|
|
2646
2594
|
|
|
2647
2595
|
const FolderContext = createContext({
|
|
2648
2596
|
folderName: null,
|
|
@@ -2745,13 +2693,13 @@ const useLazyComponent = (compProps) => {
|
|
|
2745
2693
|
return lazy;
|
|
2746
2694
|
};
|
|
2747
2695
|
|
|
2748
|
-
const getRegex = () => /^([a-zA-Z0-9-])+$/g;
|
|
2749
|
-
const isCompositionIdValid = (id) => id.match(getRegex());
|
|
2750
2696
|
const validateCompositionId = (id) => {
|
|
2751
2697
|
if (!isCompositionIdValid(id)) {
|
|
2752
2698
|
throw new Error(`Composition id can only contain a-z, A-Z, 0-9 and -. You passed ${id}`);
|
|
2753
2699
|
}
|
|
2754
2700
|
};
|
|
2701
|
+
const getRegex = () => /^([a-zA-Z0-9-])+$/g;
|
|
2702
|
+
const isCompositionIdValid = (id) => id.match(getRegex());
|
|
2755
2703
|
const invalidCompositionErrorMessage = `Composition ID must match ${String(getRegex())}`;
|
|
2756
2704
|
|
|
2757
2705
|
const validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
@@ -2766,20 +2714,6 @@ const validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
|
2766
2714
|
}
|
|
2767
2715
|
};
|
|
2768
2716
|
|
|
2769
|
-
const ClipComposition = ({ children }) => {
|
|
2770
|
-
const { clipRegion } = useContext(NativeLayersContext);
|
|
2771
|
-
const style = useMemo(() => {
|
|
2772
|
-
return {
|
|
2773
|
-
display: 'flex',
|
|
2774
|
-
flexDirection: 'row',
|
|
2775
|
-
opacity: clipRegion === 'hide' ? 0 : 1,
|
|
2776
|
-
clipPath: clipRegion && clipRegion !== 'hide'
|
|
2777
|
-
? `polygon(${clipRegion.x}px ${clipRegion.y}px, ${clipRegion.x}px ${clipRegion.height + clipRegion.y}px, ${clipRegion.width + clipRegion.x}px ${clipRegion.height + clipRegion.y}px, ${clipRegion.width + clipRegion.x}px ${clipRegion.y}px)`
|
|
2778
|
-
: undefined,
|
|
2779
|
-
};
|
|
2780
|
-
}, [clipRegion]);
|
|
2781
|
-
return jsx(AbsoluteFill, { style: style, children: children });
|
|
2782
|
-
};
|
|
2783
2717
|
const Fallback = () => {
|
|
2784
2718
|
useEffect(() => {
|
|
2785
2719
|
const fallback = delayRender('Waiting for Root component to unsuspend');
|
|
@@ -2865,6 +2799,20 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, s
|
|
|
2865
2799
|
}
|
|
2866
2800
|
return null;
|
|
2867
2801
|
};
|
|
2802
|
+
const ClipComposition = ({ children }) => {
|
|
2803
|
+
const { clipRegion } = useContext(NativeLayersContext);
|
|
2804
|
+
const style = useMemo(() => {
|
|
2805
|
+
return {
|
|
2806
|
+
display: 'flex',
|
|
2807
|
+
flexDirection: 'row',
|
|
2808
|
+
opacity: clipRegion === 'hide' ? 0 : 1,
|
|
2809
|
+
clipPath: clipRegion && clipRegion !== 'hide'
|
|
2810
|
+
? `polygon(${clipRegion.x}px ${clipRegion.y}px, ${clipRegion.x}px ${clipRegion.height + clipRegion.y}px, ${clipRegion.width + clipRegion.x}px ${clipRegion.height + clipRegion.y}px, ${clipRegion.width + clipRegion.x}px ${clipRegion.y}px)`
|
|
2811
|
+
: undefined,
|
|
2812
|
+
};
|
|
2813
|
+
}, [clipRegion]);
|
|
2814
|
+
return jsx(AbsoluteFill, { style: style, children: children });
|
|
2815
|
+
};
|
|
2868
2816
|
|
|
2869
2817
|
// Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/bezier.js
|
|
2870
2818
|
const NEWTON_ITERATIONS = 4;
|
|
@@ -3243,8 +3191,8 @@ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
|
|
|
3243
3191
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3244
3192
|
const [compositions, setCompositions] = useState([]);
|
|
3245
3193
|
const currentcompositionsRef = useRef(compositions);
|
|
3194
|
+
const [currentComposition, setCurrentComposition] = useState(null);
|
|
3246
3195
|
const [folders, setFolders] = useState([]);
|
|
3247
|
-
const [canvasContent, setCanvasContent] = useState(null);
|
|
3248
3196
|
const [currentCompositionMetadata, setCurrentCompositionMetadata] = useState(null);
|
|
3249
3197
|
const updateCompositions = useCallback((
|
|
3250
3198
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -3293,32 +3241,29 @@ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
|
|
|
3293
3241
|
getCompositions: () => currentcompositionsRef.current,
|
|
3294
3242
|
};
|
|
3295
3243
|
}, []);
|
|
3296
|
-
const composition = compositions.find((c) =>
|
|
3297
|
-
? c.id === canvasContent.compositionId
|
|
3298
|
-
: null);
|
|
3244
|
+
const composition = compositions.find((c) => c.id === currentComposition);
|
|
3299
3245
|
const contextValue = useMemo(() => {
|
|
3300
3246
|
return {
|
|
3301
3247
|
compositions,
|
|
3302
3248
|
registerComposition,
|
|
3303
3249
|
unregisterComposition,
|
|
3250
|
+
currentComposition,
|
|
3251
|
+
setCurrentComposition,
|
|
3304
3252
|
folders,
|
|
3305
3253
|
registerFolder,
|
|
3306
3254
|
unregisterFolder,
|
|
3307
3255
|
currentCompositionMetadata,
|
|
3308
3256
|
setCurrentCompositionMetadata,
|
|
3309
|
-
canvasContent,
|
|
3310
|
-
setCanvasContent,
|
|
3311
3257
|
};
|
|
3312
3258
|
}, [
|
|
3313
3259
|
compositions,
|
|
3314
3260
|
registerComposition,
|
|
3315
3261
|
unregisterComposition,
|
|
3262
|
+
currentComposition,
|
|
3316
3263
|
folders,
|
|
3317
3264
|
registerFolder,
|
|
3318
3265
|
unregisterFolder,
|
|
3319
3266
|
currentCompositionMetadata,
|
|
3320
|
-
canvasContent,
|
|
3321
|
-
setCanvasContent,
|
|
3322
3267
|
]);
|
|
3323
3268
|
return (jsx(CompositionManager.Provider, { value: contextValue, children: jsx(SequenceManagerProvider, { children: jsx(RenderAssetManagerProvider, { children: jsx(ResolveCompositionConfig, { children: jsx(SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, component: (_a = composition === null || composition === void 0 ? void 0 : composition.component) !== null && _a !== void 0 ? _a : null, children: children }) }) }) }) }));
|
|
3324
3269
|
};
|
|
@@ -3916,47 +3861,6 @@ const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
|
|
|
3916
3861
|
}
|
|
3917
3862
|
};
|
|
3918
3863
|
|
|
3919
|
-
const WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
|
|
3920
|
-
/**
|
|
3921
|
-
* @description Watch for changes in a specific static file.
|
|
3922
|
-
* @param {string} fileName - The name of the static file to watch for changes.
|
|
3923
|
-
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
3924
|
-
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
3925
|
-
* @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)
|
|
3926
|
-
*/
|
|
3927
|
-
const watchStaticFile = (fileName, callback) => {
|
|
3928
|
-
// Check if function is called in Remotion Studio
|
|
3929
|
-
if (!getRemotionEnvironment().isStudio) {
|
|
3930
|
-
console.warn('The API is only available while using the Remotion Studio.');
|
|
3931
|
-
return { cancel: () => undefined };
|
|
3932
|
-
}
|
|
3933
|
-
let prevFileData = window.remotion_staticFiles.find((file) => file.name === fileName);
|
|
3934
|
-
// Check if the specified static file has updated or deleted
|
|
3935
|
-
const checkFile = (event) => {
|
|
3936
|
-
const staticFiles = event.detail.files;
|
|
3937
|
-
// Check for user specified file
|
|
3938
|
-
const newFileData = staticFiles.find((file) => file.name === fileName);
|
|
3939
|
-
if (!newFileData) {
|
|
3940
|
-
// File is deleted
|
|
3941
|
-
if (prevFileData !== undefined) {
|
|
3942
|
-
callback(null);
|
|
3943
|
-
}
|
|
3944
|
-
prevFileData = undefined;
|
|
3945
|
-
return;
|
|
3946
|
-
}
|
|
3947
|
-
if (prevFileData === undefined ||
|
|
3948
|
-
prevFileData.lastModified !== newFileData.lastModified) {
|
|
3949
|
-
callback(newFileData); // File is added or modified
|
|
3950
|
-
prevFileData = newFileData;
|
|
3951
|
-
}
|
|
3952
|
-
};
|
|
3953
|
-
window.addEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3954
|
-
const cancel = () => {
|
|
3955
|
-
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3956
|
-
};
|
|
3957
|
-
return { cancel };
|
|
3958
|
-
};
|
|
3959
|
-
|
|
3960
3864
|
function useRemotionContexts() {
|
|
3961
3865
|
const compositionManagerCtx = React.useContext(CompositionManager);
|
|
3962
3866
|
const timelineContext = React.useContext(TimelineContext);
|
|
@@ -4000,11 +3904,12 @@ const RemotionContextProvider = (props) => {
|
|
|
4000
3904
|
return (jsx(CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: jsx(NonceContext.Provider, { value: contexts.nonceContext, children: jsx(NativeLayersContext.Provider, { value: contexts.nativeLayersContext, children: jsx(PreloadContext.Provider, { value: contexts.preloadContext, children: jsx(CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: jsx(SequenceManager.Provider, { value: contexts.sequenceManagerContext, children: jsx(RenderAssetManager.Provider, { value: contexts.renderAssetManagerContext, children: jsx(ResolveCompositionContext.Provider, { value: contexts.resolveCompositionContext, children: jsx(TimelineContext.Provider, { value: contexts.timelineContext, children: jsx(SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: jsx(SequenceContext.Provider, { value: contexts.sequenceContext, children: children }) }) }) }) }) }) }) }) }) }) }));
|
|
4001
3905
|
};
|
|
4002
3906
|
|
|
3907
|
+
const Timeline = TimelinePosition;
|
|
4003
3908
|
// Mark them as Internals so use don't assume this is public
|
|
4004
3909
|
// API and are less likely to use it
|
|
4005
3910
|
const Internals = {
|
|
4006
3911
|
useUnsafeVideoConfig,
|
|
4007
|
-
Timeline
|
|
3912
|
+
Timeline,
|
|
4008
3913
|
CompositionManager,
|
|
4009
3914
|
SequenceManager,
|
|
4010
3915
|
RemotionRoot,
|
|
@@ -4063,8 +3968,6 @@ const Internals = {
|
|
|
4063
3968
|
DATE_TOKEN,
|
|
4064
3969
|
NativeLayersProvider,
|
|
4065
3970
|
ClipComposition,
|
|
4066
|
-
isIosSafari,
|
|
4067
|
-
WATCH_REMOTION_STATIC_FILES,
|
|
4068
3971
|
};
|
|
4069
3972
|
|
|
4070
3973
|
const flattenChildren = (children) => {
|
|
@@ -4101,10 +4004,10 @@ const Series = ({ children }) => {
|
|
|
4101
4004
|
if (castedChild.trim() === '') {
|
|
4102
4005
|
return null;
|
|
4103
4006
|
}
|
|
4104
|
-
throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as
|
|
4007
|
+
throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as it's children, but you passed a string "${castedChild}"`);
|
|
4105
4008
|
}
|
|
4106
4009
|
if (castedChild.type !== SeriesSequence) {
|
|
4107
|
-
throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as
|
|
4010
|
+
throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as it's children, but got ${castedChild} instead`);
|
|
4108
4011
|
}
|
|
4109
4012
|
const debugInfo = `index = ${i}, duration = ${castedChild.props.durationInFrames}`;
|
|
4110
4013
|
if (!(castedChild === null || castedChild === void 0 ? void 0 : castedChild.props.children)) {
|
|
@@ -4257,7 +4160,6 @@ function springCalculation({ from = 0, to = 1, frame, fps, config = {}, }) {
|
|
|
4257
4160
|
return animation;
|
|
4258
4161
|
}
|
|
4259
4162
|
|
|
4260
|
-
const cache = new Map();
|
|
4261
4163
|
/**
|
|
4262
4164
|
* @description The function returns how long it takes for a spring animation to settle
|
|
4263
4165
|
* @see [Documentation](https://www.remotion.dev/docs/measure-spring)
|
|
@@ -4281,19 +4183,6 @@ function measureSpring({ fps, config = {}, threshold = 0.005, from = 0, to = 1,
|
|
|
4281
4183
|
if (threshold < 0) {
|
|
4282
4184
|
throw new TypeError('Threshold is below 0');
|
|
4283
4185
|
}
|
|
4284
|
-
const cacheKey = [
|
|
4285
|
-
fps,
|
|
4286
|
-
config.damping,
|
|
4287
|
-
config.mass,
|
|
4288
|
-
config.overshootClamping,
|
|
4289
|
-
config.stiffness,
|
|
4290
|
-
from,
|
|
4291
|
-
to,
|
|
4292
|
-
threshold,
|
|
4293
|
-
].join('-');
|
|
4294
|
-
if (cache.has(cacheKey)) {
|
|
4295
|
-
return cache.get(cacheKey);
|
|
4296
|
-
}
|
|
4297
4186
|
validateFps(fps, 'to the measureSpring() function', false);
|
|
4298
4187
|
const range = Math.abs(from - to);
|
|
4299
4188
|
let frame = 0;
|
|
@@ -4331,7 +4220,6 @@ function measureSpring({ fps, config = {}, threshold = 0.005, from = 0, to = 1,
|
|
|
4331
4220
|
finishedFrame = frame + 1;
|
|
4332
4221
|
}
|
|
4333
4222
|
}
|
|
4334
|
-
cache.set(cacheKey, finishedFrame);
|
|
4335
4223
|
return finishedFrame;
|
|
4336
4224
|
}
|
|
4337
4225
|
|
|
@@ -4379,19 +4267,14 @@ function spring({ frame: passedFrame, fps, config = {}, from = 0, to = 1, durati
|
|
|
4379
4267
|
throw new Error('did not calculate natural duration, this is an error with Remotion. Please report');
|
|
4380
4268
|
},
|
|
4381
4269
|
};
|
|
4382
|
-
const
|
|
4270
|
+
const frame = (reverse
|
|
4383
4271
|
? (passedDurationInFrames !== null && passedDurationInFrames !== void 0 ? passedDurationInFrames : naturalDurationGetter.get()) - passedFrame
|
|
4384
|
-
: passedFrame;
|
|
4385
|
-
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
4386
|
-
const durationProcessed = passedDurationInFrames === undefined
|
|
4387
|
-
? delayProcessed
|
|
4388
|
-
: delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
4389
|
-
if (passedDurationInFrames && durationProcessed > passedDurationInFrames) {
|
|
4390
|
-
return to;
|
|
4391
|
-
}
|
|
4272
|
+
: passedFrame) - (reverse ? -delay : delay);
|
|
4392
4273
|
const spr = springCalculation({
|
|
4393
4274
|
fps,
|
|
4394
|
-
frame:
|
|
4275
|
+
frame: passedDurationInFrames === undefined
|
|
4276
|
+
? frame
|
|
4277
|
+
: frame / (passedDurationInFrames / naturalDurationGetter.get()),
|
|
4395
4278
|
config,
|
|
4396
4279
|
from,
|
|
4397
4280
|
to,
|
|
@@ -4419,7 +4302,7 @@ const Still = (props) => {
|
|
|
4419
4302
|
return React.createElement((Composition), newProps);
|
|
4420
4303
|
};
|
|
4421
4304
|
|
|
4422
|
-
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false,
|
|
4305
|
+
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false, ...props }) => {
|
|
4423
4306
|
const absoluteFrame = useTimelinePosition();
|
|
4424
4307
|
const frame = useCurrentFrame();
|
|
4425
4308
|
const volumePropsFrame = useFrameForVolumeProp();
|
|
@@ -4469,7 +4352,6 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
|
|
|
4469
4352
|
mediaFrame: frame,
|
|
4470
4353
|
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
4471
4354
|
allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
|
|
4472
|
-
toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : null,
|
|
4473
4355
|
});
|
|
4474
4356
|
return () => unregisterRenderAsset(id);
|
|
4475
4357
|
}, [
|
|
@@ -4483,7 +4365,6 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
|
|
|
4483
4365
|
absoluteFrame,
|
|
4484
4366
|
playbackRate,
|
|
4485
4367
|
allowAmplificationDuringRender,
|
|
4486
|
-
toneFrequency,
|
|
4487
4368
|
]);
|
|
4488
4369
|
const currentTime = useMemo(() => {
|
|
4489
4370
|
return (getExpectedMediaFrameUncorrected({
|
|
@@ -4519,7 +4400,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
4519
4400
|
const parentSequence = useContext(SequenceContext);
|
|
4520
4401
|
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
|
|
4521
4402
|
// @ts-expect-error
|
|
4522
|
-
acceptableTimeShift, acceptableTimeShiftInSeconds,
|
|
4403
|
+
acceptableTimeShift, acceptableTimeShiftInSeconds, ...nativeProps } = props;
|
|
4523
4404
|
if (typeof acceptableTimeShift !== 'undefined') {
|
|
4524
4405
|
throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
|
|
4525
4406
|
}
|
|
@@ -4648,7 +4529,7 @@ const OffthreadVideo = (props) => {
|
|
|
4648
4529
|
return (jsx(VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
|
|
4649
4530
|
};
|
|
4650
4531
|
|
|
4651
|
-
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration,
|
|
4532
|
+
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, ...props }, ref) => {
|
|
4652
4533
|
const absoluteFrame = useTimelinePosition();
|
|
4653
4534
|
const frame = useCurrentFrame();
|
|
4654
4535
|
const volumePropsFrame = useFrameForVolumeProp();
|
|
@@ -4700,7 +4581,6 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
|
|
|
4700
4581
|
mediaFrame: frame,
|
|
4701
4582
|
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
4702
4583
|
allowAmplificationDuringRender: allowAmplificationDuringRender !== null && allowAmplificationDuringRender !== void 0 ? allowAmplificationDuringRender : false,
|
|
4703
|
-
toneFrequency: toneFrequency !== null && toneFrequency !== void 0 ? toneFrequency : null,
|
|
4704
4584
|
});
|
|
4705
4585
|
return () => unregisterRenderAsset(id);
|
|
4706
4586
|
}, [
|
|
@@ -4714,7 +4594,6 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
|
|
|
4714
4594
|
absoluteFrame,
|
|
4715
4595
|
playbackRate,
|
|
4716
4596
|
allowAmplificationDuringRender,
|
|
4717
|
-
toneFrequency,
|
|
4718
4597
|
]);
|
|
4719
4598
|
useImperativeHandle(ref, () => {
|
|
4720
4599
|
return videoRef.current;
|
|
@@ -4863,7 +4742,7 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
4863
4742
|
mediaDuration,
|
|
4864
4743
|
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
4865
4744
|
startFrom,
|
|
4866
|
-
}),
|
|
4745
|
+
}), children: jsx(Video, { ...propsOtherThanLoop, ref: ref }) }));
|
|
4867
4746
|
}
|
|
4868
4747
|
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
4869
4748
|
validateStartFromProps(startFrom, endAt);
|
|
@@ -4884,6 +4763,47 @@ const forward = forwardRef;
|
|
|
4884
4763
|
*/
|
|
4885
4764
|
const Video = forward(VideoForwardingFunction);
|
|
4886
4765
|
|
|
4766
|
+
const WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
|
|
4767
|
+
/**
|
|
4768
|
+
* @description Watch for changes in a specific static file.
|
|
4769
|
+
* @param {string} fileName - The name of the static file to watch for changes.
|
|
4770
|
+
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
4771
|
+
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
4772
|
+
* @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)
|
|
4773
|
+
*/
|
|
4774
|
+
const watchStaticFile = (fileName, callback) => {
|
|
4775
|
+
// Check if function is called in Remotion Studio
|
|
4776
|
+
if (!getRemotionEnvironment().isStudio) {
|
|
4777
|
+
console.warn('The API is only available while using the Remotion Studio.');
|
|
4778
|
+
return { cancel: () => undefined };
|
|
4779
|
+
}
|
|
4780
|
+
let prevFileData = window.remotion_staticFiles.find((file) => file.name === fileName);
|
|
4781
|
+
// Check if the specified static file has updated or deleted
|
|
4782
|
+
const checkFile = (event) => {
|
|
4783
|
+
const staticFiles = event.detail.files;
|
|
4784
|
+
// Check for user specified file
|
|
4785
|
+
const newFileData = staticFiles.find((file) => file.name === fileName);
|
|
4786
|
+
if (!newFileData) {
|
|
4787
|
+
// File is deleted
|
|
4788
|
+
if (prevFileData !== undefined) {
|
|
4789
|
+
callback(null);
|
|
4790
|
+
}
|
|
4791
|
+
prevFileData = undefined;
|
|
4792
|
+
return;
|
|
4793
|
+
}
|
|
4794
|
+
if (prevFileData === undefined ||
|
|
4795
|
+
prevFileData.lastModified !== newFileData.lastModified) {
|
|
4796
|
+
callback(newFileData); // File is added or modified
|
|
4797
|
+
prevFileData = newFileData;
|
|
4798
|
+
}
|
|
4799
|
+
};
|
|
4800
|
+
window.addEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
4801
|
+
const cancel = () => {
|
|
4802
|
+
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
4803
|
+
};
|
|
4804
|
+
return { cancel };
|
|
4805
|
+
};
|
|
4806
|
+
|
|
4887
4807
|
checkMultipleRemotionVersions();
|
|
4888
4808
|
const Experimental = {
|
|
4889
4809
|
/**
|
package/dist/esm/version.mjs
CHANGED