@remotion/player 4.0.390 → 4.0.391
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/Player.js +1 -0
- package/dist/cjs/Thumbnail.js +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/use-buffer-state-emitter.js +1 -1
- package/dist/cjs/use-frame-imperative.js +2 -4
- package/dist/cjs/use-playback.js +3 -4
- package/dist/cjs/use-player.d.ts +1 -0
- package/dist/cjs/use-player.js +22 -6
- package/dist/esm/index.mjs +106 -91
- package/package.json +3 -3
package/dist/cjs/Player.js
CHANGED
|
@@ -125,6 +125,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
125
125
|
const timelineContextValue = (0, react_1.useMemo)(() => {
|
|
126
126
|
return {
|
|
127
127
|
frame,
|
|
128
|
+
frameRef: { current: frame[SharedPlayerContext_js_1.PLAYER_COMP_ID] },
|
|
128
129
|
playing,
|
|
129
130
|
rootId,
|
|
130
131
|
playbackRate: currentPlaybackRate,
|
package/dist/cjs/Thumbnail.js
CHANGED
|
@@ -22,6 +22,7 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
22
22
|
const rootRef = (0, react_1.useRef)(null);
|
|
23
23
|
const timelineState = (0, react_1.useMemo)(() => {
|
|
24
24
|
const value = {
|
|
25
|
+
frameRef: { current: frameToDisplay },
|
|
25
26
|
playing: false,
|
|
26
27
|
frame: {
|
|
27
28
|
[SharedPlayerContext_js_1.PLAYER_COMP_ID]: frameToDisplay,
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare const PlayerInternals: {
|
|
|
31
31
|
hasPlayed: boolean;
|
|
32
32
|
isBuffering: () => boolean;
|
|
33
33
|
toggle: (e?: import("react").SyntheticEvent | PointerEvent) => void;
|
|
34
|
+
setFrameAndImperative: (newFrame: number, videoIdToSet: string) => void;
|
|
34
35
|
};
|
|
35
36
|
usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, browserMediaControlsBehavior, getCurrentFrame, }: {
|
|
36
37
|
loop: boolean;
|
|
@@ -8,7 +8,7 @@ const useBufferStateEmitter = (emitter) => {
|
|
|
8
8
|
if (!bufferManager) {
|
|
9
9
|
throw new Error('BufferingContextReact not found');
|
|
10
10
|
}
|
|
11
|
-
(0, react_1.
|
|
11
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
12
12
|
const clear1 = bufferManager.listenForBuffering(() => {
|
|
13
13
|
bufferManager.buffering.current = true;
|
|
14
14
|
emitter.dispatchWaiting({});
|
|
@@ -4,12 +4,10 @@ exports.useFrameImperative = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const useFrameImperative = () => {
|
|
7
|
-
const
|
|
8
|
-
const frameRef = (0, react_1.useRef)(frame);
|
|
9
|
-
frameRef.current = frame;
|
|
7
|
+
const frameRef = remotion_1.Internals.Timeline.useTimelineFrameRef();
|
|
10
8
|
const getCurrentFrame = (0, react_1.useCallback)(() => {
|
|
11
9
|
return frameRef.current;
|
|
12
|
-
}, []);
|
|
10
|
+
}, [frameRef]);
|
|
13
11
|
return getCurrentFrame;
|
|
14
12
|
};
|
|
15
13
|
exports.useFrameImperative = useFrameImperative;
|
package/dist/cjs/use-playback.js
CHANGED
|
@@ -11,8 +11,7 @@ const use_player_js_1 = require("./use-player.js");
|
|
|
11
11
|
const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, browserMediaControlsBehavior, getCurrentFrame, }) => {
|
|
12
12
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
13
13
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
14
|
-
const { playing, pause, emitter } = (0, use_player_js_1.usePlayer)();
|
|
15
|
-
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
14
|
+
const { playing, pause, emitter, setFrameAndImperative } = (0, use_player_js_1.usePlayer)();
|
|
16
15
|
// requestAnimationFrame() does not work if the tab is not active.
|
|
17
16
|
// This means that audio will keep playing even if it has ended.
|
|
18
17
|
// In that case, we use setTimeout() instead.
|
|
@@ -74,7 +73,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
74
73
|
framesAdvanced += framesToAdvance;
|
|
75
74
|
if (nextFrame !== getCurrentFrame() &&
|
|
76
75
|
(!hasEnded || moveToBeginningWhenEnded)) {
|
|
77
|
-
|
|
76
|
+
setFrameAndImperative(nextFrame, config.id);
|
|
78
77
|
}
|
|
79
78
|
if (hasEnded) {
|
|
80
79
|
stop();
|
|
@@ -124,7 +123,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
124
123
|
loop,
|
|
125
124
|
pause,
|
|
126
125
|
playing,
|
|
127
|
-
|
|
126
|
+
setFrameAndImperative,
|
|
128
127
|
emitter,
|
|
129
128
|
playbackRate,
|
|
130
129
|
inFrame,
|
package/dist/cjs/use-player.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ type UsePlayerMethods = {
|
|
|
16
16
|
hasPlayed: boolean;
|
|
17
17
|
isBuffering: () => boolean;
|
|
18
18
|
toggle: (e?: SyntheticEvent | PointerEvent) => void;
|
|
19
|
+
setFrameAndImperative: (newFrame: number, videoIdToSet: string) => void;
|
|
19
20
|
};
|
|
20
21
|
export declare const usePlayer: () => UsePlayerMethods;
|
|
21
22
|
export {};
|
package/dist/cjs/use-player.js
CHANGED
|
@@ -14,7 +14,7 @@ const usePlayer = () => {
|
|
|
14
14
|
const setTimelinePosition = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
15
15
|
const audioContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
16
16
|
const { audioAndVideoTags } = (0, react_1.useContext)(remotion_1.Internals.TimelineContext);
|
|
17
|
-
const frameRef =
|
|
17
|
+
const frameRef = remotion_1.Internals.Timeline.useTimelineFrameRef();
|
|
18
18
|
frameRef.current = frame;
|
|
19
19
|
const video = remotion_1.Internals.useVideo();
|
|
20
20
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
@@ -30,13 +30,16 @@ const usePlayer = () => {
|
|
|
30
30
|
throw new Error('Missing the buffering context. Most likely you have a Remotion version mismatch.');
|
|
31
31
|
}
|
|
32
32
|
const { buffering } = bufferingContext;
|
|
33
|
+
const setFrameAndImperative = (0, react_1.useCallback)((newFrame, videoIdToSet) => {
|
|
34
|
+
setTimelinePosition((c) => ({ ...c, [videoIdToSet]: newFrame }));
|
|
35
|
+
frameRef.current = newFrame;
|
|
36
|
+
}, [frameRef, setTimelinePosition]);
|
|
33
37
|
const seek = (0, react_1.useCallback)((newFrame) => {
|
|
34
38
|
if (video === null || video === void 0 ? void 0 : video.id) {
|
|
35
|
-
|
|
39
|
+
setFrameAndImperative(newFrame, video.id);
|
|
36
40
|
}
|
|
37
|
-
frameRef.current = newFrame;
|
|
38
41
|
emitter.dispatchSeek(newFrame);
|
|
39
|
-
}, [emitter,
|
|
42
|
+
}, [emitter, setFrameAndImperative, video === null || video === void 0 ? void 0 : video.id]);
|
|
40
43
|
const play = (0, react_1.useCallback)((e) => {
|
|
41
44
|
var _a;
|
|
42
45
|
if (imperativePlaying.current) {
|
|
@@ -70,6 +73,7 @@ const usePlayer = () => {
|
|
|
70
73
|
emitter,
|
|
71
74
|
seek,
|
|
72
75
|
audioAndVideoTags,
|
|
76
|
+
frameRef,
|
|
73
77
|
]);
|
|
74
78
|
const pause = (0, react_1.useCallback)(() => {
|
|
75
79
|
var _a;
|
|
@@ -93,7 +97,14 @@ const usePlayer = () => {
|
|
|
93
97
|
emitter.dispatchPause();
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
|
-
}, [
|
|
100
|
+
}, [
|
|
101
|
+
config,
|
|
102
|
+
emitter,
|
|
103
|
+
imperativePlaying,
|
|
104
|
+
setPlaying,
|
|
105
|
+
setTimelinePosition,
|
|
106
|
+
frameRef,
|
|
107
|
+
]);
|
|
97
108
|
const videoId = video === null || video === void 0 ? void 0 : video.id;
|
|
98
109
|
const frameBack = (0, react_1.useCallback)((frames) => {
|
|
99
110
|
if (!videoId) {
|
|
@@ -154,12 +165,15 @@ const usePlayer = () => {
|
|
|
154
165
|
pause,
|
|
155
166
|
seek,
|
|
156
167
|
isFirstFrame,
|
|
157
|
-
getCurrentFrame: () =>
|
|
168
|
+
getCurrentFrame: () => {
|
|
169
|
+
return frameRef.current;
|
|
170
|
+
},
|
|
158
171
|
isPlaying: () => imperativePlaying.current,
|
|
159
172
|
isBuffering: () => buffering.current,
|
|
160
173
|
pauseAndReturnToPlayStart,
|
|
161
174
|
hasPlayed,
|
|
162
175
|
toggle,
|
|
176
|
+
setFrameAndImperative,
|
|
163
177
|
};
|
|
164
178
|
}, [
|
|
165
179
|
buffering,
|
|
@@ -176,6 +190,8 @@ const usePlayer = () => {
|
|
|
176
190
|
playing,
|
|
177
191
|
seek,
|
|
178
192
|
toggle,
|
|
193
|
+
setFrameAndImperative,
|
|
194
|
+
frameRef,
|
|
179
195
|
]);
|
|
180
196
|
return returnValue;
|
|
181
197
|
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -335,7 +335,7 @@ var PlayerEventEmitterContext = React.createContext(undefined);
|
|
|
335
335
|
var ThumbnailEmitterContext = React.createContext(undefined);
|
|
336
336
|
|
|
337
337
|
// src/EmitterProvider.tsx
|
|
338
|
-
import { useContext as useContext2, useEffect
|
|
338
|
+
import { useContext as useContext2, useEffect, useState } from "react";
|
|
339
339
|
import { Internals as Internals3 } from "remotion";
|
|
340
340
|
|
|
341
341
|
// src/event-emitter.ts
|
|
@@ -452,14 +452,14 @@ class ThumbnailEmitter {
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
// src/use-buffer-state-emitter.ts
|
|
455
|
-
import { useContext,
|
|
455
|
+
import { useContext, useLayoutEffect } from "react";
|
|
456
456
|
import { Internals as Internals2 } from "remotion";
|
|
457
457
|
var useBufferStateEmitter = (emitter) => {
|
|
458
458
|
const bufferManager = useContext(Internals2.BufferingContextReact);
|
|
459
459
|
if (!bufferManager) {
|
|
460
460
|
throw new Error("BufferingContextReact not found");
|
|
461
461
|
}
|
|
462
|
-
|
|
462
|
+
useLayoutEffect(() => {
|
|
463
463
|
const clear1 = bufferManager.listenForBuffering(() => {
|
|
464
464
|
bufferManager.buffering.current = true;
|
|
465
465
|
emitter.dispatchWaiting({});
|
|
@@ -483,7 +483,7 @@ var PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
|
|
|
483
483
|
if (!bufferManager) {
|
|
484
484
|
throw new Error("BufferingContextReact not found");
|
|
485
485
|
}
|
|
486
|
-
|
|
486
|
+
useEffect(() => {
|
|
487
487
|
if (currentPlaybackRate) {
|
|
488
488
|
emitter.dispatchRateChange(currentPlaybackRate);
|
|
489
489
|
}
|
|
@@ -496,23 +496,21 @@ var PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
|
|
|
496
496
|
};
|
|
497
497
|
|
|
498
498
|
// src/use-frame-imperative.ts
|
|
499
|
-
import { useCallback
|
|
499
|
+
import { useCallback } from "react";
|
|
500
500
|
import { Internals as Internals4 } from "remotion";
|
|
501
501
|
var useFrameImperative = () => {
|
|
502
|
-
const
|
|
503
|
-
const frameRef = useRef(frame);
|
|
504
|
-
frameRef.current = frame;
|
|
502
|
+
const frameRef = Internals4.Timeline.useTimelineFrameRef();
|
|
505
503
|
const getCurrentFrame = useCallback(() => {
|
|
506
504
|
return frameRef.current;
|
|
507
|
-
}, []);
|
|
505
|
+
}, [frameRef]);
|
|
508
506
|
return getCurrentFrame;
|
|
509
507
|
};
|
|
510
508
|
|
|
511
509
|
// src/use-hover-state.ts
|
|
512
|
-
import { useEffect as
|
|
510
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
513
511
|
var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
|
|
514
512
|
const [hovered, setHovered] = useState2(false);
|
|
515
|
-
|
|
513
|
+
useEffect2(() => {
|
|
516
514
|
const { current } = ref;
|
|
517
515
|
if (!current) {
|
|
518
516
|
return;
|
|
@@ -552,25 +550,25 @@ var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
|
|
|
552
550
|
};
|
|
553
551
|
|
|
554
552
|
// src/use-playback.ts
|
|
555
|
-
import { useContext as useContext4, useEffect as
|
|
553
|
+
import { useContext as useContext4, useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
556
554
|
import { Internals as Internals6 } from "remotion";
|
|
557
555
|
|
|
558
556
|
// src/browser-mediasession.ts
|
|
559
|
-
import { useEffect as
|
|
557
|
+
import { useEffect as useEffect3 } from "react";
|
|
560
558
|
|
|
561
559
|
// src/use-player.ts
|
|
562
|
-
import { useCallback as useCallback2, useContext as useContext3, useMemo, useRef
|
|
560
|
+
import { useCallback as useCallback2, useContext as useContext3, useMemo, useRef, useState as useState3 } from "react";
|
|
563
561
|
import { Internals as Internals5 } from "remotion";
|
|
564
562
|
var usePlayer = () => {
|
|
565
563
|
const [playing, setPlaying, imperativePlaying] = Internals5.Timeline.usePlayingState();
|
|
566
564
|
const [hasPlayed, setHasPlayed] = useState3(false);
|
|
567
565
|
const frame = Internals5.Timeline.useTimelinePosition();
|
|
568
|
-
const playStart =
|
|
566
|
+
const playStart = useRef(frame);
|
|
569
567
|
const setFrame = Internals5.Timeline.useTimelineSetFrame();
|
|
570
568
|
const setTimelinePosition = Internals5.Timeline.useTimelineSetFrame();
|
|
571
569
|
const audioContext = useContext3(Internals5.SharedAudioContext);
|
|
572
570
|
const { audioAndVideoTags } = useContext3(Internals5.TimelineContext);
|
|
573
|
-
const frameRef =
|
|
571
|
+
const frameRef = Internals5.Timeline.useTimelineFrameRef();
|
|
574
572
|
frameRef.current = frame;
|
|
575
573
|
const video = Internals5.useVideo();
|
|
576
574
|
const config = Internals5.useUnsafeVideoConfig();
|
|
@@ -586,13 +584,16 @@ var usePlayer = () => {
|
|
|
586
584
|
throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
|
|
587
585
|
}
|
|
588
586
|
const { buffering } = bufferingContext;
|
|
587
|
+
const setFrameAndImperative = useCallback2((newFrame, videoIdToSet) => {
|
|
588
|
+
setTimelinePosition((c) => ({ ...c, [videoIdToSet]: newFrame }));
|
|
589
|
+
frameRef.current = newFrame;
|
|
590
|
+
}, [frameRef, setTimelinePosition]);
|
|
589
591
|
const seek = useCallback2((newFrame) => {
|
|
590
592
|
if (video?.id) {
|
|
591
|
-
|
|
593
|
+
setFrameAndImperative(newFrame, video.id);
|
|
592
594
|
}
|
|
593
|
-
frameRef.current = newFrame;
|
|
594
595
|
emitter.dispatchSeek(newFrame);
|
|
595
|
-
}, [emitter,
|
|
596
|
+
}, [emitter, setFrameAndImperative, video?.id]);
|
|
596
597
|
const play = useCallback2((e) => {
|
|
597
598
|
if (imperativePlaying.current) {
|
|
598
599
|
return;
|
|
@@ -617,7 +618,8 @@ var usePlayer = () => {
|
|
|
617
618
|
setPlaying,
|
|
618
619
|
emitter,
|
|
619
620
|
seek,
|
|
620
|
-
audioAndVideoTags
|
|
621
|
+
audioAndVideoTags,
|
|
622
|
+
frameRef
|
|
621
623
|
]);
|
|
622
624
|
const pause = useCallback2(() => {
|
|
623
625
|
if (imperativePlaying.current) {
|
|
@@ -640,7 +642,14 @@ var usePlayer = () => {
|
|
|
640
642
|
emitter.dispatchPause();
|
|
641
643
|
}
|
|
642
644
|
}
|
|
643
|
-
}, [
|
|
645
|
+
}, [
|
|
646
|
+
config,
|
|
647
|
+
emitter,
|
|
648
|
+
imperativePlaying,
|
|
649
|
+
setPlaying,
|
|
650
|
+
setTimelinePosition,
|
|
651
|
+
frameRef
|
|
652
|
+
]);
|
|
644
653
|
const videoId = video?.id;
|
|
645
654
|
const frameBack = useCallback2((frames) => {
|
|
646
655
|
if (!videoId) {
|
|
@@ -698,12 +707,15 @@ var usePlayer = () => {
|
|
|
698
707
|
pause,
|
|
699
708
|
seek,
|
|
700
709
|
isFirstFrame,
|
|
701
|
-
getCurrentFrame: () =>
|
|
710
|
+
getCurrentFrame: () => {
|
|
711
|
+
return frameRef.current;
|
|
712
|
+
},
|
|
702
713
|
isPlaying: () => imperativePlaying.current,
|
|
703
714
|
isBuffering: () => buffering.current,
|
|
704
715
|
pauseAndReturnToPlayStart,
|
|
705
716
|
hasPlayed,
|
|
706
|
-
toggle
|
|
717
|
+
toggle,
|
|
718
|
+
setFrameAndImperative
|
|
707
719
|
};
|
|
708
720
|
}, [
|
|
709
721
|
buffering,
|
|
@@ -719,7 +731,9 @@ var usePlayer = () => {
|
|
|
719
731
|
play,
|
|
720
732
|
playing,
|
|
721
733
|
seek,
|
|
722
|
-
toggle
|
|
734
|
+
toggle,
|
|
735
|
+
setFrameAndImperative,
|
|
736
|
+
frameRef
|
|
723
737
|
]);
|
|
724
738
|
return returnValue;
|
|
725
739
|
};
|
|
@@ -731,7 +745,7 @@ var useBrowserMediaSession = ({
|
|
|
731
745
|
playbackRate
|
|
732
746
|
}) => {
|
|
733
747
|
const { playing, pause, play, emitter, getCurrentFrame, seek } = usePlayer();
|
|
734
|
-
|
|
748
|
+
useEffect3(() => {
|
|
735
749
|
if (!navigator.mediaSession) {
|
|
736
750
|
return;
|
|
737
751
|
}
|
|
@@ -744,7 +758,7 @@ var useBrowserMediaSession = ({
|
|
|
744
758
|
navigator.mediaSession.playbackState = "paused";
|
|
745
759
|
}
|
|
746
760
|
}, [browserMediaControlsBehavior.mode, playing]);
|
|
747
|
-
|
|
761
|
+
useEffect3(() => {
|
|
748
762
|
if (!navigator.mediaSession) {
|
|
749
763
|
return;
|
|
750
764
|
}
|
|
@@ -774,7 +788,7 @@ var useBrowserMediaSession = ({
|
|
|
774
788
|
playbackRate,
|
|
775
789
|
videoConfig
|
|
776
790
|
]);
|
|
777
|
-
|
|
791
|
+
useEffect3(() => {
|
|
778
792
|
if (!navigator.mediaSession) {
|
|
779
793
|
return;
|
|
780
794
|
}
|
|
@@ -864,7 +878,7 @@ var calculateNextFrame = ({
|
|
|
864
878
|
};
|
|
865
879
|
|
|
866
880
|
// src/is-backgrounded.ts
|
|
867
|
-
import { useEffect as
|
|
881
|
+
import { useEffect as useEffect4, useRef as useRef2 } from "react";
|
|
868
882
|
var getIsBackgrounded = () => {
|
|
869
883
|
if (typeof document === "undefined") {
|
|
870
884
|
return false;
|
|
@@ -872,8 +886,8 @@ var getIsBackgrounded = () => {
|
|
|
872
886
|
return document.visibilityState === "hidden";
|
|
873
887
|
};
|
|
874
888
|
var useIsBackgrounded = () => {
|
|
875
|
-
const isBackgrounded =
|
|
876
|
-
|
|
889
|
+
const isBackgrounded = useRef2(getIsBackgrounded());
|
|
890
|
+
useEffect4(() => {
|
|
877
891
|
const onVisibilityChange = () => {
|
|
878
892
|
isBackgrounded.current = getIsBackgrounded();
|
|
879
893
|
};
|
|
@@ -897,10 +911,9 @@ var usePlayback = ({
|
|
|
897
911
|
}) => {
|
|
898
912
|
const config = Internals6.useUnsafeVideoConfig();
|
|
899
913
|
const frame = Internals6.Timeline.useTimelinePosition();
|
|
900
|
-
const { playing, pause, emitter } = usePlayer();
|
|
901
|
-
const setFrame = Internals6.Timeline.useTimelineSetFrame();
|
|
914
|
+
const { playing, pause, emitter, setFrameAndImperative } = usePlayer();
|
|
902
915
|
const isBackgroundedRef = useIsBackgrounded();
|
|
903
|
-
const lastTimeUpdateEvent =
|
|
916
|
+
const lastTimeUpdateEvent = useRef3(null);
|
|
904
917
|
const context = useContext4(Internals6.BufferingContextReact);
|
|
905
918
|
if (!context) {
|
|
906
919
|
throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
|
|
@@ -910,7 +923,7 @@ var usePlayback = ({
|
|
|
910
923
|
playbackRate,
|
|
911
924
|
videoConfig: config
|
|
912
925
|
});
|
|
913
|
-
|
|
926
|
+
useEffect5(() => {
|
|
914
927
|
if (!config) {
|
|
915
928
|
return;
|
|
916
929
|
}
|
|
@@ -954,7 +967,7 @@ var usePlayback = ({
|
|
|
954
967
|
});
|
|
955
968
|
framesAdvanced += framesToAdvance;
|
|
956
969
|
if (nextFrame !== getCurrentFrame() && (!hasEnded || moveToBeginningWhenEnded)) {
|
|
957
|
-
|
|
970
|
+
setFrameAndImperative(nextFrame, config.id);
|
|
958
971
|
}
|
|
959
972
|
if (hasEnded) {
|
|
960
973
|
stop();
|
|
@@ -1001,7 +1014,7 @@ var usePlayback = ({
|
|
|
1001
1014
|
loop,
|
|
1002
1015
|
pause,
|
|
1003
1016
|
playing,
|
|
1004
|
-
|
|
1017
|
+
setFrameAndImperative,
|
|
1005
1018
|
emitter,
|
|
1006
1019
|
playbackRate,
|
|
1007
1020
|
inFrame,
|
|
@@ -1011,7 +1024,7 @@ var usePlayback = ({
|
|
|
1011
1024
|
getCurrentFrame,
|
|
1012
1025
|
context
|
|
1013
1026
|
]);
|
|
1014
|
-
|
|
1027
|
+
useEffect5(() => {
|
|
1015
1028
|
const interval = setInterval(() => {
|
|
1016
1029
|
if (lastTimeUpdateEvent.current === getCurrentFrame()) {
|
|
1017
1030
|
return;
|
|
@@ -1021,13 +1034,13 @@ var usePlayback = ({
|
|
|
1021
1034
|
}, 250);
|
|
1022
1035
|
return () => clearInterval(interval);
|
|
1023
1036
|
}, [emitter, getCurrentFrame]);
|
|
1024
|
-
|
|
1037
|
+
useEffect5(() => {
|
|
1025
1038
|
emitter.dispatchFrameUpdate({ frame });
|
|
1026
1039
|
}, [emitter, frame]);
|
|
1027
1040
|
};
|
|
1028
1041
|
|
|
1029
1042
|
// src/utils/use-element-size.ts
|
|
1030
|
-
import { useCallback as useCallback3, useEffect as
|
|
1043
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useMemo as useMemo2, useState as useState4 } from "react";
|
|
1031
1044
|
var elementSizeHooks = [];
|
|
1032
1045
|
var updateAllElementsSizes = () => {
|
|
1033
1046
|
for (const listener of elementSizeHooks) {
|
|
@@ -1112,7 +1125,7 @@ var useElementSize = (ref, options) => {
|
|
|
1112
1125
|
};
|
|
1113
1126
|
});
|
|
1114
1127
|
}, [ref]);
|
|
1115
|
-
|
|
1128
|
+
useEffect6(() => {
|
|
1116
1129
|
if (!observer) {
|
|
1117
1130
|
return;
|
|
1118
1131
|
}
|
|
@@ -1126,7 +1139,7 @@ var useElementSize = (ref, options) => {
|
|
|
1126
1139
|
}
|
|
1127
1140
|
};
|
|
1128
1141
|
}, [observer, ref, updateSize]);
|
|
1129
|
-
|
|
1142
|
+
useEffect6(() => {
|
|
1130
1143
|
if (!options.triggerOnWindowResize) {
|
|
1131
1144
|
return;
|
|
1132
1145
|
}
|
|
@@ -1135,7 +1148,7 @@ var useElementSize = (ref, options) => {
|
|
|
1135
1148
|
window.removeEventListener("resize", updateSize);
|
|
1136
1149
|
};
|
|
1137
1150
|
}, [options.triggerOnWindowResize, updateSize]);
|
|
1138
|
-
|
|
1151
|
+
useEffect6(() => {
|
|
1139
1152
|
elementSizeHooks.push(updateSize);
|
|
1140
1153
|
return () => {
|
|
1141
1154
|
elementSizeHooks = elementSizeHooks.filter((e) => e !== updateSize);
|
|
@@ -1152,11 +1165,11 @@ var useElementSize = (ref, options) => {
|
|
|
1152
1165
|
// src/Player.tsx
|
|
1153
1166
|
import {
|
|
1154
1167
|
forwardRef as forwardRef2,
|
|
1155
|
-
useEffect as
|
|
1168
|
+
useEffect as useEffect13,
|
|
1156
1169
|
useImperativeHandle as useImperativeHandle2,
|
|
1157
|
-
useLayoutEffect,
|
|
1170
|
+
useLayoutEffect as useLayoutEffect2,
|
|
1158
1171
|
useMemo as useMemo14,
|
|
1159
|
-
useRef as
|
|
1172
|
+
useRef as useRef10,
|
|
1160
1173
|
useState as useState13
|
|
1161
1174
|
} from "react";
|
|
1162
1175
|
import { Composition, Internals as Internals15 } from "remotion";
|
|
@@ -1167,16 +1180,16 @@ import React10, {
|
|
|
1167
1180
|
forwardRef,
|
|
1168
1181
|
useCallback as useCallback11,
|
|
1169
1182
|
useContext as useContext6,
|
|
1170
|
-
useEffect as
|
|
1183
|
+
useEffect as useEffect12,
|
|
1171
1184
|
useImperativeHandle,
|
|
1172
1185
|
useMemo as useMemo12,
|
|
1173
|
-
useRef as
|
|
1186
|
+
useRef as useRef9,
|
|
1174
1187
|
useState as useState11
|
|
1175
1188
|
} from "react";
|
|
1176
1189
|
import { Internals as Internals11 } from "remotion";
|
|
1177
1190
|
|
|
1178
1191
|
// src/PlayerControls.tsx
|
|
1179
|
-
import { useCallback as useCallback8, useEffect as
|
|
1192
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useMemo as useMemo9, useRef as useRef7, useState as useState10 } from "react";
|
|
1180
1193
|
|
|
1181
1194
|
// src/DefaultPlayPauseButton.tsx
|
|
1182
1195
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -1193,7 +1206,7 @@ var DefaultPlayPauseButton = ({ playing, buffering }) => {
|
|
|
1193
1206
|
};
|
|
1194
1207
|
|
|
1195
1208
|
// src/MediaVolumeSlider.tsx
|
|
1196
|
-
import { useCallback as useCallback5, useMemo as useMemo4, useRef as
|
|
1209
|
+
import { useCallback as useCallback5, useMemo as useMemo4, useRef as useRef4, useState as useState6 } from "react";
|
|
1197
1210
|
import { Internals as Internals7 } from "remotion";
|
|
1198
1211
|
|
|
1199
1212
|
// src/render-volume-slider.tsx
|
|
@@ -1311,8 +1324,8 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1311
1324
|
const [mediaMuted, setMediaMuted] = Internals7.useMediaMutedState();
|
|
1312
1325
|
const [mediaVolume, setMediaVolume] = Internals7.useMediaVolumeState();
|
|
1313
1326
|
const [focused, setFocused] = useState6(false);
|
|
1314
|
-
const parentDivRef =
|
|
1315
|
-
const inputRef =
|
|
1327
|
+
const parentDivRef = useRef4(null);
|
|
1328
|
+
const inputRef = useRef4(null);
|
|
1316
1329
|
const hover = useHoverState(parentDivRef, false);
|
|
1317
1330
|
const onBlur = useCallback5(() => {
|
|
1318
1331
|
setTimeout(() => {
|
|
@@ -1400,18 +1413,18 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1400
1413
|
import {
|
|
1401
1414
|
useCallback as useCallback6,
|
|
1402
1415
|
useContext as useContext5,
|
|
1403
|
-
useEffect as
|
|
1416
|
+
useEffect as useEffect8,
|
|
1404
1417
|
useMemo as useMemo5,
|
|
1405
1418
|
useState as useState8
|
|
1406
1419
|
} from "react";
|
|
1407
1420
|
import { Internals as Internals8 } from "remotion";
|
|
1408
1421
|
|
|
1409
1422
|
// src/utils/use-component-visible.ts
|
|
1410
|
-
import { useEffect as
|
|
1423
|
+
import { useEffect as useEffect7, useRef as useRef5, useState as useState7 } from "react";
|
|
1411
1424
|
function useComponentVisible(initialIsVisible) {
|
|
1412
1425
|
const [isComponentVisible, setIsComponentVisible] = useState7(initialIsVisible);
|
|
1413
|
-
const ref =
|
|
1414
|
-
|
|
1426
|
+
const ref = useRef5(null);
|
|
1427
|
+
useEffect7(() => {
|
|
1415
1428
|
const handleClickOutside = (event) => {
|
|
1416
1429
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1417
1430
|
setIsComponentVisible(false);
|
|
@@ -1498,7 +1511,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
|
|
|
1498
1511
|
var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
1499
1512
|
const { setPlaybackRate, playbackRate } = useContext5(Internals8.TimelineContext);
|
|
1500
1513
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = useState8(playbackRate);
|
|
1501
|
-
|
|
1514
|
+
useEffect8(() => {
|
|
1502
1515
|
const listener = (e) => {
|
|
1503
1516
|
e.preventDefault();
|
|
1504
1517
|
if (e.key === "ArrowUp") {
|
|
@@ -1630,7 +1643,7 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
|
1630
1643
|
};
|
|
1631
1644
|
|
|
1632
1645
|
// src/PlayerSeekBar.tsx
|
|
1633
|
-
import { useCallback as useCallback7, useEffect as
|
|
1646
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef6, useState as useState9 } from "react";
|
|
1634
1647
|
import { Internals as Internals9, interpolate } from "remotion";
|
|
1635
1648
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1636
1649
|
var getFrameFromX = (clientX, durationInFrames, width) => {
|
|
@@ -1668,7 +1681,7 @@ var findBodyInWhichDivIsLocated = (div) => {
|
|
|
1668
1681
|
return current;
|
|
1669
1682
|
};
|
|
1670
1683
|
var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
|
|
1671
|
-
const containerRef =
|
|
1684
|
+
const containerRef = useRef6(null);
|
|
1672
1685
|
const barHovered = useHoverState(containerRef, false);
|
|
1673
1686
|
const size = useElementSize(containerRef, {
|
|
1674
1687
|
triggerOnWindowResize: true,
|
|
@@ -1719,7 +1732,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
|
|
|
1719
1732
|
}
|
|
1720
1733
|
onSeekEnd();
|
|
1721
1734
|
}, [dragging, onSeekEnd, pause, play]);
|
|
1722
|
-
|
|
1735
|
+
useEffect9(() => {
|
|
1723
1736
|
if (!dragging.dragging) {
|
|
1724
1737
|
return;
|
|
1725
1738
|
}
|
|
@@ -1959,7 +1972,7 @@ var Controls = ({
|
|
|
1959
1972
|
playing,
|
|
1960
1973
|
toggle
|
|
1961
1974
|
}) => {
|
|
1962
|
-
const playButtonRef =
|
|
1975
|
+
const playButtonRef = useRef7(null);
|
|
1963
1976
|
const [supportsFullscreen, setSupportsFullscreen] = useState10(false);
|
|
1964
1977
|
const hovered = useHoverState(containerRef, hideControlsWhenPointerDoesntMove);
|
|
1965
1978
|
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
|
|
@@ -1994,17 +2007,17 @@ var Controls = ({
|
|
|
1994
2007
|
opacity: Number(shouldShow)
|
|
1995
2008
|
};
|
|
1996
2009
|
}, [hovered, shouldShowInitially, playing, alwaysShowControls]);
|
|
1997
|
-
|
|
2010
|
+
useEffect10(() => {
|
|
1998
2011
|
if (playButtonRef.current && spaceKeyToPlayOrPause) {
|
|
1999
2012
|
playButtonRef.current.focus({
|
|
2000
2013
|
preventScroll: true
|
|
2001
2014
|
});
|
|
2002
2015
|
}
|
|
2003
2016
|
}, [playing, spaceKeyToPlayOrPause]);
|
|
2004
|
-
|
|
2017
|
+
useEffect10(() => {
|
|
2005
2018
|
setSupportsFullscreen((typeof document !== "undefined" && (document.fullscreenEnabled || document.webkitFullscreenEnabled)) ?? false);
|
|
2006
2019
|
}, []);
|
|
2007
|
-
|
|
2020
|
+
useEffect10(() => {
|
|
2008
2021
|
if (shouldShowInitially === false) {
|
|
2009
2022
|
return;
|
|
2010
2023
|
}
|
|
@@ -2033,8 +2046,8 @@ var Controls = ({
|
|
|
2033
2046
|
}
|
|
2034
2047
|
return null;
|
|
2035
2048
|
}, [showPlaybackRateControl]);
|
|
2036
|
-
const ref =
|
|
2037
|
-
const flexRef =
|
|
2049
|
+
const ref = useRef7(null);
|
|
2050
|
+
const flexRef = useRef7(null);
|
|
2038
2051
|
const onPointerDownIfContainer = useCallback8((e) => {
|
|
2039
2052
|
if (e.target === ref.current || e.target === flexRef.current) {
|
|
2040
2053
|
onPointerDown?.(e);
|
|
@@ -2174,7 +2187,7 @@ class ErrorBoundary extends React8.Component {
|
|
|
2174
2187
|
}
|
|
2175
2188
|
|
|
2176
2189
|
// src/license-blacklist.tsx
|
|
2177
|
-
import React9, { useEffect as
|
|
2190
|
+
import React9, { useEffect as useEffect11 } from "react";
|
|
2178
2191
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2179
2192
|
var getHashOfDomain = async () => {
|
|
2180
2193
|
if (typeof window === "undefined") {
|
|
@@ -2210,7 +2223,7 @@ var DOMAIN_BLACKLIST = [
|
|
|
2210
2223
|
var ran = false;
|
|
2211
2224
|
var RenderWarningIfBlacklist = () => {
|
|
2212
2225
|
const [unlicensed, setUnlicensed] = React9.useState(false);
|
|
2213
|
-
|
|
2226
|
+
useEffect11(() => {
|
|
2214
2227
|
if (ran) {
|
|
2215
2228
|
return;
|
|
2216
2229
|
}
|
|
@@ -2221,7 +2234,7 @@ var RenderWarningIfBlacklist = () => {
|
|
|
2221
2234
|
}
|
|
2222
2235
|
}).catch(() => {});
|
|
2223
2236
|
}, []);
|
|
2224
|
-
|
|
2237
|
+
useEffect11(() => {
|
|
2225
2238
|
if (!unlicensed) {
|
|
2226
2239
|
return;
|
|
2227
2240
|
}
|
|
@@ -2299,9 +2312,9 @@ var cancellablePromise = (promise) => {
|
|
|
2299
2312
|
var delay = (n) => new Promise((resolve) => setTimeout(resolve, n));
|
|
2300
2313
|
|
|
2301
2314
|
// src/utils/use-cancellable-promises.ts
|
|
2302
|
-
import { useCallback as useCallback9, useMemo as useMemo10, useRef as
|
|
2315
|
+
import { useCallback as useCallback9, useMemo as useMemo10, useRef as useRef8 } from "react";
|
|
2303
2316
|
var useCancellablePromises = () => {
|
|
2304
|
-
const pendingPromises =
|
|
2317
|
+
const pendingPromises = useRef8([]);
|
|
2305
2318
|
const appendPendingPromise = useCallback9((promise) => {
|
|
2306
2319
|
pendingPromises.current = [...pendingPromises.current, promise];
|
|
2307
2320
|
}, []);
|
|
@@ -2410,7 +2423,7 @@ var PlayerUI = ({
|
|
|
2410
2423
|
}, ref) => {
|
|
2411
2424
|
const config = Internals11.useUnsafeVideoConfig();
|
|
2412
2425
|
const video = Internals11.useVideo();
|
|
2413
|
-
const container =
|
|
2426
|
+
const container = useRef9(null);
|
|
2414
2427
|
const canvasSize = useElementSize(container, {
|
|
2415
2428
|
triggerOnWindowResize: false,
|
|
2416
2429
|
shouldApplyCssTransforms: false
|
|
@@ -2436,13 +2449,13 @@ var PlayerUI = ({
|
|
|
2436
2449
|
getCurrentFrame: player.getCurrentFrame,
|
|
2437
2450
|
browserMediaControlsBehavior
|
|
2438
2451
|
});
|
|
2439
|
-
|
|
2452
|
+
useEffect12(() => {
|
|
2440
2453
|
if (hasPausedToResume && !player.playing) {
|
|
2441
2454
|
setHasPausedToResume(false);
|
|
2442
2455
|
player.play();
|
|
2443
2456
|
}
|
|
2444
2457
|
}, [hasPausedToResume, player]);
|
|
2445
|
-
|
|
2458
|
+
useEffect12(() => {
|
|
2446
2459
|
const { current } = container;
|
|
2447
2460
|
if (!current) {
|
|
2448
2461
|
return;
|
|
@@ -2484,7 +2497,7 @@ var PlayerUI = ({
|
|
|
2484
2497
|
document.exitFullscreen();
|
|
2485
2498
|
}
|
|
2486
2499
|
}, []);
|
|
2487
|
-
|
|
2500
|
+
useEffect12(() => {
|
|
2488
2501
|
const { current } = container;
|
|
2489
2502
|
if (!current) {
|
|
2490
2503
|
return;
|
|
@@ -2521,8 +2534,8 @@ var PlayerUI = ({
|
|
|
2521
2534
|
});
|
|
2522
2535
|
}, [canvasSize, config]);
|
|
2523
2536
|
const scale = layout?.scale ?? 1;
|
|
2524
|
-
const initialScaleIgnored =
|
|
2525
|
-
|
|
2537
|
+
const initialScaleIgnored = useRef9(false);
|
|
2538
|
+
useEffect12(() => {
|
|
2526
2539
|
if (!initialScaleIgnored.current) {
|
|
2527
2540
|
initialScaleIgnored.current = true;
|
|
2528
2541
|
return;
|
|
@@ -2531,17 +2544,17 @@ var PlayerUI = ({
|
|
|
2531
2544
|
}, [player.emitter, scale]);
|
|
2532
2545
|
const { setMediaVolume, setMediaMuted } = useContext6(Internals11.SetMediaVolumeContext);
|
|
2533
2546
|
const { mediaMuted, mediaVolume } = useContext6(Internals11.MediaVolumeContext);
|
|
2534
|
-
|
|
2547
|
+
useEffect12(() => {
|
|
2535
2548
|
player.emitter.dispatchVolumeChange(mediaVolume);
|
|
2536
2549
|
}, [player.emitter, mediaVolume]);
|
|
2537
2550
|
const isMuted = mediaMuted || mediaVolume === 0;
|
|
2538
|
-
|
|
2551
|
+
useEffect12(() => {
|
|
2539
2552
|
player.emitter.dispatchMuteChange({
|
|
2540
2553
|
isMuted
|
|
2541
2554
|
});
|
|
2542
2555
|
}, [player.emitter, isMuted]);
|
|
2543
2556
|
const [showBufferIndicator, setShowBufferState] = useState11(false);
|
|
2544
|
-
|
|
2557
|
+
useEffect12(() => {
|
|
2545
2558
|
let timeout = null;
|
|
2546
2559
|
let stopped = false;
|
|
2547
2560
|
const onBuffer = () => {
|
|
@@ -2713,7 +2726,7 @@ var PlayerUI = ({
|
|
|
2713
2726
|
}
|
|
2714
2727
|
}, [exitFullscreen, isFullscreen, requestFullscreen]);
|
|
2715
2728
|
const { handlePointerDown, handleDoubleClick } = useClickPreventionOnDoubleClick(onSingleClick, onDoubleClick, doubleClickToFullscreen && allowFullscreen && supportsFullScreen);
|
|
2716
|
-
|
|
2729
|
+
useEffect12(() => {
|
|
2717
2730
|
if (shouldAutoplay) {
|
|
2718
2731
|
player.play();
|
|
2719
2732
|
setShouldAutoPlay(false);
|
|
@@ -3194,9 +3207,9 @@ var PlayerFn = ({
|
|
|
3194
3207
|
}));
|
|
3195
3208
|
const [playing, setPlaying] = useState13(false);
|
|
3196
3209
|
const [rootId] = useState13("player-comp");
|
|
3197
|
-
const rootRef =
|
|
3198
|
-
const audioAndVideoTags =
|
|
3199
|
-
const imperativePlaying =
|
|
3210
|
+
const rootRef = useRef10(null);
|
|
3211
|
+
const audioAndVideoTags = useRef10([]);
|
|
3212
|
+
const imperativePlaying = useRef10(false);
|
|
3200
3213
|
const [currentPlaybackRate, setCurrentPlaybackRate] = useState13(playbackRate);
|
|
3201
3214
|
if (typeof compositionHeight !== "number") {
|
|
3202
3215
|
throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
|
|
@@ -3245,7 +3258,7 @@ var PlayerFn = ({
|
|
|
3245
3258
|
throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${numberOfSharedAudioTags}' instead`);
|
|
3246
3259
|
}
|
|
3247
3260
|
validatePlaybackRate(currentPlaybackRate);
|
|
3248
|
-
|
|
3261
|
+
useEffect13(() => {
|
|
3249
3262
|
setCurrentPlaybackRate(playbackRate);
|
|
3250
3263
|
}, [playbackRate]);
|
|
3251
3264
|
useImperativeHandle2(ref, () => rootRef.current, []);
|
|
@@ -3260,6 +3273,7 @@ var PlayerFn = ({
|
|
|
3260
3273
|
const timelineContextValue = useMemo14(() => {
|
|
3261
3274
|
return {
|
|
3262
3275
|
frame,
|
|
3276
|
+
frameRef: { current: frame[PLAYER_COMP_ID] },
|
|
3263
3277
|
playing,
|
|
3264
3278
|
rootId,
|
|
3265
3279
|
playbackRate: currentPlaybackRate,
|
|
@@ -3277,7 +3291,7 @@ var PlayerFn = ({
|
|
|
3277
3291
|
};
|
|
3278
3292
|
}, [setFrame]);
|
|
3279
3293
|
if (typeof window !== "undefined") {
|
|
3280
|
-
|
|
3294
|
+
useLayoutEffect2(() => {
|
|
3281
3295
|
Internals15.CSSUtils.injectCSS(Internals15.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
|
|
3282
3296
|
}, [overrideInternalClassName]);
|
|
3283
3297
|
}
|
|
@@ -3356,9 +3370,9 @@ var Player = forward(PlayerFn);
|
|
|
3356
3370
|
import {
|
|
3357
3371
|
forwardRef as forwardRef4,
|
|
3358
3372
|
useImperativeHandle as useImperativeHandle4,
|
|
3359
|
-
useLayoutEffect as
|
|
3373
|
+
useLayoutEffect as useLayoutEffect3,
|
|
3360
3374
|
useMemo as useMemo17,
|
|
3361
|
-
useRef as
|
|
3375
|
+
useRef as useRef12,
|
|
3362
3376
|
useState as useState14
|
|
3363
3377
|
} from "react";
|
|
3364
3378
|
import { Internals as Internals17, random as random2 } from "remotion";
|
|
@@ -3370,7 +3384,7 @@ import React13, {
|
|
|
3370
3384
|
useCallback as useCallback13,
|
|
3371
3385
|
useImperativeHandle as useImperativeHandle3,
|
|
3372
3386
|
useMemo as useMemo16,
|
|
3373
|
-
useRef as
|
|
3387
|
+
useRef as useRef11
|
|
3374
3388
|
} from "react";
|
|
3375
3389
|
import { Internals as Internals16 } from "remotion";
|
|
3376
3390
|
|
|
@@ -3408,7 +3422,7 @@ var ThumbnailUI = ({
|
|
|
3408
3422
|
}, ref) => {
|
|
3409
3423
|
const config = Internals16.useUnsafeVideoConfig();
|
|
3410
3424
|
const video = Internals16.useVideo();
|
|
3411
|
-
const container =
|
|
3425
|
+
const container = useRef11(null);
|
|
3412
3426
|
const canvasSize = useElementSize(container, {
|
|
3413
3427
|
triggerOnWindowResize: false,
|
|
3414
3428
|
shouldApplyCssTransforms: false
|
|
@@ -3532,14 +3546,15 @@ var ThumbnailFn = ({
|
|
|
3532
3546
|
...componentProps
|
|
3533
3547
|
}, ref) => {
|
|
3534
3548
|
if (typeof window !== "undefined") {
|
|
3535
|
-
|
|
3549
|
+
useLayoutEffect3(() => {
|
|
3536
3550
|
window.remotion_isPlayer = true;
|
|
3537
3551
|
}, []);
|
|
3538
3552
|
}
|
|
3539
3553
|
const [thumbnailId] = useState14(() => String(random2(null)));
|
|
3540
|
-
const rootRef =
|
|
3554
|
+
const rootRef = useRef12(null);
|
|
3541
3555
|
const timelineState = useMemo17(() => {
|
|
3542
3556
|
const value = {
|
|
3557
|
+
frameRef: { current: frameToDisplay },
|
|
3543
3558
|
playing: false,
|
|
3544
3559
|
frame: {
|
|
3545
3560
|
[PLAYER_COMP_ID]: frameToDisplay
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.391",
|
|
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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"remotion": "4.0.
|
|
38
|
+
"remotion": "4.0.391"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": "19.2.3",
|
|
50
50
|
"webpack": "5.96.1",
|
|
51
51
|
"zod": "3.22.3",
|
|
52
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
52
|
+
"@remotion/eslint-config-internal": "4.0.391",
|
|
53
53
|
"eslint": "9.19.0"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|