remotion 4.0.70 → 4.0.72
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/audio/Audio.d.ts +2 -1
- package/dist/cjs/audio/Audio.js +2 -2
- package/dist/cjs/audio/AudioForDevelopment.d.ts +1 -0
- package/dist/cjs/audio/AudioForDevelopment.js +2 -1
- package/dist/cjs/audio/AudioForRendering.d.ts +1 -0
- package/dist/cjs/audio/AudioForRendering.js +1 -1
- package/dist/cjs/audio/props.d.ts +1 -0
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +4 -5
- package/dist/cjs/internals.d.ts +0 -23
- package/dist/cjs/internals.js +0 -18
- package/dist/cjs/no-react.d.ts +32 -0
- package/dist/cjs/no-react.js +30 -0
- package/dist/cjs/use-media-in-timeline.d.ts +2 -1
- package/dist/cjs/use-media-in-timeline.js +3 -2
- package/dist/cjs/validation/validate-composition-id.js +1 -1
- package/dist/cjs/validation/validate-folder-name.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/OffthreadVideo.js +2 -2
- package/dist/cjs/video/OffthreadVideoForRendering.js +1 -1
- package/dist/cjs/video/Video.d.ts +1 -0
- package/dist/cjs/video/Video.js +3 -3
- package/dist/cjs/video/VideoForDevelopment.d.ts +1 -0
- package/dist/cjs/video/VideoForDevelopment.js +17 -3
- package/dist/cjs/video/VideoForRendering.d.ts +1 -0
- package/dist/cjs/video/VideoForRendering.js +1 -1
- package/dist/cjs/video/props.d.ts +2 -0
- package/dist/cjs/video/video-fragment.d.ts +1 -1
- package/dist/cjs/video/video-fragment.js +11 -17
- package/dist/esm/index.mjs +496 -526
- package/dist/esm/no-react.mjs +748 -0
- package/dist/esm/version.mjs +1 -1
- package/no-react.js +2 -0
- package/package.json +11 -2
- package/rollup-no-react.config.js +22 -0
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.72';
|
|
63
63
|
|
|
64
64
|
const checkMultipleRemotionVersions = () => {
|
|
65
65
|
if (typeof globalThis === 'undefined') {
|
|
@@ -426,35 +426,6 @@ const staticFile = (path) => {
|
|
|
426
426
|
// Must keep this file in sync with the one in packages/lambda/src/shared/serialize-props.ts!
|
|
427
427
|
const DATE_TOKEN = 'remotion-date:';
|
|
428
428
|
const FILE_TOKEN = 'remotion-file:';
|
|
429
|
-
const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
|
|
430
|
-
let customDateUsed = false;
|
|
431
|
-
let customFileUsed = false;
|
|
432
|
-
let mapUsed = false;
|
|
433
|
-
let setUsed = false;
|
|
434
|
-
const serializedString = JSON.stringify(data, function (key, value) {
|
|
435
|
-
const item = this[key];
|
|
436
|
-
if (item instanceof Date) {
|
|
437
|
-
customDateUsed = true;
|
|
438
|
-
return `${DATE_TOKEN}${item.toISOString()}`;
|
|
439
|
-
}
|
|
440
|
-
if (item instanceof Map) {
|
|
441
|
-
mapUsed = true;
|
|
442
|
-
return value;
|
|
443
|
-
}
|
|
444
|
-
if (item instanceof Set) {
|
|
445
|
-
setUsed = true;
|
|
446
|
-
return value;
|
|
447
|
-
}
|
|
448
|
-
if (typeof item === 'string' &&
|
|
449
|
-
staticBase !== null &&
|
|
450
|
-
item.startsWith(staticBase)) {
|
|
451
|
-
customFileUsed = true;
|
|
452
|
-
return `${FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
|
|
453
|
-
}
|
|
454
|
-
return value;
|
|
455
|
-
}, indent);
|
|
456
|
-
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
457
|
-
};
|
|
458
429
|
const deserializeJSONWithCustomFields = (data) => {
|
|
459
430
|
return JSON.parse(data, (_, value) => {
|
|
460
431
|
if (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {
|
|
@@ -1552,7 +1523,7 @@ const warnOnce = (message) => {
|
|
|
1552
1523
|
console.warn(message);
|
|
1553
1524
|
didWarn[message] = true;
|
|
1554
1525
|
};
|
|
1555
|
-
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, }) => {
|
|
1526
|
+
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, }) => {
|
|
1556
1527
|
const videoConfig = useVideoConfig();
|
|
1557
1528
|
const { rootId, audioAndVideoTags } = useContext(TimelineContext);
|
|
1558
1529
|
const parentSequence = useContext(SequenceContext);
|
|
@@ -1608,7 +1579,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
|
|
|
1608
1579
|
duration,
|
|
1609
1580
|
from: 0,
|
|
1610
1581
|
parent: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _a !== void 0 ? _a : null,
|
|
1611
|
-
displayName: getAssetDisplayName(src),
|
|
1582
|
+
displayName: displayName !== null && displayName !== void 0 ? displayName : getAssetDisplayName(src),
|
|
1612
1583
|
rootId,
|
|
1613
1584
|
volume: volumes,
|
|
1614
1585
|
showInTimeline: true,
|
|
@@ -1638,6 +1609,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
|
|
|
1638
1609
|
mediaType,
|
|
1639
1610
|
startsAt,
|
|
1640
1611
|
playbackRate,
|
|
1612
|
+
displayName,
|
|
1641
1613
|
]);
|
|
1642
1614
|
useEffect(() => {
|
|
1643
1615
|
const tag = {
|
|
@@ -1801,19 +1773,19 @@ const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, })
|
|
|
1801
1773
|
const toSeconds = (time, fps) => {
|
|
1802
1774
|
return Math.round((time / fps) * 100) / 100;
|
|
1803
1775
|
};
|
|
1776
|
+
const isIosSafari = () => {
|
|
1777
|
+
return typeof window === 'undefined'
|
|
1778
|
+
? false
|
|
1779
|
+
: /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
|
|
1780
|
+
Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/));
|
|
1781
|
+
};
|
|
1804
1782
|
// https://github.com/remotion-dev/remotion/issues/1655
|
|
1805
|
-
const
|
|
1806
|
-
|
|
1807
|
-
return false;
|
|
1808
|
-
}
|
|
1809
|
-
const isIpadIPodIPhone = /iP(ad|od|hone)/i.test(window.navigator.userAgent);
|
|
1810
|
-
const isSafari = Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/));
|
|
1811
|
-
const isChrome = Boolean(navigator.userAgent.match(/CriOS\//));
|
|
1812
|
-
return (isIpadIPodIPhone && (isSafari || isChrome) && actualSrc.startsWith('blob:'));
|
|
1783
|
+
const isIOSSafariAndBlob = (actualSrc) => {
|
|
1784
|
+
return isIosSafari() && actualSrc.startsWith('blob:');
|
|
1813
1785
|
};
|
|
1814
1786
|
const appendVideoFragment = ({ actualSrc, actualFrom, duration, fps, }) => {
|
|
1815
1787
|
var _a;
|
|
1816
|
-
if (
|
|
1788
|
+
if (isIOSSafariAndBlob(actualSrc)) {
|
|
1817
1789
|
return actualSrc;
|
|
1818
1790
|
}
|
|
1819
1791
|
if (actualSrc.startsWith('data:')) {
|
|
@@ -1854,12 +1826,6 @@ const useAppendVideoFragment = ({ actualSrc: initialActualSrc, actualFrom: initi
|
|
|
1854
1826
|
});
|
|
1855
1827
|
return appended;
|
|
1856
1828
|
};
|
|
1857
|
-
const isIosSafari = () => {
|
|
1858
|
-
return typeof window === 'undefined'
|
|
1859
|
-
? false
|
|
1860
|
-
: /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
|
|
1861
|
-
Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/));
|
|
1862
|
-
};
|
|
1863
1829
|
|
|
1864
1830
|
const alreadyWarned = {};
|
|
1865
1831
|
const warnAboutNonSeekableMedia = (ref, type) => {
|
|
@@ -2284,7 +2250,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
2284
2250
|
const [mediaVolume] = useMediaVolumeState();
|
|
2285
2251
|
const [mediaMuted] = useMediaMutedState();
|
|
2286
2252
|
const volumePropFrame = useFrameForVolumeProp();
|
|
2287
|
-
const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, allowAmplificationDuringRender, ...nativeProps } = props;
|
|
2253
|
+
const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, allowAmplificationDuringRender, name, ...nativeProps } = props;
|
|
2288
2254
|
if (!src) {
|
|
2289
2255
|
throw new TypeError("No 'src' was passed to <Audio>.");
|
|
2290
2256
|
}
|
|
@@ -2323,6 +2289,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
2323
2289
|
src,
|
|
2324
2290
|
mediaType: 'audio',
|
|
2325
2291
|
playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
|
|
2292
|
+
displayName: name !== null && name !== void 0 ? name : null,
|
|
2326
2293
|
});
|
|
2327
2294
|
useMediaPlayback({
|
|
2328
2295
|
mediaRef: audioRef,
|
|
@@ -2496,7 +2463,7 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
2496
2463
|
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
|
|
2497
2464
|
sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
|
|
2498
2465
|
]);
|
|
2499
|
-
const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, acceptableTimeShiftInSeconds, ...nativeProps } = props;
|
|
2466
|
+
const { volume: volumeProp, playbackRate, allowAmplificationDuringRender, onDuration, toneFrequency, _remotionInternalNeedsDurationCalculation, acceptableTimeShiftInSeconds, name, ...nativeProps } = props;
|
|
2500
2467
|
const volume = evaluateVolume({
|
|
2501
2468
|
volume: volumeProp,
|
|
2502
2469
|
frame: volumePropFrame,
|
|
@@ -2590,7 +2557,7 @@ const AudioForRendering = forwardRef(AudioForRenderingRefForwardingFunction);
|
|
|
2590
2557
|
const AudioRefForwardingFunction = (props, ref) => {
|
|
2591
2558
|
var _a;
|
|
2592
2559
|
const audioContext = useContext(SharedAudioContext);
|
|
2593
|
-
const { startFrom, endAt, ...otherProps } = props;
|
|
2560
|
+
const { startFrom, endAt, name, ...otherProps } = props;
|
|
2594
2561
|
const { loop, ...propsOtherThanLoop } = props;
|
|
2595
2562
|
const { fps } = useVideoConfig();
|
|
2596
2563
|
const environment = getRemotionEnvironment();
|
|
@@ -2627,7 +2594,7 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
2627
2594
|
validateStartFromProps(startFrom, endAt);
|
|
2628
2595
|
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
2629
2596
|
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
2630
|
-
return (jsx(Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: jsx(Audio, { _remotionInternalNeedsDurationCalculation: Boolean(loop), ...otherProps, ref: ref }) }));
|
|
2597
|
+
return (jsx(Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, name: name, children: jsx(Audio, { _remotionInternalNeedsDurationCalculation: Boolean(loop), ...otherProps, ref: ref }) }));
|
|
2631
2598
|
}
|
|
2632
2599
|
validateMediaProps(props, 'Audio');
|
|
2633
2600
|
if (environment.isRendering) {
|
|
@@ -2641,7 +2608,7 @@ const AudioRefForwardingFunction = (props, ref) => {
|
|
|
2641
2608
|
*/
|
|
2642
2609
|
const Audio = forwardRef(AudioRefForwardingFunction);
|
|
2643
2610
|
|
|
2644
|
-
const getRegex$1 = () => /^([a-zA-Z0-9
|
|
2611
|
+
const getRegex$1 = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
|
|
2645
2612
|
const isFolderNameValid = (name) => name.match(getRegex$1());
|
|
2646
2613
|
const validateFolderName = (name) => {
|
|
2647
2614
|
if (name === undefined || name === null) {
|
|
@@ -2756,7 +2723,7 @@ const useLazyComponent = (compProps) => {
|
|
|
2756
2723
|
return lazy;
|
|
2757
2724
|
};
|
|
2758
2725
|
|
|
2759
|
-
const getRegex = () => /^([a-zA-Z0-9
|
|
2726
|
+
const getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
|
|
2760
2727
|
const isCompositionIdValid = (id) => id.match(getRegex());
|
|
2761
2728
|
const validateCompositionId = (id) => {
|
|
2762
2729
|
if (!isCompositionIdValid(id)) {
|
|
@@ -3391,126 +3358,388 @@ const getPreviewDomElement = () => {
|
|
|
3391
3358
|
return document.getElementById(REMOTION_STUDIO_CONTAINER_ELEMENT);
|
|
3392
3359
|
};
|
|
3393
3360
|
|
|
3361
|
+
let Root = null;
|
|
3362
|
+
let listeners = [];
|
|
3394
3363
|
/**
|
|
3395
|
-
*
|
|
3396
|
-
* https://
|
|
3364
|
+
* @description This function registers the root component of the Remotion project
|
|
3365
|
+
* @see [Documentation](https://www.remotion.dev/docs/register-root)
|
|
3397
3366
|
*/
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
function call(...args) {
|
|
3402
|
-
return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
|
|
3403
|
-
}
|
|
3404
|
-
function getMatchers() {
|
|
3405
|
-
const cachedMatchers = {
|
|
3406
|
-
rgb: undefined,
|
|
3407
|
-
rgba: undefined,
|
|
3408
|
-
hsl: undefined,
|
|
3409
|
-
hsla: undefined,
|
|
3410
|
-
hex3: undefined,
|
|
3411
|
-
hex4: undefined,
|
|
3412
|
-
hex5: undefined,
|
|
3413
|
-
hex6: undefined,
|
|
3414
|
-
hex8: undefined,
|
|
3415
|
-
};
|
|
3416
|
-
if (cachedMatchers.rgb === undefined) {
|
|
3417
|
-
cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
|
|
3418
|
-
cachedMatchers.rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
3419
|
-
cachedMatchers.hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
|
3420
|
-
cachedMatchers.hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
|
3421
|
-
cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3422
|
-
cachedMatchers.hex4 =
|
|
3423
|
-
/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3424
|
-
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
3425
|
-
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
3426
|
-
}
|
|
3427
|
-
return cachedMatchers;
|
|
3428
|
-
}
|
|
3429
|
-
function hue2rgb(p, q, t) {
|
|
3430
|
-
if (t < 0) {
|
|
3431
|
-
t += 1;
|
|
3432
|
-
}
|
|
3433
|
-
if (t > 1) {
|
|
3434
|
-
t -= 1;
|
|
3435
|
-
}
|
|
3436
|
-
if (t < 1 / 6) {
|
|
3437
|
-
return p + (q - p) * 6 * t;
|
|
3367
|
+
const registerRoot = (comp) => {
|
|
3368
|
+
if (!comp) {
|
|
3369
|
+
throw new Error(`You must pass a React component to registerRoot(), but ${JSON.stringify(comp)} was passed.`);
|
|
3438
3370
|
}
|
|
3439
|
-
if (
|
|
3440
|
-
|
|
3371
|
+
if (Root) {
|
|
3372
|
+
throw new Error('registerRoot() was called more than once.');
|
|
3441
3373
|
}
|
|
3442
|
-
|
|
3443
|
-
|
|
3374
|
+
Root = comp;
|
|
3375
|
+
listeners.forEach((l) => {
|
|
3376
|
+
l(comp);
|
|
3377
|
+
});
|
|
3378
|
+
};
|
|
3379
|
+
const getRoot = () => {
|
|
3380
|
+
return Root;
|
|
3381
|
+
};
|
|
3382
|
+
const waitForRoot = (fn) => {
|
|
3383
|
+
if (Root) {
|
|
3384
|
+
fn(Root);
|
|
3385
|
+
return () => undefined;
|
|
3444
3386
|
}
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
const
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
const
|
|
3459
|
-
if (
|
|
3460
|
-
|
|
3387
|
+
listeners.push(fn);
|
|
3388
|
+
return () => {
|
|
3389
|
+
listeners = listeners.filter((l) => l !== fn);
|
|
3390
|
+
};
|
|
3391
|
+
};
|
|
3392
|
+
|
|
3393
|
+
const RemotionRoot = ({ children, numberOfAudioTags }) => {
|
|
3394
|
+
const [remotionRootId] = useState(() => String(random(null)));
|
|
3395
|
+
const [frame, setFrame] = useState({});
|
|
3396
|
+
const [playing, setPlaying] = useState(false);
|
|
3397
|
+
const imperativePlaying = useRef(false);
|
|
3398
|
+
const [fastRefreshes, setFastRefreshes] = useState(0);
|
|
3399
|
+
const [playbackRate, setPlaybackRate] = useState(1);
|
|
3400
|
+
const audioAndVideoTags = useRef([]);
|
|
3401
|
+
if (typeof window !== 'undefined') {
|
|
3402
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3403
|
+
useLayoutEffect(() => {
|
|
3404
|
+
window.remotion_setFrame = (f, composition) => {
|
|
3405
|
+
const id = delayRender(`Setting the current frame to ${f}`);
|
|
3406
|
+
setFrame((s) => ({
|
|
3407
|
+
...s,
|
|
3408
|
+
[composition]: f,
|
|
3409
|
+
}));
|
|
3410
|
+
requestAnimationFrame(() => continueRender(id));
|
|
3411
|
+
};
|
|
3412
|
+
window.remotion_isPlayer = false;
|
|
3413
|
+
}, []);
|
|
3461
3414
|
}
|
|
3462
|
-
|
|
3463
|
-
return
|
|
3415
|
+
const timelineContextValue = useMemo(() => {
|
|
3416
|
+
return {
|
|
3417
|
+
frame,
|
|
3418
|
+
playing,
|
|
3419
|
+
imperativePlaying,
|
|
3420
|
+
rootId: remotionRootId,
|
|
3421
|
+
playbackRate,
|
|
3422
|
+
setPlaybackRate,
|
|
3423
|
+
audioAndVideoTags,
|
|
3424
|
+
};
|
|
3425
|
+
}, [frame, playbackRate, playing, remotionRootId]);
|
|
3426
|
+
const setTimelineContextValue = useMemo(() => {
|
|
3427
|
+
return {
|
|
3428
|
+
setFrame,
|
|
3429
|
+
setPlaying,
|
|
3430
|
+
};
|
|
3431
|
+
}, []);
|
|
3432
|
+
const nonceContext = useMemo(() => {
|
|
3433
|
+
let counter = 0;
|
|
3434
|
+
return {
|
|
3435
|
+
getNonce: () => counter++,
|
|
3436
|
+
fastRefreshes,
|
|
3437
|
+
};
|
|
3438
|
+
}, [fastRefreshes]);
|
|
3439
|
+
useEffect(() => {
|
|
3440
|
+
if (typeof __webpack_module__ !== 'undefined') {
|
|
3441
|
+
if (__webpack_module__.hot) {
|
|
3442
|
+
__webpack_module__.hot.addStatusHandler((status) => {
|
|
3443
|
+
if (status === 'idle') {
|
|
3444
|
+
setFastRefreshes((i) => i + 1);
|
|
3445
|
+
}
|
|
3446
|
+
});
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
}, []);
|
|
3450
|
+
return (jsx(NonceContext.Provider, { value: nonceContext, children: jsx(TimelineContext.Provider, { value: timelineContextValue, children: jsx(SetTimelineContext.Provider, { value: setTimelineContextValue, children: jsx(EditorPropsProvider, { children: jsx(PrefetchProvider, { children: jsx(NativeLayersProvider, { children: jsx(CompositionManagerProvider, { numberOfAudioTags: numberOfAudioTags, children: jsx(DurationsContextProvider, { children: children }) }) }) }) }) }) }) }));
|
|
3451
|
+
};
|
|
3452
|
+
|
|
3453
|
+
const getEnvVariables = () => {
|
|
3454
|
+
if (getRemotionEnvironment().isRendering) {
|
|
3455
|
+
const param = window.remotion_envVariables;
|
|
3456
|
+
if (!param) {
|
|
3457
|
+
return {};
|
|
3458
|
+
}
|
|
3459
|
+
return { ...JSON.parse(param), NODE_ENV: process.env.NODE_ENV };
|
|
3464
3460
|
}
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
}
|
|
3471
|
-
function parse1(str) {
|
|
3472
|
-
const num = Number.parseFloat(str);
|
|
3473
|
-
if (num < 0) {
|
|
3474
|
-
return 0;
|
|
3461
|
+
if (getRemotionEnvironment().isStudio) {
|
|
3462
|
+
// For the Studio, we already set the environment variables in index-html.ts.
|
|
3463
|
+
// We just add NODE_ENV here.
|
|
3464
|
+
return {
|
|
3465
|
+
NODE_ENV: 'development',
|
|
3466
|
+
};
|
|
3475
3467
|
}
|
|
3476
|
-
|
|
3477
|
-
|
|
3468
|
+
throw new Error('Can only call getEnvVariables() if environment is `rendering` or `preview`');
|
|
3469
|
+
};
|
|
3470
|
+
const setupEnvVariables = () => {
|
|
3471
|
+
const env = getEnvVariables();
|
|
3472
|
+
if (!window.process) {
|
|
3473
|
+
window.process = {};
|
|
3478
3474
|
}
|
|
3479
|
-
|
|
3480
|
-
}
|
|
3481
|
-
function parsePercentage(str) {
|
|
3482
|
-
// parseFloat conveniently ignores the final %
|
|
3483
|
-
const int = Number.parseFloat(str);
|
|
3484
|
-
if (int < 0) {
|
|
3485
|
-
return 0;
|
|
3475
|
+
if (!window.process.env) {
|
|
3476
|
+
window.process.env = {};
|
|
3486
3477
|
}
|
|
3487
|
-
|
|
3488
|
-
|
|
3478
|
+
Object.keys(env).forEach((key) => {
|
|
3479
|
+
window.process.env[key] = env[key];
|
|
3480
|
+
});
|
|
3481
|
+
};
|
|
3482
|
+
|
|
3483
|
+
const WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
|
|
3484
|
+
/**
|
|
3485
|
+
* @description Watch for changes in a specific static file.
|
|
3486
|
+
* @param {string} fileName - The name of the static file to watch for changes.
|
|
3487
|
+
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
3488
|
+
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
3489
|
+
* @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)
|
|
3490
|
+
*/
|
|
3491
|
+
const watchStaticFile = (fileName, callback) => {
|
|
3492
|
+
// Check if function is called in Remotion Studio
|
|
3493
|
+
if (!getRemotionEnvironment().isStudio) {
|
|
3494
|
+
console.warn('The API is only available while using the Remotion Studio.');
|
|
3495
|
+
return { cancel: () => undefined };
|
|
3489
3496
|
}
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
const
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3497
|
+
let prevFileData = window.remotion_staticFiles.find((file) => file.name === fileName);
|
|
3498
|
+
// Check if the specified static file has updated or deleted
|
|
3499
|
+
const checkFile = (event) => {
|
|
3500
|
+
const staticFiles = event.detail.files;
|
|
3501
|
+
// Check for user specified file
|
|
3502
|
+
const newFileData = staticFiles.find((file) => file.name === fileName);
|
|
3503
|
+
if (!newFileData) {
|
|
3504
|
+
// File is deleted
|
|
3505
|
+
if (prevFileData !== undefined) {
|
|
3506
|
+
callback(null);
|
|
3507
|
+
}
|
|
3508
|
+
prevFileData = undefined;
|
|
3509
|
+
return;
|
|
3510
|
+
}
|
|
3511
|
+
if (prevFileData === undefined ||
|
|
3512
|
+
prevFileData.lastModified !== newFileData.lastModified) {
|
|
3513
|
+
callback(newFileData); // File is added or modified
|
|
3514
|
+
prevFileData = newFileData;
|
|
3515
|
+
}
|
|
3516
|
+
};
|
|
3517
|
+
window.addEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3518
|
+
const cancel = () => {
|
|
3519
|
+
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3520
|
+
};
|
|
3521
|
+
return { cancel };
|
|
3522
|
+
};
|
|
3523
|
+
|
|
3524
|
+
function useRemotionContexts() {
|
|
3525
|
+
const compositionManagerCtx = React.useContext(CompositionManager);
|
|
3526
|
+
const timelineContext = React.useContext(TimelineContext);
|
|
3527
|
+
const setTimelineContext = React.useContext(SetTimelineContext);
|
|
3528
|
+
const sequenceContext = React.useContext(SequenceContext);
|
|
3529
|
+
const nonceContext = React.useContext(NonceContext);
|
|
3530
|
+
const canUseRemotionHooksContext = React.useContext(CanUseRemotionHooks);
|
|
3531
|
+
const nativeLayersContext = React.useContext(NativeLayersContext);
|
|
3532
|
+
const preloadContext = React.useContext(PreloadContext);
|
|
3533
|
+
const resolveCompositionContext = React.useContext(ResolveCompositionContext);
|
|
3534
|
+
const renderAssetManagerContext = React.useContext(RenderAssetManager);
|
|
3535
|
+
const sequenceManagerContext = React.useContext(SequenceManager);
|
|
3536
|
+
return useMemo(() => ({
|
|
3537
|
+
compositionManagerCtx,
|
|
3538
|
+
timelineContext,
|
|
3539
|
+
setTimelineContext,
|
|
3540
|
+
sequenceContext,
|
|
3541
|
+
nonceContext,
|
|
3542
|
+
canUseRemotionHooksContext,
|
|
3543
|
+
nativeLayersContext,
|
|
3544
|
+
preloadContext,
|
|
3545
|
+
resolveCompositionContext,
|
|
3546
|
+
renderAssetManagerContext,
|
|
3547
|
+
sequenceManagerContext,
|
|
3548
|
+
}), [
|
|
3549
|
+
compositionManagerCtx,
|
|
3550
|
+
nonceContext,
|
|
3551
|
+
sequenceContext,
|
|
3552
|
+
setTimelineContext,
|
|
3553
|
+
timelineContext,
|
|
3554
|
+
canUseRemotionHooksContext,
|
|
3555
|
+
nativeLayersContext,
|
|
3556
|
+
preloadContext,
|
|
3557
|
+
resolveCompositionContext,
|
|
3558
|
+
renderAssetManagerContext,
|
|
3559
|
+
sequenceManagerContext,
|
|
3560
|
+
]);
|
|
3561
|
+
}
|
|
3562
|
+
const RemotionContextProvider = (props) => {
|
|
3563
|
+
const { children, contexts } = props;
|
|
3564
|
+
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 }) }) }) }) }) }) }) }) }) }) }));
|
|
3565
|
+
};
|
|
3566
|
+
|
|
3567
|
+
// Mark them as Internals so use don't assume this is public
|
|
3568
|
+
// API and are less likely to use it
|
|
3569
|
+
const Internals = {
|
|
3570
|
+
useUnsafeVideoConfig,
|
|
3571
|
+
Timeline: TimelinePosition,
|
|
3572
|
+
CompositionManager,
|
|
3573
|
+
SequenceManager,
|
|
3574
|
+
RemotionRoot,
|
|
3575
|
+
useVideo,
|
|
3576
|
+
getRoot,
|
|
3577
|
+
useMediaVolumeState,
|
|
3578
|
+
useMediaMutedState,
|
|
3579
|
+
useLazyComponent,
|
|
3580
|
+
truthy,
|
|
3581
|
+
SequenceContext,
|
|
3582
|
+
useRemotionContexts,
|
|
3583
|
+
RemotionContextProvider,
|
|
3584
|
+
CSSUtils,
|
|
3585
|
+
setupEnvVariables,
|
|
3586
|
+
MediaVolumeContext,
|
|
3587
|
+
SetMediaVolumeContext,
|
|
3588
|
+
getRemotionEnvironment,
|
|
3589
|
+
SharedAudioContext,
|
|
3590
|
+
SharedAudioContextProvider,
|
|
3591
|
+
invalidCompositionErrorMessage,
|
|
3592
|
+
isCompositionIdValid,
|
|
3593
|
+
getPreviewDomElement,
|
|
3594
|
+
compositionsRef,
|
|
3595
|
+
portalNode,
|
|
3596
|
+
waitForRoot,
|
|
3597
|
+
CanUseRemotionHooksProvider,
|
|
3598
|
+
CanUseRemotionHooks,
|
|
3599
|
+
PrefetchProvider,
|
|
3600
|
+
DurationsContextProvider,
|
|
3601
|
+
IsPlayerContextProvider,
|
|
3602
|
+
useIsPlayer,
|
|
3603
|
+
EditorPropsProvider,
|
|
3604
|
+
EditorPropsContext,
|
|
3605
|
+
usePreload,
|
|
3606
|
+
NonceContext,
|
|
3607
|
+
resolveVideoConfig,
|
|
3608
|
+
useResolvedVideoConfig,
|
|
3609
|
+
resolveCompositionsRef,
|
|
3610
|
+
ResolveCompositionConfig,
|
|
3611
|
+
REMOTION_STUDIO_CONTAINER_ELEMENT,
|
|
3612
|
+
RenderAssetManager,
|
|
3613
|
+
persistCurrentFrame,
|
|
3614
|
+
useTimelineSetFrame,
|
|
3615
|
+
FILE_TOKEN,
|
|
3616
|
+
DATE_TOKEN,
|
|
3617
|
+
NativeLayersProvider,
|
|
3618
|
+
ClipComposition,
|
|
3619
|
+
isIosSafari,
|
|
3620
|
+
WATCH_REMOTION_STATIC_FILES,
|
|
3621
|
+
};
|
|
3622
|
+
|
|
3623
|
+
/**
|
|
3624
|
+
* Copied from:
|
|
3625
|
+
* https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
|
|
3626
|
+
*/
|
|
3627
|
+
// var INTEGER = '[-+]?\\d+';
|
|
3628
|
+
const NUMBER = '[-+]?\\d*\\.?\\d+';
|
|
3629
|
+
const PERCENTAGE = NUMBER + '%';
|
|
3630
|
+
function call(...args) {
|
|
3631
|
+
return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
|
|
3632
|
+
}
|
|
3633
|
+
function getMatchers() {
|
|
3634
|
+
const cachedMatchers = {
|
|
3635
|
+
rgb: undefined,
|
|
3636
|
+
rgba: undefined,
|
|
3637
|
+
hsl: undefined,
|
|
3638
|
+
hsla: undefined,
|
|
3639
|
+
hex3: undefined,
|
|
3640
|
+
hex4: undefined,
|
|
3641
|
+
hex5: undefined,
|
|
3642
|
+
hex6: undefined,
|
|
3643
|
+
hex8: undefined,
|
|
3644
|
+
};
|
|
3645
|
+
if (cachedMatchers.rgb === undefined) {
|
|
3646
|
+
cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
|
|
3647
|
+
cachedMatchers.rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
3648
|
+
cachedMatchers.hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
|
3649
|
+
cachedMatchers.hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
|
3650
|
+
cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3651
|
+
cachedMatchers.hex4 =
|
|
3652
|
+
/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3653
|
+
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
3654
|
+
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
3655
|
+
}
|
|
3656
|
+
return cachedMatchers;
|
|
3657
|
+
}
|
|
3658
|
+
function hue2rgb(p, q, t) {
|
|
3659
|
+
if (t < 0) {
|
|
3660
|
+
t += 1;
|
|
3661
|
+
}
|
|
3662
|
+
if (t > 1) {
|
|
3663
|
+
t -= 1;
|
|
3664
|
+
}
|
|
3665
|
+
if (t < 1 / 6) {
|
|
3666
|
+
return p + (q - p) * 6 * t;
|
|
3667
|
+
}
|
|
3668
|
+
if (t < 1 / 2) {
|
|
3669
|
+
return q;
|
|
3670
|
+
}
|
|
3671
|
+
if (t < 2 / 3) {
|
|
3672
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
3673
|
+
}
|
|
3674
|
+
return p;
|
|
3675
|
+
}
|
|
3676
|
+
function hslToRgb(h, s, l) {
|
|
3677
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
3678
|
+
const p = 2 * l - q;
|
|
3679
|
+
const r = hue2rgb(p, q, h + 1 / 3);
|
|
3680
|
+
const g = hue2rgb(p, q, h);
|
|
3681
|
+
const b = hue2rgb(p, q, h - 1 / 3);
|
|
3682
|
+
return ((Math.round(r * 255) << 24) |
|
|
3683
|
+
(Math.round(g * 255) << 16) |
|
|
3684
|
+
(Math.round(b * 255) << 8));
|
|
3685
|
+
}
|
|
3686
|
+
function parse255(str) {
|
|
3687
|
+
const int = Number.parseInt(str, 10);
|
|
3688
|
+
if (int < 0) {
|
|
3689
|
+
return 0;
|
|
3690
|
+
}
|
|
3691
|
+
if (int > 255) {
|
|
3692
|
+
return 255;
|
|
3693
|
+
}
|
|
3694
|
+
return int;
|
|
3695
|
+
}
|
|
3696
|
+
function parse360(str) {
|
|
3697
|
+
const int = Number.parseFloat(str);
|
|
3698
|
+
return (((int % 360) + 360) % 360) / 360;
|
|
3699
|
+
}
|
|
3700
|
+
function parse1(str) {
|
|
3701
|
+
const num = Number.parseFloat(str);
|
|
3702
|
+
if (num < 0) {
|
|
3703
|
+
return 0;
|
|
3704
|
+
}
|
|
3705
|
+
if (num > 1) {
|
|
3706
|
+
return 255;
|
|
3707
|
+
}
|
|
3708
|
+
return Math.round(num * 255);
|
|
3709
|
+
}
|
|
3710
|
+
function parsePercentage(str) {
|
|
3711
|
+
// parseFloat conveniently ignores the final %
|
|
3712
|
+
const int = Number.parseFloat(str);
|
|
3713
|
+
if (int < 0) {
|
|
3714
|
+
return 0;
|
|
3715
|
+
}
|
|
3716
|
+
if (int > 100) {
|
|
3717
|
+
return 1;
|
|
3718
|
+
}
|
|
3719
|
+
return int / 100;
|
|
3720
|
+
}
|
|
3721
|
+
const names = {
|
|
3722
|
+
transparent: 0x00000000,
|
|
3723
|
+
// http://www.w3.org/TR/css3-color/#svg-color
|
|
3724
|
+
aliceblue: 0xf0f8ffff,
|
|
3725
|
+
antiquewhite: 0xfaebd7ff,
|
|
3726
|
+
aqua: 0x00ffffff,
|
|
3727
|
+
aquamarine: 0x7fffd4ff,
|
|
3728
|
+
azure: 0xf0ffffff,
|
|
3729
|
+
beige: 0xf5f5dcff,
|
|
3730
|
+
bisque: 0xffe4c4ff,
|
|
3731
|
+
black: 0x000000ff,
|
|
3732
|
+
blanchedalmond: 0xffebcdff,
|
|
3733
|
+
blue: 0x0000ffff,
|
|
3734
|
+
blueviolet: 0x8a2be2ff,
|
|
3735
|
+
brown: 0xa52a2aff,
|
|
3736
|
+
burlywood: 0xdeb887ff,
|
|
3737
|
+
burntsienna: 0xea7e5dff,
|
|
3738
|
+
cadetblue: 0x5f9ea0ff,
|
|
3739
|
+
chartreuse: 0x7fff00ff,
|
|
3740
|
+
chocolate: 0xd2691eff,
|
|
3741
|
+
coral: 0xff7f50ff,
|
|
3742
|
+
cornflowerblue: 0x6495edff,
|
|
3514
3743
|
cornsilk: 0xfff8dcff,
|
|
3515
3744
|
crimson: 0xdc143cff,
|
|
3516
3745
|
cyan: 0x00ffffff,
|
|
@@ -3694,216 +3923,94 @@ function normalizeColor(color) {
|
|
|
3694
3923
|
return Number.parseInt(match[1], 16) >>> 0;
|
|
3695
3924
|
}
|
|
3696
3925
|
}
|
|
3697
|
-
if (matchers.hex4) {
|
|
3698
|
-
if ((match = matchers.hex4.exec(color))) {
|
|
3699
|
-
return (Number.parseInt(match[1] +
|
|
3700
|
-
match[1] + // r
|
|
3701
|
-
match[2] +
|
|
3702
|
-
match[2] + // g
|
|
3703
|
-
match[3] +
|
|
3704
|
-
match[3] + // b
|
|
3705
|
-
match[4] +
|
|
3706
|
-
match[4], // a
|
|
3707
|
-
16) >>> 0);
|
|
3708
|
-
}
|
|
3709
|
-
}
|
|
3710
|
-
if (matchers.hsl) {
|
|
3711
|
-
if ((match = matchers.hsl.exec(color))) {
|
|
3712
|
-
return ((hslToRgb(parse360(match[1]), // h
|
|
3713
|
-
parsePercentage(match[2]), // s
|
|
3714
|
-
parsePercentage(match[3])) |
|
|
3715
|
-
0x000000ff) >>> // a
|
|
3716
|
-
0);
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
if (matchers.hsla) {
|
|
3720
|
-
if ((match = matchers.hsla.exec(color))) {
|
|
3721
|
-
return ((hslToRgb(parse360(match[1]), // h
|
|
3722
|
-
parsePercentage(match[2]), // s
|
|
3723
|
-
parsePercentage(match[3])) |
|
|
3724
|
-
parse1(match[4])) >>> // a
|
|
3725
|
-
0);
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
throw new Error(`invalid color string ${color} provided`);
|
|
3729
|
-
}
|
|
3730
|
-
const opacity = (c) => {
|
|
3731
|
-
return ((c >> 24) & 255) / 255;
|
|
3732
|
-
};
|
|
3733
|
-
const red = (c) => {
|
|
3734
|
-
return (c >> 16) & 255;
|
|
3735
|
-
};
|
|
3736
|
-
const green = (c) => {
|
|
3737
|
-
return (c >> 8) & 255;
|
|
3738
|
-
};
|
|
3739
|
-
const blue = (c) => {
|
|
3740
|
-
return c & 255;
|
|
3741
|
-
};
|
|
3742
|
-
const rgbaColor = (r, g, b, alpha) => {
|
|
3743
|
-
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
3744
|
-
};
|
|
3745
|
-
function processColor(color) {
|
|
3746
|
-
const normalizedColor = normalizeColor(color);
|
|
3747
|
-
return ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
|
|
3748
|
-
}
|
|
3749
|
-
const interpolateColorsRGB = (value, inputRange, colors) => {
|
|
3750
|
-
const [r, g, b, a] = [red, green, blue, opacity].map((f) => {
|
|
3751
|
-
const unrounded = interpolate(value, inputRange, colors.map((c) => f(c)), {
|
|
3752
|
-
extrapolateLeft: 'clamp',
|
|
3753
|
-
extrapolateRight: 'clamp',
|
|
3754
|
-
});
|
|
3755
|
-
if (f === opacity) {
|
|
3756
|
-
return Number(unrounded.toFixed(3));
|
|
3757
|
-
}
|
|
3758
|
-
return Math.round(unrounded);
|
|
3759
|
-
});
|
|
3760
|
-
return rgbaColor(r, g, b, a);
|
|
3761
|
-
};
|
|
3762
|
-
/**
|
|
3763
|
-
* @description This function allows you to map a range of values to colors using a concise syntax.
|
|
3764
|
-
* @see [Documentation](https://www.remotion.dev/docs/interpolate-colors)
|
|
3765
|
-
*/
|
|
3766
|
-
const interpolateColors = (input, inputRange, outputRange) => {
|
|
3767
|
-
if (typeof input === 'undefined') {
|
|
3768
|
-
throw new TypeError('input can not be undefined');
|
|
3769
|
-
}
|
|
3770
|
-
if (typeof inputRange === 'undefined') {
|
|
3771
|
-
throw new TypeError('inputRange can not be undefined');
|
|
3772
|
-
}
|
|
3773
|
-
if (typeof outputRange === 'undefined') {
|
|
3774
|
-
throw new TypeError('outputRange can not be undefined');
|
|
3775
|
-
}
|
|
3776
|
-
if (inputRange.length !== outputRange.length) {
|
|
3777
|
-
throw new TypeError('inputRange (' +
|
|
3778
|
-
inputRange.length +
|
|
3779
|
-
' values provided) and outputRange (' +
|
|
3780
|
-
outputRange.length +
|
|
3781
|
-
' values provided) must have the same length');
|
|
3782
|
-
}
|
|
3783
|
-
const processedOutputRange = outputRange.map((c) => processColor(c));
|
|
3784
|
-
return interpolateColorsRGB(input, inputRange, processedOutputRange);
|
|
3785
|
-
};
|
|
3786
|
-
|
|
3787
|
-
let Root = null;
|
|
3788
|
-
let listeners = [];
|
|
3789
|
-
/**
|
|
3790
|
-
* @description This function registers the root component of the Remotion project
|
|
3791
|
-
* @see [Documentation](https://www.remotion.dev/docs/register-root)
|
|
3792
|
-
*/
|
|
3793
|
-
const registerRoot = (comp) => {
|
|
3794
|
-
if (!comp) {
|
|
3795
|
-
throw new Error(`You must pass a React component to registerRoot(), but ${JSON.stringify(comp)} was passed.`);
|
|
3796
|
-
}
|
|
3797
|
-
if (Root) {
|
|
3798
|
-
throw new Error('registerRoot() was called more than once.');
|
|
3799
|
-
}
|
|
3800
|
-
Root = comp;
|
|
3801
|
-
listeners.forEach((l) => {
|
|
3802
|
-
l(comp);
|
|
3803
|
-
});
|
|
3804
|
-
};
|
|
3805
|
-
const getRoot = () => {
|
|
3806
|
-
return Root;
|
|
3807
|
-
};
|
|
3808
|
-
const waitForRoot = (fn) => {
|
|
3809
|
-
if (Root) {
|
|
3810
|
-
fn(Root);
|
|
3811
|
-
return () => undefined;
|
|
3812
|
-
}
|
|
3813
|
-
listeners.push(fn);
|
|
3814
|
-
return () => {
|
|
3815
|
-
listeners = listeners.filter((l) => l !== fn);
|
|
3816
|
-
};
|
|
3817
|
-
};
|
|
3818
|
-
|
|
3819
|
-
const RemotionRoot = ({ children, numberOfAudioTags }) => {
|
|
3820
|
-
const [remotionRootId] = useState(() => String(random(null)));
|
|
3821
|
-
const [frame, setFrame] = useState({});
|
|
3822
|
-
const [playing, setPlaying] = useState(false);
|
|
3823
|
-
const imperativePlaying = useRef(false);
|
|
3824
|
-
const [fastRefreshes, setFastRefreshes] = useState(0);
|
|
3825
|
-
const [playbackRate, setPlaybackRate] = useState(1);
|
|
3826
|
-
const audioAndVideoTags = useRef([]);
|
|
3827
|
-
if (typeof window !== 'undefined') {
|
|
3828
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3829
|
-
useLayoutEffect(() => {
|
|
3830
|
-
window.remotion_setFrame = (f, composition) => {
|
|
3831
|
-
const id = delayRender(`Setting the current frame to ${f}`);
|
|
3832
|
-
setFrame((s) => ({
|
|
3833
|
-
...s,
|
|
3834
|
-
[composition]: f,
|
|
3835
|
-
}));
|
|
3836
|
-
requestAnimationFrame(() => continueRender(id));
|
|
3837
|
-
};
|
|
3838
|
-
window.remotion_isPlayer = false;
|
|
3839
|
-
}, []);
|
|
3840
|
-
}
|
|
3841
|
-
const timelineContextValue = useMemo(() => {
|
|
3842
|
-
return {
|
|
3843
|
-
frame,
|
|
3844
|
-
playing,
|
|
3845
|
-
imperativePlaying,
|
|
3846
|
-
rootId: remotionRootId,
|
|
3847
|
-
playbackRate,
|
|
3848
|
-
setPlaybackRate,
|
|
3849
|
-
audioAndVideoTags,
|
|
3850
|
-
};
|
|
3851
|
-
}, [frame, playbackRate, playing, remotionRootId]);
|
|
3852
|
-
const setTimelineContextValue = useMemo(() => {
|
|
3853
|
-
return {
|
|
3854
|
-
setFrame,
|
|
3855
|
-
setPlaying,
|
|
3856
|
-
};
|
|
3857
|
-
}, []);
|
|
3858
|
-
const nonceContext = useMemo(() => {
|
|
3859
|
-
let counter = 0;
|
|
3860
|
-
return {
|
|
3861
|
-
getNonce: () => counter++,
|
|
3862
|
-
fastRefreshes,
|
|
3863
|
-
};
|
|
3864
|
-
}, [fastRefreshes]);
|
|
3865
|
-
useEffect(() => {
|
|
3866
|
-
if (typeof __webpack_module__ !== 'undefined') {
|
|
3867
|
-
if (__webpack_module__.hot) {
|
|
3868
|
-
__webpack_module__.hot.addStatusHandler((status) => {
|
|
3869
|
-
if (status === 'idle') {
|
|
3870
|
-
setFastRefreshes((i) => i + 1);
|
|
3871
|
-
}
|
|
3872
|
-
});
|
|
3873
|
-
}
|
|
3926
|
+
if (matchers.hex4) {
|
|
3927
|
+
if ((match = matchers.hex4.exec(color))) {
|
|
3928
|
+
return (Number.parseInt(match[1] +
|
|
3929
|
+
match[1] + // r
|
|
3930
|
+
match[2] +
|
|
3931
|
+
match[2] + // g
|
|
3932
|
+
match[3] +
|
|
3933
|
+
match[3] + // b
|
|
3934
|
+
match[4] +
|
|
3935
|
+
match[4], // a
|
|
3936
|
+
16) >>> 0);
|
|
3874
3937
|
}
|
|
3875
|
-
}
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
return {};
|
|
3938
|
+
}
|
|
3939
|
+
if (matchers.hsl) {
|
|
3940
|
+
if ((match = matchers.hsl.exec(color))) {
|
|
3941
|
+
return ((hslToRgb(parse360(match[1]), // h
|
|
3942
|
+
parsePercentage(match[2]), // s
|
|
3943
|
+
parsePercentage(match[3])) |
|
|
3944
|
+
0x000000ff) >>> // a
|
|
3945
|
+
0);
|
|
3884
3946
|
}
|
|
3885
|
-
return { ...JSON.parse(param), NODE_ENV: process.env.NODE_ENV };
|
|
3886
3947
|
}
|
|
3887
|
-
if (
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3948
|
+
if (matchers.hsla) {
|
|
3949
|
+
if ((match = matchers.hsla.exec(color))) {
|
|
3950
|
+
return ((hslToRgb(parse360(match[1]), // h
|
|
3951
|
+
parsePercentage(match[2]), // s
|
|
3952
|
+
parsePercentage(match[3])) |
|
|
3953
|
+
parse1(match[4])) >>> // a
|
|
3954
|
+
0);
|
|
3955
|
+
}
|
|
3893
3956
|
}
|
|
3894
|
-
throw new Error(
|
|
3957
|
+
throw new Error(`invalid color string ${color} provided`);
|
|
3958
|
+
}
|
|
3959
|
+
const opacity = (c) => {
|
|
3960
|
+
return ((c >> 24) & 255) / 255;
|
|
3895
3961
|
};
|
|
3896
|
-
const
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3962
|
+
const red = (c) => {
|
|
3963
|
+
return (c >> 16) & 255;
|
|
3964
|
+
};
|
|
3965
|
+
const green = (c) => {
|
|
3966
|
+
return (c >> 8) & 255;
|
|
3967
|
+
};
|
|
3968
|
+
const blue = (c) => {
|
|
3969
|
+
return c & 255;
|
|
3970
|
+
};
|
|
3971
|
+
const rgbaColor = (r, g, b, alpha) => {
|
|
3972
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
3973
|
+
};
|
|
3974
|
+
function processColor(color) {
|
|
3975
|
+
const normalizedColor = normalizeColor(color);
|
|
3976
|
+
return ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
|
|
3977
|
+
}
|
|
3978
|
+
const interpolateColorsRGB = (value, inputRange, colors) => {
|
|
3979
|
+
const [r, g, b, a] = [red, green, blue, opacity].map((f) => {
|
|
3980
|
+
const unrounded = interpolate(value, inputRange, colors.map((c) => f(c)), {
|
|
3981
|
+
extrapolateLeft: 'clamp',
|
|
3982
|
+
extrapolateRight: 'clamp',
|
|
3983
|
+
});
|
|
3984
|
+
if (f === opacity) {
|
|
3985
|
+
return Number(unrounded.toFixed(3));
|
|
3986
|
+
}
|
|
3987
|
+
return Math.round(unrounded);
|
|
3988
|
+
});
|
|
3989
|
+
return rgbaColor(r, g, b, a);
|
|
3990
|
+
};
|
|
3991
|
+
/**
|
|
3992
|
+
* @description This function allows you to map a range of values to colors using a concise syntax.
|
|
3993
|
+
* @see [Documentation](https://www.remotion.dev/docs/interpolate-colors)
|
|
3994
|
+
*/
|
|
3995
|
+
const interpolateColors = (input, inputRange, outputRange) => {
|
|
3996
|
+
if (typeof input === 'undefined') {
|
|
3997
|
+
throw new TypeError('input can not be undefined');
|
|
3900
3998
|
}
|
|
3901
|
-
if (
|
|
3902
|
-
|
|
3999
|
+
if (typeof inputRange === 'undefined') {
|
|
4000
|
+
throw new TypeError('inputRange can not be undefined');
|
|
3903
4001
|
}
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
}
|
|
4002
|
+
if (typeof outputRange === 'undefined') {
|
|
4003
|
+
throw new TypeError('outputRange can not be undefined');
|
|
4004
|
+
}
|
|
4005
|
+
if (inputRange.length !== outputRange.length) {
|
|
4006
|
+
throw new TypeError('inputRange (' +
|
|
4007
|
+
inputRange.length +
|
|
4008
|
+
' values provided) and outputRange (' +
|
|
4009
|
+
outputRange.length +
|
|
4010
|
+
' values provided) must have the same length');
|
|
4011
|
+
}
|
|
4012
|
+
const processedOutputRange = outputRange.map((c) => processColor(c));
|
|
4013
|
+
return interpolateColorsRGB(input, inputRange, processedOutputRange);
|
|
3907
4014
|
};
|
|
3908
4015
|
|
|
3909
4016
|
const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
|
|
@@ -3927,157 +4034,6 @@ const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
|
|
|
3927
4034
|
}
|
|
3928
4035
|
};
|
|
3929
4036
|
|
|
3930
|
-
const WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
|
|
3931
|
-
/**
|
|
3932
|
-
* @description Watch for changes in a specific static file.
|
|
3933
|
-
* @param {string} fileName - The name of the static file to watch for changes.
|
|
3934
|
-
* @param {WatcherCallback} callback - A callback function to be called when the file changes.
|
|
3935
|
-
* @returns {{cancel: () => void}} A function that can be used to cancel the event listener.
|
|
3936
|
-
* @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)
|
|
3937
|
-
*/
|
|
3938
|
-
const watchStaticFile = (fileName, callback) => {
|
|
3939
|
-
// Check if function is called in Remotion Studio
|
|
3940
|
-
if (!getRemotionEnvironment().isStudio) {
|
|
3941
|
-
console.warn('The API is only available while using the Remotion Studio.');
|
|
3942
|
-
return { cancel: () => undefined };
|
|
3943
|
-
}
|
|
3944
|
-
let prevFileData = window.remotion_staticFiles.find((file) => file.name === fileName);
|
|
3945
|
-
// Check if the specified static file has updated or deleted
|
|
3946
|
-
const checkFile = (event) => {
|
|
3947
|
-
const staticFiles = event.detail.files;
|
|
3948
|
-
// Check for user specified file
|
|
3949
|
-
const newFileData = staticFiles.find((file) => file.name === fileName);
|
|
3950
|
-
if (!newFileData) {
|
|
3951
|
-
// File is deleted
|
|
3952
|
-
if (prevFileData !== undefined) {
|
|
3953
|
-
callback(null);
|
|
3954
|
-
}
|
|
3955
|
-
prevFileData = undefined;
|
|
3956
|
-
return;
|
|
3957
|
-
}
|
|
3958
|
-
if (prevFileData === undefined ||
|
|
3959
|
-
prevFileData.lastModified !== newFileData.lastModified) {
|
|
3960
|
-
callback(newFileData); // File is added or modified
|
|
3961
|
-
prevFileData = newFileData;
|
|
3962
|
-
}
|
|
3963
|
-
};
|
|
3964
|
-
window.addEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3965
|
-
const cancel = () => {
|
|
3966
|
-
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, checkFile);
|
|
3967
|
-
};
|
|
3968
|
-
return { cancel };
|
|
3969
|
-
};
|
|
3970
|
-
|
|
3971
|
-
function useRemotionContexts() {
|
|
3972
|
-
const compositionManagerCtx = React.useContext(CompositionManager);
|
|
3973
|
-
const timelineContext = React.useContext(TimelineContext);
|
|
3974
|
-
const setTimelineContext = React.useContext(SetTimelineContext);
|
|
3975
|
-
const sequenceContext = React.useContext(SequenceContext);
|
|
3976
|
-
const nonceContext = React.useContext(NonceContext);
|
|
3977
|
-
const canUseRemotionHooksContext = React.useContext(CanUseRemotionHooks);
|
|
3978
|
-
const nativeLayersContext = React.useContext(NativeLayersContext);
|
|
3979
|
-
const preloadContext = React.useContext(PreloadContext);
|
|
3980
|
-
const resolveCompositionContext = React.useContext(ResolveCompositionContext);
|
|
3981
|
-
const renderAssetManagerContext = React.useContext(RenderAssetManager);
|
|
3982
|
-
const sequenceManagerContext = React.useContext(SequenceManager);
|
|
3983
|
-
return useMemo(() => ({
|
|
3984
|
-
compositionManagerCtx,
|
|
3985
|
-
timelineContext,
|
|
3986
|
-
setTimelineContext,
|
|
3987
|
-
sequenceContext,
|
|
3988
|
-
nonceContext,
|
|
3989
|
-
canUseRemotionHooksContext,
|
|
3990
|
-
nativeLayersContext,
|
|
3991
|
-
preloadContext,
|
|
3992
|
-
resolveCompositionContext,
|
|
3993
|
-
renderAssetManagerContext,
|
|
3994
|
-
sequenceManagerContext,
|
|
3995
|
-
}), [
|
|
3996
|
-
compositionManagerCtx,
|
|
3997
|
-
nonceContext,
|
|
3998
|
-
sequenceContext,
|
|
3999
|
-
setTimelineContext,
|
|
4000
|
-
timelineContext,
|
|
4001
|
-
canUseRemotionHooksContext,
|
|
4002
|
-
nativeLayersContext,
|
|
4003
|
-
preloadContext,
|
|
4004
|
-
resolveCompositionContext,
|
|
4005
|
-
renderAssetManagerContext,
|
|
4006
|
-
sequenceManagerContext,
|
|
4007
|
-
]);
|
|
4008
|
-
}
|
|
4009
|
-
const RemotionContextProvider = (props) => {
|
|
4010
|
-
const { children, contexts } = props;
|
|
4011
|
-
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 }) }) }) }) }) }) }) }) }) }) }));
|
|
4012
|
-
};
|
|
4013
|
-
|
|
4014
|
-
// Mark them as Internals so use don't assume this is public
|
|
4015
|
-
// API and are less likely to use it
|
|
4016
|
-
const Internals = {
|
|
4017
|
-
useUnsafeVideoConfig,
|
|
4018
|
-
Timeline: TimelinePosition,
|
|
4019
|
-
CompositionManager,
|
|
4020
|
-
SequenceManager,
|
|
4021
|
-
RemotionRoot,
|
|
4022
|
-
useVideo,
|
|
4023
|
-
getRoot,
|
|
4024
|
-
useMediaVolumeState,
|
|
4025
|
-
useMediaMutedState,
|
|
4026
|
-
useLazyComponent,
|
|
4027
|
-
truthy,
|
|
4028
|
-
SequenceContext,
|
|
4029
|
-
useRemotionContexts,
|
|
4030
|
-
RemotionContextProvider,
|
|
4031
|
-
CSSUtils,
|
|
4032
|
-
setupEnvVariables,
|
|
4033
|
-
MediaVolumeContext,
|
|
4034
|
-
SetMediaVolumeContext,
|
|
4035
|
-
validateDurationInFrames,
|
|
4036
|
-
validateFps,
|
|
4037
|
-
validateDefaultAndInputProps,
|
|
4038
|
-
validateDimension,
|
|
4039
|
-
getRemotionEnvironment,
|
|
4040
|
-
SharedAudioContext,
|
|
4041
|
-
SharedAudioContextProvider,
|
|
4042
|
-
invalidCompositionErrorMessage,
|
|
4043
|
-
isCompositionIdValid,
|
|
4044
|
-
getPreviewDomElement,
|
|
4045
|
-
compositionsRef,
|
|
4046
|
-
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
4047
|
-
portalNode,
|
|
4048
|
-
waitForRoot,
|
|
4049
|
-
CanUseRemotionHooksProvider,
|
|
4050
|
-
CanUseRemotionHooks,
|
|
4051
|
-
PrefetchProvider,
|
|
4052
|
-
DurationsContextProvider,
|
|
4053
|
-
IsPlayerContextProvider,
|
|
4054
|
-
useIsPlayer,
|
|
4055
|
-
validateFrame,
|
|
4056
|
-
EditorPropsProvider,
|
|
4057
|
-
EditorPropsContext,
|
|
4058
|
-
usePreload,
|
|
4059
|
-
processColor,
|
|
4060
|
-
NonceContext,
|
|
4061
|
-
resolveVideoConfig,
|
|
4062
|
-
useResolvedVideoConfig,
|
|
4063
|
-
resolveCompositionsRef,
|
|
4064
|
-
ResolveCompositionConfig,
|
|
4065
|
-
REMOTION_STUDIO_CONTAINER_ELEMENT,
|
|
4066
|
-
RenderAssetManager,
|
|
4067
|
-
bundleName: 'bundle.js',
|
|
4068
|
-
bundleMapName: 'bundle.js.map',
|
|
4069
|
-
persistCurrentFrame,
|
|
4070
|
-
useTimelineSetFrame,
|
|
4071
|
-
serializeJSONWithDate,
|
|
4072
|
-
deserializeJSONWithCustomFields,
|
|
4073
|
-
FILE_TOKEN,
|
|
4074
|
-
DATE_TOKEN,
|
|
4075
|
-
NativeLayersProvider,
|
|
4076
|
-
ClipComposition,
|
|
4077
|
-
isIosSafari,
|
|
4078
|
-
WATCH_REMOTION_STATIC_FILES,
|
|
4079
|
-
};
|
|
4080
|
-
|
|
4081
4037
|
const flattenChildren = (children) => {
|
|
4082
4038
|
const childrenArray = React.Children.toArray(children);
|
|
4083
4039
|
return childrenArray.reduce((flatChildren, child) => {
|
|
@@ -4430,7 +4386,7 @@ const Still = (props) => {
|
|
|
4430
4386
|
return React.createElement((Composition), newProps);
|
|
4431
4387
|
};
|
|
4432
4388
|
|
|
4433
|
-
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false, toneFrequency, ...props }) => {
|
|
4389
|
+
const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate, src, muted, allowAmplificationDuringRender, transparent = false, toneFrequency, name, ...props }) => {
|
|
4434
4390
|
const absoluteFrame = useTimelinePosition();
|
|
4435
4391
|
const frame = useCurrentFrame();
|
|
4436
4392
|
const volumePropsFrame = useFrameForVolumeProp();
|
|
@@ -4530,7 +4486,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
4530
4486
|
const parentSequence = useContext(SequenceContext);
|
|
4531
4487
|
const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
|
|
4532
4488
|
// @ts-expect-error
|
|
4533
|
-
acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, ...nativeProps } = props;
|
|
4489
|
+
acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, ...nativeProps } = props;
|
|
4534
4490
|
if (typeof acceptableTimeShift !== 'undefined') {
|
|
4535
4491
|
throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
|
|
4536
4492
|
}
|
|
@@ -4544,6 +4500,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
4544
4500
|
mediaType: 'video',
|
|
4545
4501
|
src,
|
|
4546
4502
|
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
4503
|
+
displayName: name !== null && name !== void 0 ? name : null,
|
|
4547
4504
|
});
|
|
4548
4505
|
useSyncVolumeWithMediaTag({
|
|
4549
4506
|
volumePropFrame,
|
|
@@ -4620,11 +4577,24 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
4620
4577
|
current.removeEventListener('loadedmetadata', onLoadedMetadata);
|
|
4621
4578
|
};
|
|
4622
4579
|
}, [src]);
|
|
4623
|
-
|
|
4580
|
+
useEffect(() => {
|
|
4581
|
+
const { current } = videoRef;
|
|
4582
|
+
if (!current) {
|
|
4583
|
+
return;
|
|
4584
|
+
}
|
|
4624
4585
|
// Without this, on iOS Safari, the video cannot be seeked.
|
|
4625
4586
|
// if a seek is triggered before `loadedmetadata` is fired,
|
|
4626
4587
|
// the video will not seek, even if `loadedmetadata` is fired afterwards.
|
|
4627
|
-
|
|
4588
|
+
// Also, this needs to happen in a useEffect, because otherwise
|
|
4589
|
+
// the SSR props will be applied.
|
|
4590
|
+
if (isIosSafari()) {
|
|
4591
|
+
current.preload = 'metadata';
|
|
4592
|
+
}
|
|
4593
|
+
else {
|
|
4594
|
+
current.preload = 'auto';
|
|
4595
|
+
}
|
|
4596
|
+
}, []);
|
|
4597
|
+
return (jsx("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, ...nativeProps }));
|
|
4628
4598
|
};
|
|
4629
4599
|
// Copy types from forwardRef but not necessary to remove ref
|
|
4630
4600
|
const VideoForDevelopment = forwardRef(VideoForDevelopmentRefForwardingFunction);
|
|
@@ -4636,7 +4606,7 @@ const VideoForDevelopment = forwardRef(VideoForDevelopmentRefForwardingFunction)
|
|
|
4636
4606
|
const OffthreadVideo = (props) => {
|
|
4637
4607
|
// Should only destruct `startFrom` and `endAt` from props,
|
|
4638
4608
|
// rest gets drilled down
|
|
4639
|
-
const { startFrom, endAt, ...otherProps } = props;
|
|
4609
|
+
const { startFrom, endAt, name, ...otherProps } = props;
|
|
4640
4610
|
const environment = getRemotionEnvironment();
|
|
4641
4611
|
const onDuration = useCallback(() => undefined, []);
|
|
4642
4612
|
if (typeof props.src !== 'string') {
|
|
@@ -4649,7 +4619,7 @@ const OffthreadVideo = (props) => {
|
|
|
4649
4619
|
validateStartFromProps(startFrom, endAt);
|
|
4650
4620
|
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
4651
4621
|
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
4652
|
-
return (jsx(Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: jsx(OffthreadVideo, { ...otherProps }) }));
|
|
4622
|
+
return (jsx(Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, name: name, children: jsx(OffthreadVideo, { ...otherProps }) }));
|
|
4653
4623
|
}
|
|
4654
4624
|
validateMediaProps(props, 'Video');
|
|
4655
4625
|
if (environment.isRendering) {
|
|
@@ -4659,7 +4629,7 @@ const OffthreadVideo = (props) => {
|
|
|
4659
4629
|
return (jsx(VideoForDevelopment, { onDuration: onDuration, onlyWarnForMediaSeekingError: true, ...withoutTransparent }));
|
|
4660
4630
|
};
|
|
4661
4631
|
|
|
4662
|
-
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, ...props }, ref) => {
|
|
4632
|
+
const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAmplificationDuringRender, playbackRate, onDuration, toneFrequency, name, ...props }, ref) => {
|
|
4663
4633
|
const absoluteFrame = useTimelinePosition();
|
|
4664
4634
|
const frame = useCurrentFrame();
|
|
4665
4635
|
const volumePropsFrame = useFrameForVolumeProp();
|
|
@@ -4853,7 +4823,7 @@ const VideoForRendering = forwardRef(VideoForRenderingForwardFunction);
|
|
|
4853
4823
|
|
|
4854
4824
|
const VideoForwardingFunction = (props, ref) => {
|
|
4855
4825
|
var _a;
|
|
4856
|
-
const { startFrom, endAt, ...otherProps } = props;
|
|
4826
|
+
const { startFrom, endAt, name, ...otherProps } = props;
|
|
4857
4827
|
const { loop, ...propsOtherThanLoop } = props;
|
|
4858
4828
|
const { fps } = useVideoConfig();
|
|
4859
4829
|
const environment = getRemotionEnvironment();
|
|
@@ -4875,13 +4845,13 @@ const VideoForwardingFunction = (props, ref) => {
|
|
|
4875
4845
|
mediaDuration,
|
|
4876
4846
|
playbackRate: (_a = props.playbackRate) !== null && _a !== void 0 ? _a : 1,
|
|
4877
4847
|
startFrom,
|
|
4878
|
-
}), layout: "none", children: jsx(Video, { ...propsOtherThanLoop, ref: ref }) }));
|
|
4848
|
+
}), layout: "none", name: name, children: jsx(Video, { ...propsOtherThanLoop, ref: ref }) }));
|
|
4879
4849
|
}
|
|
4880
4850
|
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
|
|
4881
4851
|
validateStartFromProps(startFrom, endAt);
|
|
4882
4852
|
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
|
|
4883
4853
|
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
|
|
4884
|
-
return (jsx(Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: jsx(Video, { ...otherProps, ref: ref }) }));
|
|
4854
|
+
return (jsx(Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, name: name, children: jsx(Video, { ...otherProps, ref: ref }) }));
|
|
4885
4855
|
}
|
|
4886
4856
|
validateMediaProps(props, 'Video');
|
|
4887
4857
|
if (environment.isRendering) {
|