@remotion/player 4.0.460 → 4.0.462
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/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const PlayerInternals: {
|
|
|
39
39
|
inFrame: number | null;
|
|
40
40
|
outFrame: number | null;
|
|
41
41
|
browserMediaControlsBehavior: import("./browser-mediasession.js").BrowserMediaControlsBehavior;
|
|
42
|
-
getCurrentFrame:
|
|
42
|
+
getCurrentFrame: () => number;
|
|
43
43
|
muted: boolean;
|
|
44
44
|
}) => void;
|
|
45
45
|
useElementSize: (ref: import("react").RefObject<HTMLElement | null>, options: {
|
|
@@ -67,5 +67,4 @@ export declare const PlayerInternals: {
|
|
|
67
67
|
BufferingIndicator: import("react").FC<{
|
|
68
68
|
readonly type: "player" | "studio";
|
|
69
69
|
}>;
|
|
70
|
-
useFrameImperative: () => import("./use-frame-imperative.js").GetCurrentFrame;
|
|
71
70
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -7,7 +7,6 @@ const calculate_scale_js_1 = require("./calculate-scale.js");
|
|
|
7
7
|
const emitter_context_js_1 = require("./emitter-context.js");
|
|
8
8
|
const EmitterProvider_js_1 = require("./EmitterProvider.js");
|
|
9
9
|
const event_emitter_js_1 = require("./event-emitter.js");
|
|
10
|
-
const use_frame_imperative_js_1 = require("./use-frame-imperative.js");
|
|
11
10
|
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
12
11
|
const use_playback_js_1 = require("./use-playback.js");
|
|
13
12
|
const use_player_js_1 = require("./use-player.js");
|
|
@@ -27,5 +26,4 @@ exports.PlayerInternals = {
|
|
|
27
26
|
updateAllElementsSizes: use_element_size_js_1.updateAllElementsSizes,
|
|
28
27
|
PlayerEmitterProvider: EmitterProvider_js_1.PlayerEmitterProvider,
|
|
29
28
|
BufferingIndicator: BufferingIndicator_js_1.BufferingIndicator,
|
|
30
|
-
useFrameImperative: use_frame_imperative_js_1.useFrameImperative,
|
|
31
29
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { BrowserMediaControlsBehavior } from './browser-mediasession.js';
|
|
2
|
-
import type { GetCurrentFrame } from './use-frame-imperative.js';
|
|
3
2
|
export declare const usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, browserMediaControlsBehavior, getCurrentFrame, muted, }: {
|
|
4
3
|
loop: boolean;
|
|
5
4
|
playbackRate: number;
|
|
@@ -7,6 +6,6 @@ export declare const usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnde
|
|
|
7
6
|
inFrame: number | null;
|
|
8
7
|
outFrame: number | null;
|
|
9
8
|
browserMediaControlsBehavior: BrowserMediaControlsBehavior;
|
|
10
|
-
getCurrentFrame:
|
|
9
|
+
getCurrentFrame: () => number;
|
|
11
10
|
muted: boolean;
|
|
12
11
|
}) => void;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
// src/_check-rsc.ts
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
if (typeof createContext !== "function") {
|
|
5
|
+
const err = [
|
|
6
|
+
'Remotion requires React.createContext, but it is "undefined".',
|
|
7
|
+
'If you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.',
|
|
8
|
+
"",
|
|
9
|
+
"Before:",
|
|
10
|
+
' import {Player} from "@remotion/player";',
|
|
11
|
+
"",
|
|
12
|
+
"After:",
|
|
13
|
+
' "use client";',
|
|
14
|
+
' import {Player} from "@remotion/player";'
|
|
15
|
+
];
|
|
16
|
+
throw new Error(err.join(`
|
|
17
|
+
`));
|
|
18
|
+
}
|
|
19
|
+
|
|
2
20
|
// src/icons.tsx
|
|
3
21
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
22
|
var ICON_SIZE = 25;
|
|
@@ -495,19 +513,6 @@ var PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
|
|
|
495
513
|
});
|
|
496
514
|
};
|
|
497
515
|
|
|
498
|
-
// src/use-frame-imperative.ts
|
|
499
|
-
import { useCallback, useRef } from "react";
|
|
500
|
-
import { Internals as Internals4 } from "remotion";
|
|
501
|
-
var useFrameImperative = () => {
|
|
502
|
-
const frame = Internals4.Timeline.useTimelinePosition();
|
|
503
|
-
const frameRef = useRef(frame);
|
|
504
|
-
frameRef.current = frame;
|
|
505
|
-
const getCurrentFrame = useCallback(() => {
|
|
506
|
-
return frameRef.current;
|
|
507
|
-
}, []);
|
|
508
|
-
return getCurrentFrame;
|
|
509
|
-
};
|
|
510
|
-
|
|
511
516
|
// src/use-hover-state.ts
|
|
512
517
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
513
518
|
var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
|
|
@@ -553,29 +558,29 @@ var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
|
|
|
553
558
|
|
|
554
559
|
// src/use-playback.ts
|
|
555
560
|
import { useLayoutEffect as useLayoutEffect2 } from "react";
|
|
556
|
-
import { useContext as useContext4, useEffect as useEffect5, useRef as
|
|
557
|
-
import { Internals as
|
|
561
|
+
import { useContext as useContext4, useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
562
|
+
import { Internals as Internals6 } from "remotion";
|
|
558
563
|
|
|
559
564
|
// src/browser-mediasession.ts
|
|
560
|
-
import { useEffect as useEffect3, useRef as
|
|
565
|
+
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
561
566
|
|
|
562
567
|
// src/use-player.ts
|
|
563
|
-
import { useCallback
|
|
564
|
-
import { Internals as
|
|
568
|
+
import { useCallback, useContext as useContext3, useMemo, useRef, useState as useState3 } from "react";
|
|
569
|
+
import { Internals as Internals4 } from "remotion";
|
|
565
570
|
var usePlayer = () => {
|
|
566
|
-
const [playing, setPlaying, imperativePlaying] =
|
|
571
|
+
const [playing, setPlaying, imperativePlaying] = Internals4.Timeline.usePlayingState();
|
|
567
572
|
const [hasPlayed, setHasPlayed] = useState3(false);
|
|
568
|
-
const frame =
|
|
569
|
-
const playStart =
|
|
570
|
-
const setFrame =
|
|
571
|
-
const setTimelinePosition =
|
|
572
|
-
const audioContext = useContext3(
|
|
573
|
-
const audioTagsContext = useContext3(
|
|
574
|
-
const { audioAndVideoTags } =
|
|
575
|
-
const frameRef =
|
|
573
|
+
const frame = Internals4.Timeline.useTimelinePosition();
|
|
574
|
+
const playStart = useRef(frame);
|
|
575
|
+
const setFrame = Internals4.Timeline.useTimelineSetFrame();
|
|
576
|
+
const setTimelinePosition = Internals4.Timeline.useTimelineSetFrame();
|
|
577
|
+
const audioContext = useContext3(Internals4.SharedAudioContext);
|
|
578
|
+
const audioTagsContext = useContext3(Internals4.SharedAudioTagsContext);
|
|
579
|
+
const { audioAndVideoTags } = Internals4.useTimelineContext();
|
|
580
|
+
const frameRef = useRef(frame);
|
|
576
581
|
frameRef.current = frame;
|
|
577
|
-
const video =
|
|
578
|
-
const config =
|
|
582
|
+
const video = Internals4.useVideo();
|
|
583
|
+
const config = Internals4.useUnsafeVideoConfig();
|
|
579
584
|
const emitter = useContext3(PlayerEventEmitterContext);
|
|
580
585
|
const lastFrame = (config?.durationInFrames ?? 1) - 1;
|
|
581
586
|
const isLastFrame = frame === lastFrame;
|
|
@@ -583,19 +588,19 @@ var usePlayer = () => {
|
|
|
583
588
|
if (!emitter) {
|
|
584
589
|
throw new TypeError("Expected Player event emitter context");
|
|
585
590
|
}
|
|
586
|
-
const bufferingContext = useContext3(
|
|
591
|
+
const bufferingContext = useContext3(Internals4.BufferingContextReact);
|
|
587
592
|
if (!bufferingContext) {
|
|
588
593
|
throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
|
|
589
594
|
}
|
|
590
595
|
const { buffering } = bufferingContext;
|
|
591
|
-
const seek =
|
|
596
|
+
const seek = useCallback((newFrame) => {
|
|
592
597
|
if (video?.id) {
|
|
593
598
|
setTimelinePosition((c) => ({ ...c, [video.id]: newFrame }));
|
|
594
599
|
}
|
|
595
600
|
frameRef.current = newFrame;
|
|
596
601
|
emitter.dispatchSeek(newFrame);
|
|
597
602
|
}, [emitter, setTimelinePosition, video?.id]);
|
|
598
|
-
const play =
|
|
603
|
+
const play = useCallback((e) => {
|
|
599
604
|
if (imperativePlaying.current) {
|
|
600
605
|
return;
|
|
601
606
|
}
|
|
@@ -622,7 +627,7 @@ var usePlayer = () => {
|
|
|
622
627
|
seek,
|
|
623
628
|
audioAndVideoTags
|
|
624
629
|
]);
|
|
625
|
-
const pause =
|
|
630
|
+
const pause = useCallback(() => {
|
|
626
631
|
if (imperativePlaying.current) {
|
|
627
632
|
imperativePlaying.current = false;
|
|
628
633
|
setPlaying(false);
|
|
@@ -630,7 +635,7 @@ var usePlayer = () => {
|
|
|
630
635
|
audioContext?.suspend();
|
|
631
636
|
}
|
|
632
637
|
}, [emitter, imperativePlaying, setPlaying, audioContext]);
|
|
633
|
-
const pauseAndReturnToPlayStart =
|
|
638
|
+
const pauseAndReturnToPlayStart = useCallback(() => {
|
|
634
639
|
if (imperativePlaying.current) {
|
|
635
640
|
imperativePlaying.current = false;
|
|
636
641
|
frameRef.current = playStart.current;
|
|
@@ -645,7 +650,7 @@ var usePlayer = () => {
|
|
|
645
650
|
}
|
|
646
651
|
}, [config, emitter, imperativePlaying, setPlaying, setTimelinePosition]);
|
|
647
652
|
const videoId = video?.id;
|
|
648
|
-
const frameBack =
|
|
653
|
+
const frameBack = useCallback((frames) => {
|
|
649
654
|
if (!videoId) {
|
|
650
655
|
return null;
|
|
651
656
|
}
|
|
@@ -664,7 +669,7 @@ var usePlayer = () => {
|
|
|
664
669
|
};
|
|
665
670
|
});
|
|
666
671
|
}, [imperativePlaying, setFrame, videoId]);
|
|
667
|
-
const frameForward =
|
|
672
|
+
const frameForward = useCallback((frames) => {
|
|
668
673
|
if (!videoId) {
|
|
669
674
|
return null;
|
|
670
675
|
}
|
|
@@ -683,20 +688,20 @@ var usePlayer = () => {
|
|
|
683
688
|
};
|
|
684
689
|
});
|
|
685
690
|
}, [videoId, imperativePlaying, lastFrame, setFrame]);
|
|
686
|
-
const toggle =
|
|
691
|
+
const toggle = useCallback((e) => {
|
|
687
692
|
if (imperativePlaying.current) {
|
|
688
693
|
pause();
|
|
689
694
|
} else {
|
|
690
695
|
play(e);
|
|
691
696
|
}
|
|
692
697
|
}, [imperativePlaying, pause, play]);
|
|
693
|
-
const isPlaying =
|
|
698
|
+
const isPlaying = useCallback(() => {
|
|
694
699
|
return imperativePlaying.current;
|
|
695
700
|
}, [imperativePlaying]);
|
|
696
|
-
const getCurrentFrame =
|
|
701
|
+
const getCurrentFrame = useCallback(() => {
|
|
697
702
|
return frameRef.current;
|
|
698
703
|
}, [frameRef]);
|
|
699
|
-
const isBuffering =
|
|
704
|
+
const isBuffering = useCallback(() => {
|
|
700
705
|
return buffering.current;
|
|
701
706
|
}, [buffering]);
|
|
702
707
|
const returnValue = useMemo(() => {
|
|
@@ -744,7 +749,7 @@ var useBrowserMediaSession = ({
|
|
|
744
749
|
playbackRate
|
|
745
750
|
}) => {
|
|
746
751
|
const { playing, pause, play, emitter, getCurrentFrame, seek } = usePlayer();
|
|
747
|
-
const hasEverPlayed =
|
|
752
|
+
const hasEverPlayed = useRef2(false);
|
|
748
753
|
useEffect3(() => {
|
|
749
754
|
if (playing) {
|
|
750
755
|
hasEverPlayed.current = true;
|
|
@@ -883,7 +888,7 @@ var calculateNextFrame = ({
|
|
|
883
888
|
};
|
|
884
889
|
|
|
885
890
|
// src/is-backgrounded.ts
|
|
886
|
-
import { useEffect as useEffect4, useRef as
|
|
891
|
+
import { useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
887
892
|
var getIsBackgrounded = () => {
|
|
888
893
|
if (typeof document === "undefined") {
|
|
889
894
|
return false;
|
|
@@ -891,7 +896,7 @@ var getIsBackgrounded = () => {
|
|
|
891
896
|
return document.visibilityState === "hidden";
|
|
892
897
|
};
|
|
893
898
|
var useIsBackgrounded = () => {
|
|
894
|
-
const isBackgrounded =
|
|
899
|
+
const isBackgrounded = useRef3(getIsBackgrounded());
|
|
895
900
|
useEffect4(() => {
|
|
896
901
|
const onVisibilityChange = () => {
|
|
897
902
|
isBackgrounded.current = getIsBackgrounded();
|
|
@@ -905,7 +910,7 @@ var useIsBackgrounded = () => {
|
|
|
905
910
|
};
|
|
906
911
|
|
|
907
912
|
// src/set-global-time-anchor.ts
|
|
908
|
-
import { Internals as
|
|
913
|
+
import { Internals as Internals5 } from "remotion";
|
|
909
914
|
var ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT = 0.1;
|
|
910
915
|
var setGlobalTimeAnchor = ({
|
|
911
916
|
audioContext,
|
|
@@ -923,7 +928,7 @@ var setGlobalTimeAnchor = ({
|
|
|
923
928
|
if (Math.abs(shift) < ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT + latency && !force) {
|
|
924
929
|
return false;
|
|
925
930
|
}
|
|
926
|
-
|
|
931
|
+
Internals5.Log.verbose({ logLevel, tag: "audio-scheduling" }, "Anchor " + (force ? "forcibly " : "") + "changed from %s to %s with shift %s", audioSyncAnchor.value, newAnchor, shift);
|
|
927
932
|
audioSyncAnchor.value = newAnchor;
|
|
928
933
|
return true;
|
|
929
934
|
};
|
|
@@ -939,15 +944,15 @@ var usePlayback = ({
|
|
|
939
944
|
getCurrentFrame,
|
|
940
945
|
muted
|
|
941
946
|
}) => {
|
|
942
|
-
const config =
|
|
943
|
-
const frame =
|
|
947
|
+
const config = Internals6.useUnsafeVideoConfig();
|
|
948
|
+
const frame = Internals6.Timeline.useTimelinePosition();
|
|
944
949
|
const { playing, pause, emitter, isPlaying } = usePlayer();
|
|
945
|
-
const setFrame =
|
|
946
|
-
const sharedAudioContext = useContext4(
|
|
947
|
-
const logLevel =
|
|
950
|
+
const setFrame = Internals6.Timeline.useTimelineSetFrame();
|
|
951
|
+
const sharedAudioContext = useContext4(Internals6.SharedAudioContext);
|
|
952
|
+
const logLevel = Internals6.useLogLevel();
|
|
948
953
|
const isBackgroundedRef = useIsBackgrounded();
|
|
949
|
-
const lastTimeUpdateTimestamp =
|
|
950
|
-
const context = useContext4(
|
|
954
|
+
const lastTimeUpdateTimestamp = useRef4(0);
|
|
955
|
+
const context = useContext4(Internals6.BufferingContextReact);
|
|
951
956
|
if (!context) {
|
|
952
957
|
throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
|
|
953
958
|
}
|
|
@@ -1161,7 +1166,7 @@ var usePlayback = ({
|
|
|
1161
1166
|
};
|
|
1162
1167
|
|
|
1163
1168
|
// src/utils/use-element-size.ts
|
|
1164
|
-
import { useCallback as
|
|
1169
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMemo2, useState as useState4 } from "react";
|
|
1165
1170
|
var elementSizeHooks = [];
|
|
1166
1171
|
var updateAllElementsSizes = () => {
|
|
1167
1172
|
for (const listener of elementSizeHooks) {
|
|
@@ -1221,7 +1226,7 @@ var useElementSize = (ref, options) => {
|
|
|
1221
1226
|
});
|
|
1222
1227
|
});
|
|
1223
1228
|
}, [options.shouldApplyCssTransforms]);
|
|
1224
|
-
const updateSize =
|
|
1229
|
+
const updateSize = useCallback2(() => {
|
|
1225
1230
|
if (!ref.current) {
|
|
1226
1231
|
return;
|
|
1227
1232
|
}
|
|
@@ -1291,10 +1296,10 @@ import {
|
|
|
1291
1296
|
useImperativeHandle as useImperativeHandle2,
|
|
1292
1297
|
useLayoutEffect as useLayoutEffect3,
|
|
1293
1298
|
useMemo as useMemo14,
|
|
1294
|
-
useRef as
|
|
1299
|
+
useRef as useRef11,
|
|
1295
1300
|
useState as useState13
|
|
1296
1301
|
} from "react";
|
|
1297
|
-
import { Composition, Internals as
|
|
1302
|
+
import { Composition, Internals as Internals15 } from "remotion";
|
|
1298
1303
|
|
|
1299
1304
|
// src/player-css-classname.ts
|
|
1300
1305
|
var playerCssClassname = (override) => {
|
|
@@ -1305,15 +1310,15 @@ var playerCssClassname = (override) => {
|
|
|
1305
1310
|
import React10, {
|
|
1306
1311
|
Suspense,
|
|
1307
1312
|
forwardRef,
|
|
1308
|
-
useCallback as
|
|
1313
|
+
useCallback as useCallback10,
|
|
1309
1314
|
useContext as useContext5,
|
|
1310
1315
|
useEffect as useEffect12,
|
|
1311
1316
|
useImperativeHandle,
|
|
1312
1317
|
useMemo as useMemo12,
|
|
1313
|
-
useRef as
|
|
1318
|
+
useRef as useRef10,
|
|
1314
1319
|
useState as useState11
|
|
1315
1320
|
} from "react";
|
|
1316
|
-
import { Internals as
|
|
1321
|
+
import { Internals as Internals11 } from "remotion";
|
|
1317
1322
|
|
|
1318
1323
|
// src/error-boundary.tsx
|
|
1319
1324
|
import React3 from "react";
|
|
@@ -1438,7 +1443,7 @@ var RenderWarningIfBlacklist = () => {
|
|
|
1438
1443
|
};
|
|
1439
1444
|
|
|
1440
1445
|
// src/PlayerControls.tsx
|
|
1441
|
-
import { useCallback as
|
|
1446
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo9, useRef as useRef8, useState as useState10 } from "react";
|
|
1442
1447
|
|
|
1443
1448
|
// src/DefaultPlayPauseButton.tsx
|
|
1444
1449
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
@@ -1455,11 +1460,11 @@ var DefaultPlayPauseButton = ({ playing, buffering }) => {
|
|
|
1455
1460
|
};
|
|
1456
1461
|
|
|
1457
1462
|
// src/MediaVolumeSlider.tsx
|
|
1458
|
-
import { useCallback as
|
|
1459
|
-
import { Internals as
|
|
1463
|
+
import { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
|
|
1464
|
+
import { Internals as Internals7 } from "remotion";
|
|
1460
1465
|
|
|
1461
1466
|
// src/render-volume-slider.tsx
|
|
1462
|
-
import React5, { useCallback as
|
|
1467
|
+
import React5, { useCallback as useCallback3, useMemo as useMemo3, useState as useState5 } from "react";
|
|
1463
1468
|
import { random } from "remotion";
|
|
1464
1469
|
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1465
1470
|
var KNOB_SIZE = 12;
|
|
@@ -1493,7 +1498,7 @@ var DefaultVolumeSlider = ({
|
|
|
1493
1498
|
}, [isVertical]);
|
|
1494
1499
|
const randomId = typeof React5.useId === "undefined" ? "volume-slider" : React5.useId();
|
|
1495
1500
|
const [randomClass] = useState5(() => `__remotion-volume-slider-${random(randomId)}`.replace(".", ""));
|
|
1496
|
-
const onVolumeChange =
|
|
1501
|
+
const onVolumeChange = useCallback3((e) => {
|
|
1497
1502
|
setVolume(parseFloat(e.target.value));
|
|
1498
1503
|
}, [setVolume]);
|
|
1499
1504
|
const inputStyle = useMemo3(() => {
|
|
@@ -1570,13 +1575,13 @@ var renderDefaultVolumeSlider = (props) => {
|
|
|
1570
1575
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1571
1576
|
var VOLUME_SLIDER_WIDTH = 100;
|
|
1572
1577
|
var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, renderVolumeSlider }) => {
|
|
1573
|
-
const [mediaMuted, setMediaMuted] =
|
|
1574
|
-
const [mediaVolume, setMediaVolume] =
|
|
1578
|
+
const [mediaMuted, setMediaMuted] = Internals7.useMediaMutedState();
|
|
1579
|
+
const [mediaVolume, setMediaVolume] = Internals7.useMediaVolumeState();
|
|
1575
1580
|
const [focused, setFocused] = useState6(false);
|
|
1576
|
-
const parentDivRef =
|
|
1577
|
-
const inputRef =
|
|
1581
|
+
const parentDivRef = useRef5(null);
|
|
1582
|
+
const inputRef = useRef5(null);
|
|
1578
1583
|
const hover = useHoverState(parentDivRef, false);
|
|
1579
|
-
const onBlur =
|
|
1584
|
+
const onBlur = useCallback4(() => {
|
|
1580
1585
|
setTimeout(() => {
|
|
1581
1586
|
if (inputRef.current && document.activeElement !== inputRef.current) {
|
|
1582
1587
|
setFocused(false);
|
|
@@ -1584,7 +1589,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1584
1589
|
}, 10);
|
|
1585
1590
|
}, []);
|
|
1586
1591
|
const isVolume0 = mediaVolume === 0;
|
|
1587
|
-
const onClick =
|
|
1592
|
+
const onClick = useCallback4(() => {
|
|
1588
1593
|
if (isVolume0) {
|
|
1589
1594
|
setMediaVolume(1);
|
|
1590
1595
|
setMediaMuted(false);
|
|
@@ -1615,7 +1620,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1615
1620
|
padding: 0
|
|
1616
1621
|
};
|
|
1617
1622
|
}, []);
|
|
1618
|
-
const renderDefaultMuteButton =
|
|
1623
|
+
const renderDefaultMuteButton = useCallback4(({ muted, volume }) => {
|
|
1619
1624
|
const isMutedOrZero = muted || volume === 0;
|
|
1620
1625
|
return /* @__PURE__ */ jsx8("button", {
|
|
1621
1626
|
"aria-label": isMutedOrZero ? "Unmute sound" : "Mute sound",
|
|
@@ -1632,7 +1637,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1632
1637
|
return renderMuteButton ? renderMuteButton({ muted: mediaMuted, volume: mediaVolume }) : renderDefaultMuteButton({ muted: mediaMuted, volume: mediaVolume });
|
|
1633
1638
|
}, [mediaMuted, mediaVolume, renderDefaultMuteButton, renderMuteButton]);
|
|
1634
1639
|
const volumeSlider = useMemo4(() => {
|
|
1635
|
-
return (focused || hover) && !mediaMuted && !
|
|
1640
|
+
return (focused || hover) && !mediaMuted && !Internals7.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
|
|
1636
1641
|
isVertical: displayVerticalVolumeSlider,
|
|
1637
1642
|
volume: mediaVolume,
|
|
1638
1643
|
onBlur: () => setFocused(false),
|
|
@@ -1659,14 +1664,14 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1659
1664
|
};
|
|
1660
1665
|
|
|
1661
1666
|
// src/PlaybackrateControl.tsx
|
|
1662
|
-
import { useCallback as
|
|
1663
|
-
import { Internals as
|
|
1667
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useMemo as useMemo5, useState as useState8 } from "react";
|
|
1668
|
+
import { Internals as Internals8 } from "remotion";
|
|
1664
1669
|
|
|
1665
1670
|
// src/utils/use-component-visible.ts
|
|
1666
|
-
import { useEffect as useEffect8, useRef as
|
|
1671
|
+
import { useEffect as useEffect8, useRef as useRef6, useState as useState7 } from "react";
|
|
1667
1672
|
function useComponentVisible(initialIsVisible) {
|
|
1668
1673
|
const [isComponentVisible, setIsComponentVisible] = useState7(initialIsVisible);
|
|
1669
|
-
const ref =
|
|
1674
|
+
const ref = useRef6(null);
|
|
1670
1675
|
useEffect8(() => {
|
|
1671
1676
|
const handleClickOutside = (event) => {
|
|
1672
1677
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
@@ -1716,16 +1721,16 @@ var formatPlaybackRate = (rate) => {
|
|
|
1716
1721
|
return str.includes(".") ? str : str + ".0";
|
|
1717
1722
|
};
|
|
1718
1723
|
var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }) => {
|
|
1719
|
-
const onClick =
|
|
1724
|
+
const onClick = useCallback5((e) => {
|
|
1720
1725
|
e.stopPropagation();
|
|
1721
1726
|
e.preventDefault();
|
|
1722
1727
|
onSelect(rate);
|
|
1723
1728
|
}, [onSelect, rate]);
|
|
1724
1729
|
const [hovered, setHovered] = useState8(false);
|
|
1725
|
-
const onMouseEnter =
|
|
1730
|
+
const onMouseEnter = useCallback5(() => {
|
|
1726
1731
|
setHovered(true);
|
|
1727
1732
|
}, []);
|
|
1728
|
-
const onMouseLeave =
|
|
1733
|
+
const onMouseLeave = useCallback5(() => {
|
|
1729
1734
|
setHovered(false);
|
|
1730
1735
|
}, []);
|
|
1731
1736
|
const isFocused = keyboardSelectedRate === rate;
|
|
@@ -1752,7 +1757,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
|
|
|
1752
1757
|
}, rate);
|
|
1753
1758
|
};
|
|
1754
1759
|
var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
1755
|
-
const { setPlaybackRate, playbackRate } =
|
|
1760
|
+
const { setPlaybackRate, playbackRate } = Internals8.usePlaybackRate();
|
|
1756
1761
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = useState8(playbackRate);
|
|
1757
1762
|
useEffect9(() => {
|
|
1758
1763
|
const listener = (e) => {
|
|
@@ -1792,7 +1797,7 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
|
1792
1797
|
setPlaybackRate,
|
|
1793
1798
|
setIsComponentVisible
|
|
1794
1799
|
]);
|
|
1795
|
-
const onSelect =
|
|
1800
|
+
const onSelect = useCallback5((rate) => {
|
|
1796
1801
|
setPlaybackRate(rate);
|
|
1797
1802
|
setIsComponentVisible(false);
|
|
1798
1803
|
}, [setIsComponentVisible, setPlaybackRate]);
|
|
@@ -1854,8 +1859,8 @@ var button = {
|
|
|
1854
1859
|
};
|
|
1855
1860
|
var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
1856
1861
|
const { ref, isComponentVisible, setIsComponentVisible } = useComponentVisible(false);
|
|
1857
|
-
const { playbackRate } =
|
|
1858
|
-
const onClick =
|
|
1862
|
+
const { playbackRate } = Internals8.usePlaybackRate();
|
|
1863
|
+
const onClick = useCallback5((e) => {
|
|
1859
1864
|
e.stopPropagation();
|
|
1860
1865
|
e.preventDefault();
|
|
1861
1866
|
setIsComponentVisible((prevIsComponentVisible) => !prevIsComponentVisible);
|
|
@@ -1886,8 +1891,8 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
|
1886
1891
|
};
|
|
1887
1892
|
|
|
1888
1893
|
// src/PlayerSeekBar.tsx
|
|
1889
|
-
import { useCallback as
|
|
1890
|
-
import { Internals as
|
|
1894
|
+
import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
|
|
1895
|
+
import { Internals as Internals9, interpolate } from "remotion";
|
|
1891
1896
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1892
1897
|
var getFrameFromX = (clientX, durationInFrames, width) => {
|
|
1893
1898
|
const pos = clientX;
|
|
@@ -1924,19 +1929,19 @@ var findBodyInWhichDivIsLocated = (div) => {
|
|
|
1924
1929
|
return current;
|
|
1925
1930
|
};
|
|
1926
1931
|
var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
|
|
1927
|
-
const containerRef =
|
|
1932
|
+
const containerRef = useRef7(null);
|
|
1928
1933
|
const barHovered = useHoverState(containerRef, false);
|
|
1929
1934
|
const size = useElementSize(containerRef, {
|
|
1930
1935
|
triggerOnWindowResize: true,
|
|
1931
1936
|
shouldApplyCssTransforms: true
|
|
1932
1937
|
});
|
|
1933
1938
|
const { seek, play, pause, playing } = usePlayer();
|
|
1934
|
-
const frame =
|
|
1939
|
+
const frame = Internals9.Timeline.useTimelinePosition();
|
|
1935
1940
|
const [dragging, setDragging] = useState9({
|
|
1936
1941
|
dragging: false
|
|
1937
1942
|
});
|
|
1938
1943
|
const width = size?.width ?? 0;
|
|
1939
|
-
const onPointerDown =
|
|
1944
|
+
const onPointerDown = useCallback6((e) => {
|
|
1940
1945
|
if (e.button !== 0) {
|
|
1941
1946
|
return;
|
|
1942
1947
|
}
|
|
@@ -1950,7 +1955,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
|
|
|
1950
1955
|
});
|
|
1951
1956
|
onSeekStart();
|
|
1952
1957
|
}, [durationInFrames, width, pause, seek, playing, onSeekStart]);
|
|
1953
|
-
const onPointerMove =
|
|
1958
|
+
const onPointerMove = useCallback6((e) => {
|
|
1954
1959
|
if (!size) {
|
|
1955
1960
|
throw new Error("Player has no size");
|
|
1956
1961
|
}
|
|
@@ -1961,7 +1966,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
|
|
|
1961
1966
|
const _frame = getFrameFromX(e.clientX - posLeft, durationInFrames, size.width);
|
|
1962
1967
|
seek(_frame);
|
|
1963
1968
|
}, [dragging.dragging, durationInFrames, seek, size]);
|
|
1964
|
-
const onPointerUp =
|
|
1969
|
+
const onPointerUp = useCallback6(() => {
|
|
1965
1970
|
setDragging({
|
|
1966
1971
|
dragging: false
|
|
1967
1972
|
});
|
|
@@ -2044,7 +2049,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
|
|
|
2044
2049
|
|
|
2045
2050
|
// src/PlayerTimeLabel.tsx
|
|
2046
2051
|
import { useMemo as useMemo7 } from "react";
|
|
2047
|
-
import { Internals as
|
|
2052
|
+
import { Internals as Internals10 } from "remotion";
|
|
2048
2053
|
|
|
2049
2054
|
// src/format-time.ts
|
|
2050
2055
|
var formatTime = (timeInSeconds) => {
|
|
@@ -2056,7 +2061,7 @@ var formatTime = (timeInSeconds) => {
|
|
|
2056
2061
|
// src/PlayerTimeLabel.tsx
|
|
2057
2062
|
import { jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2058
2063
|
var PlayerTimeLabel = ({ durationInFrames, maxTimeLabelWidth, fps }) => {
|
|
2059
|
-
const frame =
|
|
2064
|
+
const frame = Internals10.Timeline.useTimelinePosition();
|
|
2060
2065
|
const timeLabel = useMemo7(() => {
|
|
2061
2066
|
return {
|
|
2062
2067
|
color: "white",
|
|
@@ -2216,7 +2221,7 @@ var Controls = ({
|
|
|
2216
2221
|
toggle,
|
|
2217
2222
|
renderCustomControls
|
|
2218
2223
|
}) => {
|
|
2219
|
-
const playButtonRef =
|
|
2224
|
+
const playButtonRef = useRef8(null);
|
|
2220
2225
|
const [supportsFullscreen, setSupportsFullscreen] = useState10(false);
|
|
2221
2226
|
const hovered = useHoverState(containerRef, hideControlsWhenPointerDoesntMove);
|
|
2222
2227
|
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
|
|
@@ -2291,14 +2296,14 @@ var Controls = ({
|
|
|
2291
2296
|
return null;
|
|
2292
2297
|
}, [showPlaybackRateControl]);
|
|
2293
2298
|
const customControlsElement = renderCustomControls ? renderCustomControls() : null;
|
|
2294
|
-
const ref =
|
|
2295
|
-
const flexRef =
|
|
2296
|
-
const onPointerDownIfContainer =
|
|
2299
|
+
const ref = useRef8(null);
|
|
2300
|
+
const flexRef = useRef8(null);
|
|
2301
|
+
const onPointerDownIfContainer = useCallback7((e) => {
|
|
2297
2302
|
if (e.target === ref.current || e.target === flexRef.current) {
|
|
2298
2303
|
onPointerDown?.(e);
|
|
2299
2304
|
}
|
|
2300
2305
|
}, [onPointerDown]);
|
|
2301
|
-
const onDoubleClickIfContainer =
|
|
2306
|
+
const onDoubleClickIfContainer = useCallback7((e) => {
|
|
2302
2307
|
if (e.target === ref.current || e.target === flexRef.current) {
|
|
2303
2308
|
onDoubleClick?.(e);
|
|
2304
2309
|
}
|
|
@@ -2406,7 +2411,7 @@ var Controls = ({
|
|
|
2406
2411
|
var IS_NODE = typeof document === "undefined";
|
|
2407
2412
|
|
|
2408
2413
|
// src/utils/use-click-prevention-on-double-click.ts
|
|
2409
|
-
import { useCallback as
|
|
2414
|
+
import { useCallback as useCallback9, useMemo as useMemo11 } from "react";
|
|
2410
2415
|
|
|
2411
2416
|
// src/utils/cancellable-promise.ts
|
|
2412
2417
|
var cancellablePromise = (promise) => {
|
|
@@ -2434,16 +2439,16 @@ var cancellablePromise = (promise) => {
|
|
|
2434
2439
|
var delay = (n) => new Promise((resolve) => setTimeout(resolve, n));
|
|
2435
2440
|
|
|
2436
2441
|
// src/utils/use-cancellable-promises.ts
|
|
2437
|
-
import { useCallback as
|
|
2442
|
+
import { useCallback as useCallback8, useMemo as useMemo10, useRef as useRef9 } from "react";
|
|
2438
2443
|
var useCancellablePromises = () => {
|
|
2439
|
-
const pendingPromises =
|
|
2440
|
-
const appendPendingPromise =
|
|
2444
|
+
const pendingPromises = useRef9([]);
|
|
2445
|
+
const appendPendingPromise = useCallback8((promise) => {
|
|
2441
2446
|
pendingPromises.current = [...pendingPromises.current, promise];
|
|
2442
2447
|
}, []);
|
|
2443
|
-
const removePendingPromise =
|
|
2448
|
+
const removePendingPromise = useCallback8((promise) => {
|
|
2444
2449
|
pendingPromises.current = pendingPromises.current.filter((p) => p !== promise);
|
|
2445
2450
|
}, []);
|
|
2446
|
-
const clearPendingPromises =
|
|
2451
|
+
const clearPendingPromises = useCallback8(() => pendingPromises.current.map((p) => p.cancel()), []);
|
|
2447
2452
|
const api = useMemo10(() => ({
|
|
2448
2453
|
appendPendingPromise,
|
|
2449
2454
|
removePendingPromise,
|
|
@@ -2455,7 +2460,7 @@ var useCancellablePromises = () => {
|
|
|
2455
2460
|
// src/utils/use-click-prevention-on-double-click.ts
|
|
2456
2461
|
var useClickPreventionOnDoubleClick = (onClick, onDoubleClick, doubleClickToFullscreen) => {
|
|
2457
2462
|
const api = useCancellablePromises();
|
|
2458
|
-
const handleClick =
|
|
2463
|
+
const handleClick = useCallback9(async (e) => {
|
|
2459
2464
|
if (e instanceof PointerEvent ? e.pointerType === "touch" : e.nativeEvent.pointerType === "touch") {
|
|
2460
2465
|
onClick(e);
|
|
2461
2466
|
return;
|
|
@@ -2475,14 +2480,14 @@ var useClickPreventionOnDoubleClick = (onClick, onDoubleClick, doubleClickToFull
|
|
|
2475
2480
|
}
|
|
2476
2481
|
}
|
|
2477
2482
|
}, [api, onClick]);
|
|
2478
|
-
const handlePointerDown =
|
|
2483
|
+
const handlePointerDown = useCallback9(() => {
|
|
2479
2484
|
document.addEventListener("pointerup", (newEvt) => {
|
|
2480
2485
|
handleClick(newEvt);
|
|
2481
2486
|
}, {
|
|
2482
2487
|
once: true
|
|
2483
2488
|
});
|
|
2484
2489
|
}, [handleClick]);
|
|
2485
|
-
const handleDoubleClick =
|
|
2490
|
+
const handleDoubleClick = useCallback9(() => {
|
|
2486
2491
|
api.clearPendingPromises();
|
|
2487
2492
|
onDoubleClick();
|
|
2488
2493
|
}, [api, onDoubleClick]);
|
|
@@ -2544,9 +2549,9 @@ var PlayerUI = ({
|
|
|
2544
2549
|
overrideInternalClassName,
|
|
2545
2550
|
noSuspense
|
|
2546
2551
|
}, ref) => {
|
|
2547
|
-
const config =
|
|
2548
|
-
const video =
|
|
2549
|
-
const container =
|
|
2552
|
+
const config = Internals11.useUnsafeVideoConfig();
|
|
2553
|
+
const video = Internals11.useVideo();
|
|
2554
|
+
const container = useRef10(null);
|
|
2550
2555
|
const canvasSize = useElementSize(container, {
|
|
2551
2556
|
triggerOnWindowResize: false,
|
|
2552
2557
|
shouldApplyCssTransforms: false
|
|
@@ -2563,7 +2568,7 @@ var PlayerUI = ({
|
|
|
2563
2568
|
}, []);
|
|
2564
2569
|
const player = usePlayer();
|
|
2565
2570
|
const playerToggle = player.toggle;
|
|
2566
|
-
const { mediaMuted, mediaVolume } = useContext5(
|
|
2571
|
+
const { mediaMuted, mediaVolume } = useContext5(Internals11.MediaVolumeContext);
|
|
2567
2572
|
useEffect12(() => {
|
|
2568
2573
|
player.emitter.dispatchVolumeChange(mediaVolume);
|
|
2569
2574
|
}, [player.emitter, mediaVolume]);
|
|
@@ -2605,10 +2610,10 @@ var PlayerUI = ({
|
|
|
2605
2610
|
document.removeEventListener("webkitfullscreenchange", onFullscreenChange);
|
|
2606
2611
|
};
|
|
2607
2612
|
}, []);
|
|
2608
|
-
const toggle =
|
|
2613
|
+
const toggle = useCallback10((e) => {
|
|
2609
2614
|
playerToggle(e);
|
|
2610
2615
|
}, [playerToggle]);
|
|
2611
|
-
const requestFullscreen =
|
|
2616
|
+
const requestFullscreen = useCallback10(() => {
|
|
2612
2617
|
if (!allowFullscreen) {
|
|
2613
2618
|
throw new Error("allowFullscreen is false");
|
|
2614
2619
|
}
|
|
@@ -2624,7 +2629,7 @@ var PlayerUI = ({
|
|
|
2624
2629
|
container.current.requestFullscreen();
|
|
2625
2630
|
}
|
|
2626
2631
|
}, [allowFullscreen, supportsFullScreen]);
|
|
2627
|
-
const exitFullscreen =
|
|
2632
|
+
const exitFullscreen = useCallback10(() => {
|
|
2628
2633
|
if (document.webkitExitFullscreen) {
|
|
2629
2634
|
document.webkitExitFullscreen();
|
|
2630
2635
|
} else {
|
|
@@ -2668,7 +2673,7 @@ var PlayerUI = ({
|
|
|
2668
2673
|
});
|
|
2669
2674
|
}, [canvasSize, config]);
|
|
2670
2675
|
const scale = layout?.scale ?? 1;
|
|
2671
|
-
const initialScaleIgnored =
|
|
2676
|
+
const initialScaleIgnored = useRef10(false);
|
|
2672
2677
|
useEffect12(() => {
|
|
2673
2678
|
if (!initialScaleIgnored.current) {
|
|
2674
2679
|
initialScaleIgnored.current = true;
|
|
@@ -2676,7 +2681,7 @@ var PlayerUI = ({
|
|
|
2676
2681
|
}
|
|
2677
2682
|
player.emitter.dispatchScaleChange(scale);
|
|
2678
2683
|
}, [player.emitter, scale]);
|
|
2679
|
-
const { setMediaVolume, setMediaMuted } = useContext5(
|
|
2684
|
+
const { setMediaVolume, setMediaMuted } = useContext5(Internals11.SetMediaVolumeContext);
|
|
2680
2685
|
const [showBufferIndicator, setShowBufferState] = useState11(false);
|
|
2681
2686
|
useEffect12(() => {
|
|
2682
2687
|
let timeout = null;
|
|
@@ -2817,32 +2822,32 @@ var PlayerUI = ({
|
|
|
2817
2822
|
}, [config, layout, overflowVisible, scale]);
|
|
2818
2823
|
const playerPause = player.pause;
|
|
2819
2824
|
const playerDispatchError = player.emitter.dispatchError;
|
|
2820
|
-
const onError =
|
|
2825
|
+
const onError = useCallback10((error) => {
|
|
2821
2826
|
playerPause();
|
|
2822
2827
|
playerDispatchError(error);
|
|
2823
2828
|
}, [playerDispatchError, playerPause]);
|
|
2824
|
-
const onFullscreenButtonClick =
|
|
2829
|
+
const onFullscreenButtonClick = useCallback10((e) => {
|
|
2825
2830
|
e.stopPropagation();
|
|
2826
2831
|
requestFullscreen();
|
|
2827
2832
|
}, [requestFullscreen]);
|
|
2828
|
-
const onExitFullscreenButtonClick =
|
|
2833
|
+
const onExitFullscreenButtonClick = useCallback10((e) => {
|
|
2829
2834
|
e.stopPropagation();
|
|
2830
2835
|
exitFullscreen();
|
|
2831
2836
|
}, [exitFullscreen]);
|
|
2832
|
-
const onSingleClick =
|
|
2837
|
+
const onSingleClick = useCallback10((e) => {
|
|
2833
2838
|
const rightClick = e instanceof MouseEvent ? e.button === 2 : e.nativeEvent.button;
|
|
2834
2839
|
if (rightClick) {
|
|
2835
2840
|
return;
|
|
2836
2841
|
}
|
|
2837
2842
|
toggle(e);
|
|
2838
2843
|
}, [toggle]);
|
|
2839
|
-
const onSeekStart =
|
|
2844
|
+
const onSeekStart = useCallback10(() => {
|
|
2840
2845
|
setSeeking(true);
|
|
2841
2846
|
}, []);
|
|
2842
|
-
const onSeekEnd =
|
|
2847
|
+
const onSeekEnd = useCallback10(() => {
|
|
2843
2848
|
setSeeking(false);
|
|
2844
2849
|
}, []);
|
|
2845
|
-
const onDoubleClick =
|
|
2850
|
+
const onDoubleClick = useCallback10(() => {
|
|
2846
2851
|
if (isFullscreen) {
|
|
2847
2852
|
exitFullscreen();
|
|
2848
2853
|
} else {
|
|
@@ -2902,7 +2907,7 @@ var PlayerUI = ({
|
|
|
2902
2907
|
VideoComponent ? /* @__PURE__ */ jsx12(ErrorBoundary, {
|
|
2903
2908
|
onError,
|
|
2904
2909
|
errorFallback,
|
|
2905
|
-
children: /* @__PURE__ */ jsx12(
|
|
2910
|
+
children: /* @__PURE__ */ jsx12(Internals11.CurrentScaleContext.Provider, {
|
|
2906
2911
|
value: currentScale,
|
|
2907
2912
|
children: /* @__PURE__ */ jsx12(VideoComponent, {
|
|
2908
2913
|
...video?.props ?? {},
|
|
@@ -2984,11 +2989,11 @@ var PlayerUI = ({
|
|
|
2984
2989
|
var PlayerUI_default = forwardRef(PlayerUI);
|
|
2985
2990
|
|
|
2986
2991
|
// src/SharedPlayerContext.tsx
|
|
2987
|
-
import { useCallback as
|
|
2988
|
-
import { Internals as
|
|
2992
|
+
import { useCallback as useCallback11, useMemo as useMemo13, useState as useState12 } from "react";
|
|
2993
|
+
import { Internals as Internals13 } from "remotion";
|
|
2989
2994
|
|
|
2990
2995
|
// src/volume-persistence.ts
|
|
2991
|
-
import { Internals as
|
|
2996
|
+
import { Internals as Internals12 } from "remotion";
|
|
2992
2997
|
var DEFAULT_VOLUME_PERSISTENCE_KEY = "remotion.volumePreference";
|
|
2993
2998
|
var persistVolume = (volume, logLevel, volumePersistenceKey) => {
|
|
2994
2999
|
if (typeof window === "undefined") {
|
|
@@ -2997,7 +3002,7 @@ var persistVolume = (volume, logLevel, volumePersistenceKey) => {
|
|
|
2997
3002
|
try {
|
|
2998
3003
|
window.localStorage.setItem(volumePersistenceKey ?? DEFAULT_VOLUME_PERSISTENCE_KEY, String(volume));
|
|
2999
3004
|
} catch (e) {
|
|
3000
|
-
|
|
3005
|
+
Internals12.Log.error({ logLevel, tag: null }, "Could not persist volume", e);
|
|
3001
3006
|
}
|
|
3002
3007
|
};
|
|
3003
3008
|
var getPreferredVolume = (volumePersistenceKey) => {
|
|
@@ -3085,7 +3090,7 @@ var SharedPlayerContexts = ({
|
|
|
3085
3090
|
mediaVolume
|
|
3086
3091
|
};
|
|
3087
3092
|
}, [mediaMuted, mediaVolume]);
|
|
3088
|
-
const setMediaVolumeAndPersist =
|
|
3093
|
+
const setMediaVolumeAndPersist = useCallback11((vol) => {
|
|
3089
3094
|
setMediaVolume(vol);
|
|
3090
3095
|
if (persistVolumeToStorage) {
|
|
3091
3096
|
persistVolume(vol, logLevel, volumePersistenceKey ?? null);
|
|
@@ -3112,30 +3117,30 @@ var SharedPlayerContexts = ({
|
|
|
3112
3117
|
isReadOnlyStudio: false
|
|
3113
3118
|
};
|
|
3114
3119
|
}, []);
|
|
3115
|
-
return /* @__PURE__ */ jsx13(
|
|
3120
|
+
return /* @__PURE__ */ jsx13(Internals13.RemotionEnvironmentContext.Provider, {
|
|
3116
3121
|
value: env,
|
|
3117
|
-
children: /* @__PURE__ */ jsx13(
|
|
3122
|
+
children: /* @__PURE__ */ jsx13(Internals13.LogLevelContext.Provider, {
|
|
3118
3123
|
value: logLevelContext,
|
|
3119
|
-
children: /* @__PURE__ */ jsx13(
|
|
3120
|
-
children: /* @__PURE__ */ jsx13(
|
|
3124
|
+
children: /* @__PURE__ */ jsx13(Internals13.CanUseRemotionHooksProvider, {
|
|
3125
|
+
children: /* @__PURE__ */ jsx13(Internals13.AbsoluteTimeContext.Provider, {
|
|
3121
3126
|
value: timelineContext,
|
|
3122
|
-
children: /* @__PURE__ */ jsx13(
|
|
3127
|
+
children: /* @__PURE__ */ jsx13(Internals13.PlaybackRateContext.Provider, {
|
|
3123
3128
|
value: playbackRateContext,
|
|
3124
|
-
children: /* @__PURE__ */ jsx13(
|
|
3129
|
+
children: /* @__PURE__ */ jsx13(Internals13.TimelineContext.Provider, {
|
|
3125
3130
|
value: timelineContext,
|
|
3126
|
-
children: /* @__PURE__ */ jsx13(
|
|
3131
|
+
children: /* @__PURE__ */ jsx13(Internals13.CompositionManager.Provider, {
|
|
3127
3132
|
value: compositionManagerContext,
|
|
3128
|
-
children: /* @__PURE__ */ jsx13(
|
|
3129
|
-
children: /* @__PURE__ */ jsx13(
|
|
3130
|
-
children: /* @__PURE__ */ jsx13(
|
|
3133
|
+
children: /* @__PURE__ */ jsx13(Internals13.PrefetchProvider, {
|
|
3134
|
+
children: /* @__PURE__ */ jsx13(Internals13.DurationsContextProvider, {
|
|
3135
|
+
children: /* @__PURE__ */ jsx13(Internals13.MediaVolumeContext.Provider, {
|
|
3131
3136
|
value: mediaVolumeContextValue,
|
|
3132
|
-
children: /* @__PURE__ */ jsx13(
|
|
3137
|
+
children: /* @__PURE__ */ jsx13(Internals13.SetMediaVolumeContext.Provider, {
|
|
3133
3138
|
value: setMediaVolumeContextValue,
|
|
3134
|
-
children: /* @__PURE__ */ jsx13(
|
|
3135
|
-
children: /* @__PURE__ */ jsx13(
|
|
3139
|
+
children: /* @__PURE__ */ jsx13(Internals13.BufferingProvider, {
|
|
3140
|
+
children: /* @__PURE__ */ jsx13(Internals13.SharedAudioContextProvider, {
|
|
3136
3141
|
audioLatencyHint,
|
|
3137
3142
|
audioEnabled,
|
|
3138
|
-
children: /* @__PURE__ */ jsx13(
|
|
3143
|
+
children: /* @__PURE__ */ jsx13(Internals13.SharedAudioTagsContextProvider, {
|
|
3139
3144
|
numberOfAudioTags: numberOfSharedAudioTags,
|
|
3140
3145
|
children
|
|
3141
3146
|
})
|
|
@@ -3155,7 +3160,7 @@ var SharedPlayerContexts = ({
|
|
|
3155
3160
|
};
|
|
3156
3161
|
|
|
3157
3162
|
// src/use-remotion-license-acknowledge.ts
|
|
3158
|
-
import { Internals as
|
|
3163
|
+
import { Internals as Internals14 } from "remotion";
|
|
3159
3164
|
var warningShown = false;
|
|
3160
3165
|
var acknowledgeRemotionLicenseMessage = (acknowledge, logLevel) => {
|
|
3161
3166
|
if (acknowledge) {
|
|
@@ -3165,7 +3170,7 @@ var acknowledgeRemotionLicenseMessage = (acknowledge, logLevel) => {
|
|
|
3165
3170
|
return;
|
|
3166
3171
|
}
|
|
3167
3172
|
warningShown = true;
|
|
3168
|
-
|
|
3173
|
+
Internals14.Log.warn({ logLevel, tag: null }, "Note: Some companies are required to obtain a license to use Remotion. See: https://remotion.dev/license\nPass the `acknowledgeRemotionLicense` prop to `<Player />` function to make this message disappear.");
|
|
3169
3174
|
};
|
|
3170
3175
|
|
|
3171
3176
|
// src/utils/validate-in-out-frame.ts
|
|
@@ -3340,7 +3345,7 @@ var PlayerFn = ({
|
|
|
3340
3345
|
throw new TypeError(`'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.`);
|
|
3341
3346
|
}
|
|
3342
3347
|
useState13(() => acknowledgeRemotionLicenseMessage(Boolean(acknowledgeRemotionLicense), logLevel));
|
|
3343
|
-
const component =
|
|
3348
|
+
const component = Internals15.useLazyComponent({
|
|
3344
3349
|
compProps: componentProps,
|
|
3345
3350
|
componentName: "Player",
|
|
3346
3351
|
noSuspense: Boolean(noSuspense)
|
|
@@ -3351,9 +3356,9 @@ var PlayerFn = ({
|
|
|
3351
3356
|
}));
|
|
3352
3357
|
const [playing, setPlaying] = useState13(false);
|
|
3353
3358
|
const [rootId] = useState13("player-comp");
|
|
3354
|
-
const rootRef =
|
|
3355
|
-
const audioAndVideoTags =
|
|
3356
|
-
const imperativePlaying =
|
|
3359
|
+
const rootRef = useRef11(null);
|
|
3360
|
+
const audioAndVideoTags = useRef11([]);
|
|
3361
|
+
const imperativePlaying = useRef11(false);
|
|
3357
3362
|
const [currentPlaybackRate, setCurrentPlaybackRate] = useState13(playbackRate);
|
|
3358
3363
|
if (typeof compositionHeight !== "number") {
|
|
3359
3364
|
throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
|
|
@@ -3413,7 +3418,7 @@ var PlayerFn = ({
|
|
|
3413
3418
|
}, [playbackRate]);
|
|
3414
3419
|
useImperativeHandle2(ref, () => rootRef.current, []);
|
|
3415
3420
|
useState13(() => {
|
|
3416
|
-
|
|
3421
|
+
Internals15.playbackLogging({
|
|
3417
3422
|
logLevel,
|
|
3418
3423
|
message: `[player] Mounting <Player>. User agent = ${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
|
|
3419
3424
|
tag: "player",
|
|
@@ -3443,7 +3448,7 @@ var PlayerFn = ({
|
|
|
3443
3448
|
}, [setFrame]);
|
|
3444
3449
|
if (typeof window !== "undefined") {
|
|
3445
3450
|
useLayoutEffect3(() => {
|
|
3446
|
-
|
|
3451
|
+
Internals15.CSSUtils.injectCSS(Internals15.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
|
|
3447
3452
|
}, [overrideInternalClassName]);
|
|
3448
3453
|
}
|
|
3449
3454
|
const actualInputProps = useMemo14(() => inputProps ?? {}, [inputProps]);
|
|
@@ -3452,7 +3457,7 @@ var PlayerFn = ({
|
|
|
3452
3457
|
mode: "prevent-media-session"
|
|
3453
3458
|
};
|
|
3454
3459
|
}, [passedBrowserMediaControlsBehavior]);
|
|
3455
|
-
return /* @__PURE__ */ jsx14(
|
|
3460
|
+
return /* @__PURE__ */ jsx14(Internals15.IsPlayerContextProvider, {
|
|
3456
3461
|
children: /* @__PURE__ */ jsx14(SharedPlayerContexts, {
|
|
3457
3462
|
timelineContext: timelineContextValue,
|
|
3458
3463
|
playbackRateContext: playbackRateContextValue,
|
|
@@ -3469,7 +3474,7 @@ var PlayerFn = ({
|
|
|
3469
3474
|
initialVolume,
|
|
3470
3475
|
inputProps: actualInputProps,
|
|
3471
3476
|
audioEnabled: true,
|
|
3472
|
-
children: /* @__PURE__ */ jsx14(
|
|
3477
|
+
children: /* @__PURE__ */ jsx14(Internals15.SetTimelineContext.Provider, {
|
|
3473
3478
|
value: setTimelineContextValue,
|
|
3474
3479
|
children: /* @__PURE__ */ jsx14(PlayerEmitterProvider, {
|
|
3475
3480
|
currentPlaybackRate,
|
|
@@ -3527,21 +3532,21 @@ import {
|
|
|
3527
3532
|
useImperativeHandle as useImperativeHandle4,
|
|
3528
3533
|
useLayoutEffect as useLayoutEffect4,
|
|
3529
3534
|
useMemo as useMemo17,
|
|
3530
|
-
useRef as
|
|
3535
|
+
useRef as useRef13,
|
|
3531
3536
|
useState as useState14
|
|
3532
3537
|
} from "react";
|
|
3533
|
-
import { Internals as
|
|
3538
|
+
import { Internals as Internals17, random as random2 } from "remotion";
|
|
3534
3539
|
|
|
3535
3540
|
// src/ThumbnailUI.tsx
|
|
3536
3541
|
import React13, {
|
|
3537
3542
|
forwardRef as forwardRef3,
|
|
3538
3543
|
Suspense as Suspense2,
|
|
3539
|
-
useCallback as
|
|
3544
|
+
useCallback as useCallback12,
|
|
3540
3545
|
useImperativeHandle as useImperativeHandle3,
|
|
3541
3546
|
useMemo as useMemo16,
|
|
3542
|
-
useRef as
|
|
3547
|
+
useRef as useRef12
|
|
3543
3548
|
} from "react";
|
|
3544
|
-
import { Internals as
|
|
3549
|
+
import { Internals as Internals16 } from "remotion";
|
|
3545
3550
|
|
|
3546
3551
|
// src/use-thumbnail.ts
|
|
3547
3552
|
import { useContext as useContext6, useMemo as useMemo15 } from "react";
|
|
@@ -3575,9 +3580,9 @@ var ThumbnailUI = ({
|
|
|
3575
3580
|
noSuspense,
|
|
3576
3581
|
overrideInternalClassName
|
|
3577
3582
|
}, ref) => {
|
|
3578
|
-
const config =
|
|
3579
|
-
const video =
|
|
3580
|
-
const container =
|
|
3583
|
+
const config = Internals16.useUnsafeVideoConfig();
|
|
3584
|
+
const video = Internals16.useVideo();
|
|
3585
|
+
const container = useRef12(null);
|
|
3581
3586
|
const canvasSize = useElementSize(container, {
|
|
3582
3587
|
triggerOnWindowResize: false,
|
|
3583
3588
|
shouldApplyCssTransforms: false
|
|
@@ -3624,7 +3629,7 @@ var ThumbnailUI = ({
|
|
|
3624
3629
|
overflowVisible
|
|
3625
3630
|
});
|
|
3626
3631
|
}, [config, layout, overflowVisible, scale]);
|
|
3627
|
-
const onError =
|
|
3632
|
+
const onError = useCallback12((error) => {
|
|
3628
3633
|
thumbnail.emitter.dispatchError(error);
|
|
3629
3634
|
}, [thumbnail.emitter]);
|
|
3630
3635
|
const loadingMarkup = useMemo16(() => {
|
|
@@ -3651,7 +3656,7 @@ var ThumbnailUI = ({
|
|
|
3651
3656
|
children: VideoComponent ? /* @__PURE__ */ jsx15(ErrorBoundary, {
|
|
3652
3657
|
onError,
|
|
3653
3658
|
errorFallback,
|
|
3654
|
-
children: /* @__PURE__ */ jsx15(
|
|
3659
|
+
children: /* @__PURE__ */ jsx15(Internals16.CurrentScaleContext.Provider, {
|
|
3655
3660
|
value: currentScaleContext,
|
|
3656
3661
|
children: /* @__PURE__ */ jsx15(VideoComponent, {
|
|
3657
3662
|
...video?.props ?? {},
|
|
@@ -3706,7 +3711,7 @@ var ThumbnailFn = ({
|
|
|
3706
3711
|
}, []);
|
|
3707
3712
|
}
|
|
3708
3713
|
const [thumbnailId] = useState14(() => String(random2(null)));
|
|
3709
|
-
const rootRef =
|
|
3714
|
+
const rootRef = useRef13(null);
|
|
3710
3715
|
const timelineState = useMemo17(() => {
|
|
3711
3716
|
const value = {
|
|
3712
3717
|
playing: false,
|
|
@@ -3730,7 +3735,7 @@ var ThumbnailFn = ({
|
|
|
3730
3735
|
};
|
|
3731
3736
|
}, []);
|
|
3732
3737
|
useImperativeHandle4(ref, () => rootRef.current, []);
|
|
3733
|
-
const Component =
|
|
3738
|
+
const Component = Internals17.useLazyComponent({
|
|
3734
3739
|
compProps: componentProps,
|
|
3735
3740
|
componentName: "Thumbnail",
|
|
3736
3741
|
noSuspense: Boolean(noSuspense)
|
|
@@ -3739,7 +3744,7 @@ var ThumbnailFn = ({
|
|
|
3739
3744
|
const passedInputProps = useMemo17(() => {
|
|
3740
3745
|
return inputProps ?? {};
|
|
3741
3746
|
}, [inputProps]);
|
|
3742
|
-
return /* @__PURE__ */ jsx16(
|
|
3747
|
+
return /* @__PURE__ */ jsx16(Internals17.IsPlayerContextProvider, {
|
|
3743
3748
|
children: /* @__PURE__ */ jsx16(SharedPlayerContexts, {
|
|
3744
3749
|
timelineContext: timelineState,
|
|
3745
3750
|
playbackRateContext,
|
|
@@ -3785,8 +3790,7 @@ var PlayerInternals = {
|
|
|
3785
3790
|
useHoverState,
|
|
3786
3791
|
updateAllElementsSizes,
|
|
3787
3792
|
PlayerEmitterProvider,
|
|
3788
|
-
BufferingIndicator
|
|
3789
|
-
useFrameImperative
|
|
3793
|
+
BufferingIndicator
|
|
3790
3794
|
};
|
|
3791
3795
|
export {
|
|
3792
3796
|
Thumbnail,
|
package/package.json
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/player"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/player",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.462",
|
|
7
7
|
"description": "React component for embedding a Remotion preview into your app",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
10
10
|
"module": "dist/esm/index.mjs",
|
|
11
|
-
"sideEffects": false,
|
|
12
11
|
"scripts": {
|
|
13
12
|
"formatting": "oxfmt src --check",
|
|
14
13
|
"format": "oxfmt src",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
],
|
|
37
36
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"remotion": "4.0.
|
|
38
|
+
"remotion": "4.0.462"
|
|
40
39
|
},
|
|
41
40
|
"peerDependencies": {
|
|
42
41
|
"react": ">=16.8.0",
|
|
@@ -45,12 +44,12 @@
|
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"@testing-library/react": "16.1.0",
|
|
47
46
|
"@happy-dom/global-registrator": "14.5.1",
|
|
48
|
-
"csstype": "
|
|
47
|
+
"csstype": "3.2.3",
|
|
49
48
|
"react": "19.2.3",
|
|
50
49
|
"react-dom": "19.2.3",
|
|
51
50
|
"webpack": "5.105.0",
|
|
52
51
|
"zod": "4.3.6",
|
|
53
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
52
|
+
"@remotion/eslint-config-internal": "4.0.462",
|
|
54
53
|
"eslint": "9.19.0",
|
|
55
54
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
56
55
|
},
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFrameImperative = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const remotion_1 = require("remotion");
|
|
6
|
-
const useFrameImperative = () => {
|
|
7
|
-
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
8
|
-
const frameRef = (0, react_1.useRef)(frame);
|
|
9
|
-
frameRef.current = frame;
|
|
10
|
-
const getCurrentFrame = (0, react_1.useCallback)(() => {
|
|
11
|
-
return frameRef.current;
|
|
12
|
-
}, []);
|
|
13
|
-
return getCurrentFrame;
|
|
14
|
-
};
|
|
15
|
-
exports.useFrameImperative = useFrameImperative;
|