@remotion/player 4.0.391 → 4.0.393
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 +0 -1
- package/dist/cjs/Thumbnail.js +0 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/use-frame-imperative.js +4 -2
- package/dist/cjs/use-playback.js +4 -3
- package/dist/cjs/use-player.d.ts +0 -1
- package/dist/cjs/use-player.js +6 -22
- package/dist/esm/index.mjs +48 -63
- package/package.json +3 -3
package/dist/cjs/Player.js
CHANGED
|
@@ -125,7 +125,6 @@ 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] },
|
|
129
128
|
playing,
|
|
130
129
|
rootId,
|
|
131
130
|
playbackRate: currentPlaybackRate,
|
package/dist/cjs/Thumbnail.js
CHANGED
|
@@ -22,7 +22,6 @@ 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 },
|
|
26
25
|
playing: false,
|
|
27
26
|
frame: {
|
|
28
27
|
[SharedPlayerContext_js_1.PLAYER_COMP_ID]: frameToDisplay,
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ 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;
|
|
35
34
|
};
|
|
36
35
|
usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, browserMediaControlsBehavior, getCurrentFrame, }: {
|
|
37
36
|
loop: boolean;
|
|
@@ -4,10 +4,12 @@ exports.useFrameImperative = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const useFrameImperative = () => {
|
|
7
|
-
const
|
|
7
|
+
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
8
|
+
const frameRef = (0, react_1.useRef)(frame);
|
|
9
|
+
frameRef.current = frame;
|
|
8
10
|
const getCurrentFrame = (0, react_1.useCallback)(() => {
|
|
9
11
|
return frameRef.current;
|
|
10
|
-
}, [
|
|
12
|
+
}, []);
|
|
11
13
|
return getCurrentFrame;
|
|
12
14
|
};
|
|
13
15
|
exports.useFrameImperative = useFrameImperative;
|
package/dist/cjs/use-playback.js
CHANGED
|
@@ -11,7 +11,8 @@ 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
|
|
14
|
+
const { playing, pause, emitter } = (0, use_player_js_1.usePlayer)();
|
|
15
|
+
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
15
16
|
// requestAnimationFrame() does not work if the tab is not active.
|
|
16
17
|
// This means that audio will keep playing even if it has ended.
|
|
17
18
|
// In that case, we use setTimeout() instead.
|
|
@@ -73,7 +74,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
73
74
|
framesAdvanced += framesToAdvance;
|
|
74
75
|
if (nextFrame !== getCurrentFrame() &&
|
|
75
76
|
(!hasEnded || moveToBeginningWhenEnded)) {
|
|
76
|
-
|
|
77
|
+
setFrame((c) => ({ ...c, [config.id]: nextFrame }));
|
|
77
78
|
}
|
|
78
79
|
if (hasEnded) {
|
|
79
80
|
stop();
|
|
@@ -123,7 +124,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
123
124
|
loop,
|
|
124
125
|
pause,
|
|
125
126
|
playing,
|
|
126
|
-
|
|
127
|
+
setFrame,
|
|
127
128
|
emitter,
|
|
128
129
|
playbackRate,
|
|
129
130
|
inFrame,
|
package/dist/cjs/use-player.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ type UsePlayerMethods = {
|
|
|
16
16
|
hasPlayed: boolean;
|
|
17
17
|
isBuffering: () => boolean;
|
|
18
18
|
toggle: (e?: SyntheticEvent | PointerEvent) => void;
|
|
19
|
-
setFrameAndImperative: (newFrame: number, videoIdToSet: string) => void;
|
|
20
19
|
};
|
|
21
20
|
export declare const usePlayer: () => UsePlayerMethods;
|
|
22
21
|
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 = (0, react_1.useRef)(frame);
|
|
18
18
|
frameRef.current = frame;
|
|
19
19
|
const video = remotion_1.Internals.useVideo();
|
|
20
20
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
@@ -30,16 +30,13 @@ 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]);
|
|
37
33
|
const seek = (0, react_1.useCallback)((newFrame) => {
|
|
38
34
|
if (video === null || video === void 0 ? void 0 : video.id) {
|
|
39
|
-
|
|
35
|
+
setTimelinePosition((c) => ({ ...c, [video.id]: newFrame }));
|
|
40
36
|
}
|
|
37
|
+
frameRef.current = newFrame;
|
|
41
38
|
emitter.dispatchSeek(newFrame);
|
|
42
|
-
}, [emitter,
|
|
39
|
+
}, [emitter, setTimelinePosition, video === null || video === void 0 ? void 0 : video.id]);
|
|
43
40
|
const play = (0, react_1.useCallback)((e) => {
|
|
44
41
|
var _a;
|
|
45
42
|
if (imperativePlaying.current) {
|
|
@@ -73,7 +70,6 @@ const usePlayer = () => {
|
|
|
73
70
|
emitter,
|
|
74
71
|
seek,
|
|
75
72
|
audioAndVideoTags,
|
|
76
|
-
frameRef,
|
|
77
73
|
]);
|
|
78
74
|
const pause = (0, react_1.useCallback)(() => {
|
|
79
75
|
var _a;
|
|
@@ -97,14 +93,7 @@ const usePlayer = () => {
|
|
|
97
93
|
emitter.dispatchPause();
|
|
98
94
|
}
|
|
99
95
|
}
|
|
100
|
-
}, [
|
|
101
|
-
config,
|
|
102
|
-
emitter,
|
|
103
|
-
imperativePlaying,
|
|
104
|
-
setPlaying,
|
|
105
|
-
setTimelinePosition,
|
|
106
|
-
frameRef,
|
|
107
|
-
]);
|
|
96
|
+
}, [config, emitter, imperativePlaying, setPlaying, setTimelinePosition]);
|
|
108
97
|
const videoId = video === null || video === void 0 ? void 0 : video.id;
|
|
109
98
|
const frameBack = (0, react_1.useCallback)((frames) => {
|
|
110
99
|
if (!videoId) {
|
|
@@ -165,15 +154,12 @@ const usePlayer = () => {
|
|
|
165
154
|
pause,
|
|
166
155
|
seek,
|
|
167
156
|
isFirstFrame,
|
|
168
|
-
getCurrentFrame: () =>
|
|
169
|
-
return frameRef.current;
|
|
170
|
-
},
|
|
157
|
+
getCurrentFrame: () => frameRef.current,
|
|
171
158
|
isPlaying: () => imperativePlaying.current,
|
|
172
159
|
isBuffering: () => buffering.current,
|
|
173
160
|
pauseAndReturnToPlayStart,
|
|
174
161
|
hasPlayed,
|
|
175
162
|
toggle,
|
|
176
|
-
setFrameAndImperative,
|
|
177
163
|
};
|
|
178
164
|
}, [
|
|
179
165
|
buffering,
|
|
@@ -190,8 +176,6 @@ const usePlayer = () => {
|
|
|
190
176
|
playing,
|
|
191
177
|
seek,
|
|
192
178
|
toggle,
|
|
193
|
-
setFrameAndImperative,
|
|
194
|
-
frameRef,
|
|
195
179
|
]);
|
|
196
180
|
return returnValue;
|
|
197
181
|
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -496,13 +496,15 @@ var PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
|
|
|
496
496
|
};
|
|
497
497
|
|
|
498
498
|
// src/use-frame-imperative.ts
|
|
499
|
-
import { useCallback } from "react";
|
|
499
|
+
import { useCallback, useRef } from "react";
|
|
500
500
|
import { Internals as Internals4 } from "remotion";
|
|
501
501
|
var useFrameImperative = () => {
|
|
502
|
-
const
|
|
502
|
+
const frame = Internals4.Timeline.useTimelinePosition();
|
|
503
|
+
const frameRef = useRef(frame);
|
|
504
|
+
frameRef.current = frame;
|
|
503
505
|
const getCurrentFrame = useCallback(() => {
|
|
504
506
|
return frameRef.current;
|
|
505
|
-
}, [
|
|
507
|
+
}, []);
|
|
506
508
|
return getCurrentFrame;
|
|
507
509
|
};
|
|
508
510
|
|
|
@@ -550,25 +552,25 @@ var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
|
|
|
550
552
|
};
|
|
551
553
|
|
|
552
554
|
// src/use-playback.ts
|
|
553
|
-
import { useContext as useContext4, useEffect as useEffect5, useRef as
|
|
555
|
+
import { useContext as useContext4, useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
554
556
|
import { Internals as Internals6 } from "remotion";
|
|
555
557
|
|
|
556
558
|
// src/browser-mediasession.ts
|
|
557
559
|
import { useEffect as useEffect3 } from "react";
|
|
558
560
|
|
|
559
561
|
// src/use-player.ts
|
|
560
|
-
import { useCallback as useCallback2, useContext as useContext3, useMemo, useRef, useState as useState3 } from "react";
|
|
562
|
+
import { useCallback as useCallback2, useContext as useContext3, useMemo, useRef as useRef2, useState as useState3 } from "react";
|
|
561
563
|
import { Internals as Internals5 } from "remotion";
|
|
562
564
|
var usePlayer = () => {
|
|
563
565
|
const [playing, setPlaying, imperativePlaying] = Internals5.Timeline.usePlayingState();
|
|
564
566
|
const [hasPlayed, setHasPlayed] = useState3(false);
|
|
565
567
|
const frame = Internals5.Timeline.useTimelinePosition();
|
|
566
|
-
const playStart =
|
|
568
|
+
const playStart = useRef2(frame);
|
|
567
569
|
const setFrame = Internals5.Timeline.useTimelineSetFrame();
|
|
568
570
|
const setTimelinePosition = Internals5.Timeline.useTimelineSetFrame();
|
|
569
571
|
const audioContext = useContext3(Internals5.SharedAudioContext);
|
|
570
572
|
const { audioAndVideoTags } = useContext3(Internals5.TimelineContext);
|
|
571
|
-
const frameRef =
|
|
573
|
+
const frameRef = useRef2(frame);
|
|
572
574
|
frameRef.current = frame;
|
|
573
575
|
const video = Internals5.useVideo();
|
|
574
576
|
const config = Internals5.useUnsafeVideoConfig();
|
|
@@ -584,16 +586,13 @@ var usePlayer = () => {
|
|
|
584
586
|
throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
|
|
585
587
|
}
|
|
586
588
|
const { buffering } = bufferingContext;
|
|
587
|
-
const setFrameAndImperative = useCallback2((newFrame, videoIdToSet) => {
|
|
588
|
-
setTimelinePosition((c) => ({ ...c, [videoIdToSet]: newFrame }));
|
|
589
|
-
frameRef.current = newFrame;
|
|
590
|
-
}, [frameRef, setTimelinePosition]);
|
|
591
589
|
const seek = useCallback2((newFrame) => {
|
|
592
590
|
if (video?.id) {
|
|
593
|
-
|
|
591
|
+
setTimelinePosition((c) => ({ ...c, [video.id]: newFrame }));
|
|
594
592
|
}
|
|
593
|
+
frameRef.current = newFrame;
|
|
595
594
|
emitter.dispatchSeek(newFrame);
|
|
596
|
-
}, [emitter,
|
|
595
|
+
}, [emitter, setTimelinePosition, video?.id]);
|
|
597
596
|
const play = useCallback2((e) => {
|
|
598
597
|
if (imperativePlaying.current) {
|
|
599
598
|
return;
|
|
@@ -618,8 +617,7 @@ var usePlayer = () => {
|
|
|
618
617
|
setPlaying,
|
|
619
618
|
emitter,
|
|
620
619
|
seek,
|
|
621
|
-
audioAndVideoTags
|
|
622
|
-
frameRef
|
|
620
|
+
audioAndVideoTags
|
|
623
621
|
]);
|
|
624
622
|
const pause = useCallback2(() => {
|
|
625
623
|
if (imperativePlaying.current) {
|
|
@@ -642,14 +640,7 @@ var usePlayer = () => {
|
|
|
642
640
|
emitter.dispatchPause();
|
|
643
641
|
}
|
|
644
642
|
}
|
|
645
|
-
}, [
|
|
646
|
-
config,
|
|
647
|
-
emitter,
|
|
648
|
-
imperativePlaying,
|
|
649
|
-
setPlaying,
|
|
650
|
-
setTimelinePosition,
|
|
651
|
-
frameRef
|
|
652
|
-
]);
|
|
643
|
+
}, [config, emitter, imperativePlaying, setPlaying, setTimelinePosition]);
|
|
653
644
|
const videoId = video?.id;
|
|
654
645
|
const frameBack = useCallback2((frames) => {
|
|
655
646
|
if (!videoId) {
|
|
@@ -707,15 +698,12 @@ var usePlayer = () => {
|
|
|
707
698
|
pause,
|
|
708
699
|
seek,
|
|
709
700
|
isFirstFrame,
|
|
710
|
-
getCurrentFrame: () =>
|
|
711
|
-
return frameRef.current;
|
|
712
|
-
},
|
|
701
|
+
getCurrentFrame: () => frameRef.current,
|
|
713
702
|
isPlaying: () => imperativePlaying.current,
|
|
714
703
|
isBuffering: () => buffering.current,
|
|
715
704
|
pauseAndReturnToPlayStart,
|
|
716
705
|
hasPlayed,
|
|
717
|
-
toggle
|
|
718
|
-
setFrameAndImperative
|
|
706
|
+
toggle
|
|
719
707
|
};
|
|
720
708
|
}, [
|
|
721
709
|
buffering,
|
|
@@ -731,9 +719,7 @@ var usePlayer = () => {
|
|
|
731
719
|
play,
|
|
732
720
|
playing,
|
|
733
721
|
seek,
|
|
734
|
-
toggle
|
|
735
|
-
setFrameAndImperative,
|
|
736
|
-
frameRef
|
|
722
|
+
toggle
|
|
737
723
|
]);
|
|
738
724
|
return returnValue;
|
|
739
725
|
};
|
|
@@ -878,7 +864,7 @@ var calculateNextFrame = ({
|
|
|
878
864
|
};
|
|
879
865
|
|
|
880
866
|
// src/is-backgrounded.ts
|
|
881
|
-
import { useEffect as useEffect4, useRef as
|
|
867
|
+
import { useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
882
868
|
var getIsBackgrounded = () => {
|
|
883
869
|
if (typeof document === "undefined") {
|
|
884
870
|
return false;
|
|
@@ -886,7 +872,7 @@ var getIsBackgrounded = () => {
|
|
|
886
872
|
return document.visibilityState === "hidden";
|
|
887
873
|
};
|
|
888
874
|
var useIsBackgrounded = () => {
|
|
889
|
-
const isBackgrounded =
|
|
875
|
+
const isBackgrounded = useRef3(getIsBackgrounded());
|
|
890
876
|
useEffect4(() => {
|
|
891
877
|
const onVisibilityChange = () => {
|
|
892
878
|
isBackgrounded.current = getIsBackgrounded();
|
|
@@ -911,9 +897,10 @@ var usePlayback = ({
|
|
|
911
897
|
}) => {
|
|
912
898
|
const config = Internals6.useUnsafeVideoConfig();
|
|
913
899
|
const frame = Internals6.Timeline.useTimelinePosition();
|
|
914
|
-
const { playing, pause, emitter
|
|
900
|
+
const { playing, pause, emitter } = usePlayer();
|
|
901
|
+
const setFrame = Internals6.Timeline.useTimelineSetFrame();
|
|
915
902
|
const isBackgroundedRef = useIsBackgrounded();
|
|
916
|
-
const lastTimeUpdateEvent =
|
|
903
|
+
const lastTimeUpdateEvent = useRef4(null);
|
|
917
904
|
const context = useContext4(Internals6.BufferingContextReact);
|
|
918
905
|
if (!context) {
|
|
919
906
|
throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
|
|
@@ -967,7 +954,7 @@ var usePlayback = ({
|
|
|
967
954
|
});
|
|
968
955
|
framesAdvanced += framesToAdvance;
|
|
969
956
|
if (nextFrame !== getCurrentFrame() && (!hasEnded || moveToBeginningWhenEnded)) {
|
|
970
|
-
|
|
957
|
+
setFrame((c) => ({ ...c, [config.id]: nextFrame }));
|
|
971
958
|
}
|
|
972
959
|
if (hasEnded) {
|
|
973
960
|
stop();
|
|
@@ -1014,7 +1001,7 @@ var usePlayback = ({
|
|
|
1014
1001
|
loop,
|
|
1015
1002
|
pause,
|
|
1016
1003
|
playing,
|
|
1017
|
-
|
|
1004
|
+
setFrame,
|
|
1018
1005
|
emitter,
|
|
1019
1006
|
playbackRate,
|
|
1020
1007
|
inFrame,
|
|
@@ -1169,7 +1156,7 @@ import {
|
|
|
1169
1156
|
useImperativeHandle as useImperativeHandle2,
|
|
1170
1157
|
useLayoutEffect as useLayoutEffect2,
|
|
1171
1158
|
useMemo as useMemo14,
|
|
1172
|
-
useRef as
|
|
1159
|
+
useRef as useRef11,
|
|
1173
1160
|
useState as useState13
|
|
1174
1161
|
} from "react";
|
|
1175
1162
|
import { Composition, Internals as Internals15 } from "remotion";
|
|
@@ -1183,13 +1170,13 @@ import React10, {
|
|
|
1183
1170
|
useEffect as useEffect12,
|
|
1184
1171
|
useImperativeHandle,
|
|
1185
1172
|
useMemo as useMemo12,
|
|
1186
|
-
useRef as
|
|
1173
|
+
useRef as useRef10,
|
|
1187
1174
|
useState as useState11
|
|
1188
1175
|
} from "react";
|
|
1189
1176
|
import { Internals as Internals11 } from "remotion";
|
|
1190
1177
|
|
|
1191
1178
|
// src/PlayerControls.tsx
|
|
1192
|
-
import { useCallback as useCallback8, useEffect as useEffect10, useMemo as useMemo9, useRef as
|
|
1179
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useMemo as useMemo9, useRef as useRef8, useState as useState10 } from "react";
|
|
1193
1180
|
|
|
1194
1181
|
// src/DefaultPlayPauseButton.tsx
|
|
1195
1182
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -1206,7 +1193,7 @@ var DefaultPlayPauseButton = ({ playing, buffering }) => {
|
|
|
1206
1193
|
};
|
|
1207
1194
|
|
|
1208
1195
|
// src/MediaVolumeSlider.tsx
|
|
1209
|
-
import { useCallback as useCallback5, useMemo as useMemo4, useRef as
|
|
1196
|
+
import { useCallback as useCallback5, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
|
|
1210
1197
|
import { Internals as Internals7 } from "remotion";
|
|
1211
1198
|
|
|
1212
1199
|
// src/render-volume-slider.tsx
|
|
@@ -1324,8 +1311,8 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1324
1311
|
const [mediaMuted, setMediaMuted] = Internals7.useMediaMutedState();
|
|
1325
1312
|
const [mediaVolume, setMediaVolume] = Internals7.useMediaVolumeState();
|
|
1326
1313
|
const [focused, setFocused] = useState6(false);
|
|
1327
|
-
const parentDivRef =
|
|
1328
|
-
const inputRef =
|
|
1314
|
+
const parentDivRef = useRef5(null);
|
|
1315
|
+
const inputRef = useRef5(null);
|
|
1329
1316
|
const hover = useHoverState(parentDivRef, false);
|
|
1330
1317
|
const onBlur = useCallback5(() => {
|
|
1331
1318
|
setTimeout(() => {
|
|
@@ -1420,10 +1407,10 @@ import {
|
|
|
1420
1407
|
import { Internals as Internals8 } from "remotion";
|
|
1421
1408
|
|
|
1422
1409
|
// src/utils/use-component-visible.ts
|
|
1423
|
-
import { useEffect as useEffect7, useRef as
|
|
1410
|
+
import { useEffect as useEffect7, useRef as useRef6, useState as useState7 } from "react";
|
|
1424
1411
|
function useComponentVisible(initialIsVisible) {
|
|
1425
1412
|
const [isComponentVisible, setIsComponentVisible] = useState7(initialIsVisible);
|
|
1426
|
-
const ref =
|
|
1413
|
+
const ref = useRef6(null);
|
|
1427
1414
|
useEffect7(() => {
|
|
1428
1415
|
const handleClickOutside = (event) => {
|
|
1429
1416
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
@@ -1643,7 +1630,7 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
|
1643
1630
|
};
|
|
1644
1631
|
|
|
1645
1632
|
// src/PlayerSeekBar.tsx
|
|
1646
|
-
import { useCallback as useCallback7, useEffect as useEffect9, useMemo as useMemo6, useRef as
|
|
1633
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
|
|
1647
1634
|
import { Internals as Internals9, interpolate } from "remotion";
|
|
1648
1635
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1649
1636
|
var getFrameFromX = (clientX, durationInFrames, width) => {
|
|
@@ -1681,7 +1668,7 @@ var findBodyInWhichDivIsLocated = (div) => {
|
|
|
1681
1668
|
return current;
|
|
1682
1669
|
};
|
|
1683
1670
|
var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
|
|
1684
|
-
const containerRef =
|
|
1671
|
+
const containerRef = useRef7(null);
|
|
1685
1672
|
const barHovered = useHoverState(containerRef, false);
|
|
1686
1673
|
const size = useElementSize(containerRef, {
|
|
1687
1674
|
triggerOnWindowResize: true,
|
|
@@ -1972,7 +1959,7 @@ var Controls = ({
|
|
|
1972
1959
|
playing,
|
|
1973
1960
|
toggle
|
|
1974
1961
|
}) => {
|
|
1975
|
-
const playButtonRef =
|
|
1962
|
+
const playButtonRef = useRef8(null);
|
|
1976
1963
|
const [supportsFullscreen, setSupportsFullscreen] = useState10(false);
|
|
1977
1964
|
const hovered = useHoverState(containerRef, hideControlsWhenPointerDoesntMove);
|
|
1978
1965
|
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
|
|
@@ -2046,8 +2033,8 @@ var Controls = ({
|
|
|
2046
2033
|
}
|
|
2047
2034
|
return null;
|
|
2048
2035
|
}, [showPlaybackRateControl]);
|
|
2049
|
-
const ref =
|
|
2050
|
-
const flexRef =
|
|
2036
|
+
const ref = useRef8(null);
|
|
2037
|
+
const flexRef = useRef8(null);
|
|
2051
2038
|
const onPointerDownIfContainer = useCallback8((e) => {
|
|
2052
2039
|
if (e.target === ref.current || e.target === flexRef.current) {
|
|
2053
2040
|
onPointerDown?.(e);
|
|
@@ -2312,9 +2299,9 @@ var cancellablePromise = (promise) => {
|
|
|
2312
2299
|
var delay = (n) => new Promise((resolve) => setTimeout(resolve, n));
|
|
2313
2300
|
|
|
2314
2301
|
// src/utils/use-cancellable-promises.ts
|
|
2315
|
-
import { useCallback as useCallback9, useMemo as useMemo10, useRef as
|
|
2302
|
+
import { useCallback as useCallback9, useMemo as useMemo10, useRef as useRef9 } from "react";
|
|
2316
2303
|
var useCancellablePromises = () => {
|
|
2317
|
-
const pendingPromises =
|
|
2304
|
+
const pendingPromises = useRef9([]);
|
|
2318
2305
|
const appendPendingPromise = useCallback9((promise) => {
|
|
2319
2306
|
pendingPromises.current = [...pendingPromises.current, promise];
|
|
2320
2307
|
}, []);
|
|
@@ -2423,7 +2410,7 @@ var PlayerUI = ({
|
|
|
2423
2410
|
}, ref) => {
|
|
2424
2411
|
const config = Internals11.useUnsafeVideoConfig();
|
|
2425
2412
|
const video = Internals11.useVideo();
|
|
2426
|
-
const container =
|
|
2413
|
+
const container = useRef10(null);
|
|
2427
2414
|
const canvasSize = useElementSize(container, {
|
|
2428
2415
|
triggerOnWindowResize: false,
|
|
2429
2416
|
shouldApplyCssTransforms: false
|
|
@@ -2534,7 +2521,7 @@ var PlayerUI = ({
|
|
|
2534
2521
|
});
|
|
2535
2522
|
}, [canvasSize, config]);
|
|
2536
2523
|
const scale = layout?.scale ?? 1;
|
|
2537
|
-
const initialScaleIgnored =
|
|
2524
|
+
const initialScaleIgnored = useRef10(false);
|
|
2538
2525
|
useEffect12(() => {
|
|
2539
2526
|
if (!initialScaleIgnored.current) {
|
|
2540
2527
|
initialScaleIgnored.current = true;
|
|
@@ -3207,9 +3194,9 @@ var PlayerFn = ({
|
|
|
3207
3194
|
}));
|
|
3208
3195
|
const [playing, setPlaying] = useState13(false);
|
|
3209
3196
|
const [rootId] = useState13("player-comp");
|
|
3210
|
-
const rootRef =
|
|
3211
|
-
const audioAndVideoTags =
|
|
3212
|
-
const imperativePlaying =
|
|
3197
|
+
const rootRef = useRef11(null);
|
|
3198
|
+
const audioAndVideoTags = useRef11([]);
|
|
3199
|
+
const imperativePlaying = useRef11(false);
|
|
3213
3200
|
const [currentPlaybackRate, setCurrentPlaybackRate] = useState13(playbackRate);
|
|
3214
3201
|
if (typeof compositionHeight !== "number") {
|
|
3215
3202
|
throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
|
|
@@ -3273,7 +3260,6 @@ var PlayerFn = ({
|
|
|
3273
3260
|
const timelineContextValue = useMemo14(() => {
|
|
3274
3261
|
return {
|
|
3275
3262
|
frame,
|
|
3276
|
-
frameRef: { current: frame[PLAYER_COMP_ID] },
|
|
3277
3263
|
playing,
|
|
3278
3264
|
rootId,
|
|
3279
3265
|
playbackRate: currentPlaybackRate,
|
|
@@ -3372,7 +3358,7 @@ import {
|
|
|
3372
3358
|
useImperativeHandle as useImperativeHandle4,
|
|
3373
3359
|
useLayoutEffect as useLayoutEffect3,
|
|
3374
3360
|
useMemo as useMemo17,
|
|
3375
|
-
useRef as
|
|
3361
|
+
useRef as useRef13,
|
|
3376
3362
|
useState as useState14
|
|
3377
3363
|
} from "react";
|
|
3378
3364
|
import { Internals as Internals17, random as random2 } from "remotion";
|
|
@@ -3384,7 +3370,7 @@ import React13, {
|
|
|
3384
3370
|
useCallback as useCallback13,
|
|
3385
3371
|
useImperativeHandle as useImperativeHandle3,
|
|
3386
3372
|
useMemo as useMemo16,
|
|
3387
|
-
useRef as
|
|
3373
|
+
useRef as useRef12
|
|
3388
3374
|
} from "react";
|
|
3389
3375
|
import { Internals as Internals16 } from "remotion";
|
|
3390
3376
|
|
|
@@ -3422,7 +3408,7 @@ var ThumbnailUI = ({
|
|
|
3422
3408
|
}, ref) => {
|
|
3423
3409
|
const config = Internals16.useUnsafeVideoConfig();
|
|
3424
3410
|
const video = Internals16.useVideo();
|
|
3425
|
-
const container =
|
|
3411
|
+
const container = useRef12(null);
|
|
3426
3412
|
const canvasSize = useElementSize(container, {
|
|
3427
3413
|
triggerOnWindowResize: false,
|
|
3428
3414
|
shouldApplyCssTransforms: false
|
|
@@ -3551,10 +3537,9 @@ var ThumbnailFn = ({
|
|
|
3551
3537
|
}, []);
|
|
3552
3538
|
}
|
|
3553
3539
|
const [thumbnailId] = useState14(() => String(random2(null)));
|
|
3554
|
-
const rootRef =
|
|
3540
|
+
const rootRef = useRef13(null);
|
|
3555
3541
|
const timelineState = useMemo17(() => {
|
|
3556
3542
|
const value = {
|
|
3557
|
-
frameRef: { current: frameToDisplay },
|
|
3558
3543
|
playing: false,
|
|
3559
3544
|
frame: {
|
|
3560
3545
|
[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.393",
|
|
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.393"
|
|
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.393",
|
|
53
53
|
"eslint": "9.19.0"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|