@remotion/player 4.0.528 → 4.0.530
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 -1
- package/dist/cjs/Thumbnail.js +1 -1
- package/dist/cjs/use-playback.js +3 -3
- package/dist/cjs/use-player-methods.js +9 -17
- package/dist/esm/index.mjs +14 -22
- package/package.json +3 -3
package/dist/cjs/Player.js
CHANGED
|
@@ -205,7 +205,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
205
205
|
}, [currentPlaybackRate]);
|
|
206
206
|
const setTimelineContextValue = (0, react_1.useMemo)(() => {
|
|
207
207
|
return {
|
|
208
|
-
setFrame,
|
|
208
|
+
setFrameWithoutSeek: setFrame,
|
|
209
209
|
seek,
|
|
210
210
|
setPlaying: (updater) => {
|
|
211
211
|
const current = playingStore.store.getSnapshot().playing;
|
package/dist/cjs/Thumbnail.js
CHANGED
|
@@ -44,7 +44,7 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
44
44
|
frameRef.current = timelineState.frame;
|
|
45
45
|
const setTimelineContext = (0, react_1.useMemo)(() => {
|
|
46
46
|
return {
|
|
47
|
-
|
|
47
|
+
setFrameWithoutSeek: () => undefined,
|
|
48
48
|
seek: null,
|
|
49
49
|
setPlaying: () => undefined,
|
|
50
50
|
setBuffering: (buffering) => {
|
package/dist/cjs/use-playback.js
CHANGED
|
@@ -27,7 +27,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
27
27
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
28
28
|
const playing = remotion_1.Internals.usePlaying();
|
|
29
29
|
const { pause, emitter, isPlaying } = (0, use_player_methods_js_1.usePlayerMethods)();
|
|
30
|
-
const
|
|
30
|
+
const setFrameFromPlayback = remotion_1.Internals.Timeline.useTimelineSetFrameWithoutSeek();
|
|
31
31
|
const sharedAudioContext = (0, react_2.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
32
32
|
const { setPlayerMuted } = (0, react_2.useContext)(remotion_1.Internals.SetMediaVolumeContext);
|
|
33
33
|
const { isBuffering, subscribeBuffering } = (0, react_2.useContext)(remotion_1.Internals.SetTimelineContext);
|
|
@@ -191,7 +191,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
191
191
|
if (nextFrame !== getCurrentFrame() &&
|
|
192
192
|
(!hasEnded || moveToBeginningWhenEnded) &&
|
|
193
193
|
!isBuffering()) {
|
|
194
|
-
|
|
194
|
+
setFrameFromPlayback((c) => ({ ...c, [config.id]: nextFrame }));
|
|
195
195
|
}
|
|
196
196
|
if (hasEnded) {
|
|
197
197
|
stop();
|
|
@@ -276,7 +276,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
276
276
|
loop,
|
|
277
277
|
pause,
|
|
278
278
|
playing,
|
|
279
|
-
|
|
279
|
+
setFrameFromPlayback,
|
|
280
280
|
emitter,
|
|
281
281
|
playbackRate,
|
|
282
282
|
inFrame,
|
|
@@ -6,8 +6,7 @@ const remotion_1 = require("remotion");
|
|
|
6
6
|
const emitter_context_js_1 = require("./emitter-context.js");
|
|
7
7
|
const usePlayerMethods = () => {
|
|
8
8
|
var _a;
|
|
9
|
-
const
|
|
10
|
-
const setTimelinePosition = setFrame;
|
|
9
|
+
const seekFrame = remotion_1.Internals.Timeline.useTimelineSeekFrame();
|
|
11
10
|
const { setPlaying, frameRef, audioAndVideoTags, isPlaying: readIsPlaying, isBuffering, } = (0, react_1.useContext)(remotion_1.Internals.SetTimelineContext);
|
|
12
11
|
const audioContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
13
12
|
const audioTagsContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioTagsContext);
|
|
@@ -39,7 +38,7 @@ const usePlayerMethods = () => {
|
|
|
39
38
|
: Math.max(0, newFrame);
|
|
40
39
|
fallbackFrame.current = frameToSeekTo;
|
|
41
40
|
if (video === null || video === void 0 ? void 0 : video.id) {
|
|
42
|
-
|
|
41
|
+
seekFrame((currentFrames) => currentFrames[video.id] === frameToSeekTo
|
|
43
42
|
? currentFrames
|
|
44
43
|
: { ...currentFrames, [video.id]: frameToSeekTo });
|
|
45
44
|
if (frameRef.current[video.id] !== frameToSeekTo) {
|
|
@@ -50,7 +49,7 @@ const usePlayerMethods = () => {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
emitter.dispatchSeek(frameToSeekTo);
|
|
53
|
-
}, [config, emitter, frameRef,
|
|
52
|
+
}, [config, emitter, frameRef, seekFrame, video === null || video === void 0 ? void 0 : video.id]);
|
|
54
53
|
const play = (0, react_1.useCallback)((e) => {
|
|
55
54
|
var _a;
|
|
56
55
|
const isAutoPlayAttempt = nextPlayIsAutoPlayAttempt.current;
|
|
@@ -109,7 +108,7 @@ const usePlayerMethods = () => {
|
|
|
109
108
|
setPlaying(false);
|
|
110
109
|
fallbackFrame.current = playStart.current;
|
|
111
110
|
if (config) {
|
|
112
|
-
|
|
111
|
+
seekFrame((currentFrames) => ({
|
|
113
112
|
...currentFrames,
|
|
114
113
|
[config.id]: playStart.current,
|
|
115
114
|
}));
|
|
@@ -120,14 +119,7 @@ const usePlayerMethods = () => {
|
|
|
120
119
|
emitter.dispatchPause();
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
|
-
}, [
|
|
124
|
-
config,
|
|
125
|
-
emitter,
|
|
126
|
-
frameRef,
|
|
127
|
-
readIsPlaying,
|
|
128
|
-
setPlaying,
|
|
129
|
-
setTimelinePosition,
|
|
130
|
-
]);
|
|
122
|
+
}, [config, emitter, frameRef, readIsPlaying, setPlaying, seekFrame]);
|
|
131
123
|
const videoId = video === null || video === void 0 ? void 0 : video.id;
|
|
132
124
|
const lastFrame = ((_a = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _a !== void 0 ? _a : 1) - 1;
|
|
133
125
|
const frameBack = (0, react_1.useCallback)((frames) => {
|
|
@@ -143,14 +135,14 @@ const usePlayerMethods = () => {
|
|
|
143
135
|
if (previousFrame === newFrame) {
|
|
144
136
|
return;
|
|
145
137
|
}
|
|
146
|
-
|
|
138
|
+
seekFrame((currentFrames) => currentFrames[videoId] === newFrame
|
|
147
139
|
? currentFrames
|
|
148
140
|
: { ...currentFrames, [videoId]: newFrame });
|
|
149
141
|
frameRef.current = {
|
|
150
142
|
...frameRef.current,
|
|
151
143
|
[videoId]: newFrame,
|
|
152
144
|
};
|
|
153
|
-
}, [frameRef, readIsPlaying,
|
|
145
|
+
}, [frameRef, readIsPlaying, seekFrame, videoId]);
|
|
154
146
|
const frameForward = (0, react_1.useCallback)((frames) => {
|
|
155
147
|
var _a, _b;
|
|
156
148
|
if (!videoId) {
|
|
@@ -164,14 +156,14 @@ const usePlayerMethods = () => {
|
|
|
164
156
|
if (previousFrame === newFrame) {
|
|
165
157
|
return;
|
|
166
158
|
}
|
|
167
|
-
|
|
159
|
+
seekFrame((currentFrames) => currentFrames[videoId] === newFrame
|
|
168
160
|
? currentFrames
|
|
169
161
|
: { ...currentFrames, [videoId]: newFrame });
|
|
170
162
|
frameRef.current = {
|
|
171
163
|
...frameRef.current,
|
|
172
164
|
[videoId]: newFrame,
|
|
173
165
|
};
|
|
174
|
-
}, [frameRef, lastFrame, readIsPlaying,
|
|
166
|
+
}, [frameRef, lastFrame, readIsPlaying, seekFrame, videoId]);
|
|
175
167
|
const toggle = (0, react_1.useCallback)((e) => {
|
|
176
168
|
if (readIsPlaying()) {
|
|
177
169
|
pause();
|
package/dist/esm/index.mjs
CHANGED
|
@@ -564,8 +564,7 @@ import { Internals as Internals4 } from "remotion";
|
|
|
564
564
|
import { useCallback, useContext as useContext2, useMemo, useRef } from "react";
|
|
565
565
|
import { Internals as Internals3, useRemotionEnvironment } from "remotion";
|
|
566
566
|
var usePlayerMethods = () => {
|
|
567
|
-
const
|
|
568
|
-
const setTimelinePosition = setFrame;
|
|
567
|
+
const seekFrame = Internals3.Timeline.useTimelineSeekFrame();
|
|
569
568
|
const {
|
|
570
569
|
setPlaying,
|
|
571
570
|
frameRef,
|
|
@@ -596,7 +595,7 @@ var usePlayerMethods = () => {
|
|
|
596
595
|
const frameToSeekTo = config ? Internals3.TimelinePosition.clampFrameToCompositionRange(newFrame, config.durationInFrames) : Math.max(0, newFrame);
|
|
597
596
|
fallbackFrame.current = frameToSeekTo;
|
|
598
597
|
if (video?.id) {
|
|
599
|
-
|
|
598
|
+
seekFrame((currentFrames) => currentFrames[video.id] === frameToSeekTo ? currentFrames : { ...currentFrames, [video.id]: frameToSeekTo });
|
|
600
599
|
if (frameRef.current[video.id] !== frameToSeekTo) {
|
|
601
600
|
frameRef.current = {
|
|
602
601
|
...frameRef.current,
|
|
@@ -605,7 +604,7 @@ var usePlayerMethods = () => {
|
|
|
605
604
|
}
|
|
606
605
|
}
|
|
607
606
|
emitter.dispatchSeek(frameToSeekTo);
|
|
608
|
-
}, [config, emitter, frameRef,
|
|
607
|
+
}, [config, emitter, frameRef, seekFrame, video?.id]);
|
|
609
608
|
const play = useCallback((e) => {
|
|
610
609
|
const isAutoPlayAttempt = nextPlayIsAutoPlayAttempt.current;
|
|
611
610
|
nextPlayIsAutoPlayAttempt.current = false;
|
|
@@ -655,7 +654,7 @@ var usePlayerMethods = () => {
|
|
|
655
654
|
setPlaying(false);
|
|
656
655
|
fallbackFrame.current = playStart.current;
|
|
657
656
|
if (config) {
|
|
658
|
-
|
|
657
|
+
seekFrame((currentFrames) => ({
|
|
659
658
|
...currentFrames,
|
|
660
659
|
[config.id]: playStart.current
|
|
661
660
|
}));
|
|
@@ -666,14 +665,7 @@ var usePlayerMethods = () => {
|
|
|
666
665
|
emitter.dispatchPause();
|
|
667
666
|
}
|
|
668
667
|
}
|
|
669
|
-
}, [
|
|
670
|
-
config,
|
|
671
|
-
emitter,
|
|
672
|
-
frameRef,
|
|
673
|
-
readIsPlaying,
|
|
674
|
-
setPlaying,
|
|
675
|
-
setTimelinePosition
|
|
676
|
-
]);
|
|
668
|
+
}, [config, emitter, frameRef, readIsPlaying, setPlaying, seekFrame]);
|
|
677
669
|
const videoId = video?.id;
|
|
678
670
|
const lastFrame = (config?.durationInFrames ?? 1) - 1;
|
|
679
671
|
const frameBack = useCallback((frames) => {
|
|
@@ -688,12 +680,12 @@ var usePlayerMethods = () => {
|
|
|
688
680
|
if (previousFrame === newFrame) {
|
|
689
681
|
return;
|
|
690
682
|
}
|
|
691
|
-
|
|
683
|
+
seekFrame((currentFrames) => currentFrames[videoId] === newFrame ? currentFrames : { ...currentFrames, [videoId]: newFrame });
|
|
692
684
|
frameRef.current = {
|
|
693
685
|
...frameRef.current,
|
|
694
686
|
[videoId]: newFrame
|
|
695
687
|
};
|
|
696
|
-
}, [frameRef, readIsPlaying,
|
|
688
|
+
}, [frameRef, readIsPlaying, seekFrame, videoId]);
|
|
697
689
|
const frameForward = useCallback((frames) => {
|
|
698
690
|
if (!videoId) {
|
|
699
691
|
return null;
|
|
@@ -706,12 +698,12 @@ var usePlayerMethods = () => {
|
|
|
706
698
|
if (previousFrame === newFrame) {
|
|
707
699
|
return;
|
|
708
700
|
}
|
|
709
|
-
|
|
701
|
+
seekFrame((currentFrames) => currentFrames[videoId] === newFrame ? currentFrames : { ...currentFrames, [videoId]: newFrame });
|
|
710
702
|
frameRef.current = {
|
|
711
703
|
...frameRef.current,
|
|
712
704
|
[videoId]: newFrame
|
|
713
705
|
};
|
|
714
|
-
}, [frameRef, lastFrame, readIsPlaying,
|
|
706
|
+
}, [frameRef, lastFrame, readIsPlaying, seekFrame, videoId]);
|
|
715
707
|
const toggle = useCallback((e) => {
|
|
716
708
|
if (readIsPlaying()) {
|
|
717
709
|
pause();
|
|
@@ -967,7 +959,7 @@ var usePlayback = ({
|
|
|
967
959
|
const frame = Internals6.Timeline.useTimelinePosition();
|
|
968
960
|
const playing = Internals6.usePlaying();
|
|
969
961
|
const { pause, emitter, isPlaying } = usePlayerMethods();
|
|
970
|
-
const
|
|
962
|
+
const setFrameFromPlayback = Internals6.Timeline.useTimelineSetFrameWithoutSeek();
|
|
971
963
|
const sharedAudioContext = useContext3(Internals6.SharedAudioContext);
|
|
972
964
|
const { setPlayerMuted } = useContext3(Internals6.SetMediaVolumeContext);
|
|
973
965
|
const { isBuffering, subscribeBuffering } = useContext3(Internals6.SetTimelineContext);
|
|
@@ -1109,7 +1101,7 @@ var usePlayback = ({
|
|
|
1109
1101
|
});
|
|
1110
1102
|
framesAdvanced += framesToAdvance;
|
|
1111
1103
|
if (nextFrame !== getCurrentFrame() && (!hasEnded || moveToBeginningWhenEnded) && !isBuffering()) {
|
|
1112
|
-
|
|
1104
|
+
setFrameFromPlayback((c) => ({ ...c, [config.id]: nextFrame }));
|
|
1113
1105
|
}
|
|
1114
1106
|
if (hasEnded) {
|
|
1115
1107
|
stop();
|
|
@@ -1185,7 +1177,7 @@ var usePlayback = ({
|
|
|
1185
1177
|
loop,
|
|
1186
1178
|
pause,
|
|
1187
1179
|
playing,
|
|
1188
|
-
|
|
1180
|
+
setFrameFromPlayback,
|
|
1189
1181
|
emitter,
|
|
1190
1182
|
playbackRate,
|
|
1191
1183
|
inFrame,
|
|
@@ -3558,7 +3550,7 @@ var PlayerFn = ({
|
|
|
3558
3550
|
}, [currentPlaybackRate]);
|
|
3559
3551
|
const setTimelineContextValue = useMemo14(() => {
|
|
3560
3552
|
return {
|
|
3561
|
-
setFrame,
|
|
3553
|
+
setFrameWithoutSeek: setFrame,
|
|
3562
3554
|
seek,
|
|
3563
3555
|
setPlaying: (updater) => {
|
|
3564
3556
|
const current = playingStore.store.getSnapshot().playing;
|
|
@@ -3894,7 +3886,7 @@ var ThumbnailFn = ({
|
|
|
3894
3886
|
frameRef.current = timelineState.frame;
|
|
3895
3887
|
const setTimelineContext = useMemo17(() => {
|
|
3896
3888
|
return {
|
|
3897
|
-
|
|
3889
|
+
setFrameWithoutSeek: () => {
|
|
3898
3890
|
return;
|
|
3899
3891
|
},
|
|
3900
3892
|
seek: null,
|
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.530",
|
|
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.530"
|
|
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.105.0",
|
|
51
51
|
"zod": "4.5.4",
|
|
52
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
52
|
+
"@remotion/eslint-config-internal": "4.0.530",
|
|
53
53
|
"eslint": "9.19.0",
|
|
54
54
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
55
55
|
},
|