@remotion/player 4.0.538 → 4.0.539
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/PlaybackrateControl.js +13 -1
- package/dist/cjs/browser-mediasession.js +2 -2
- package/dist/cjs/timeline-imperative-context.d.ts +11 -0
- package/dist/cjs/timeline-imperative-context.js +76 -0
- package/dist/cjs/use-player.d.ts +21 -0
- package/dist/cjs/use-player.js +195 -0
- package/dist/esm/index.mjs +13 -3
- package/package.json +3 -3
|
@@ -64,8 +64,11 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) =>
|
|
|
64
64
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = (0, react_1.useState)(playbackRate);
|
|
65
65
|
(0, react_1.useEffect)(() => {
|
|
66
66
|
const listener = (e) => {
|
|
67
|
-
e.
|
|
67
|
+
if (e.ctrlKey || e.metaKey || e.altKey) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
68
70
|
if (e.key === 'ArrowUp') {
|
|
71
|
+
e.preventDefault();
|
|
69
72
|
const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
|
|
70
73
|
if (currentIndex === 0) {
|
|
71
74
|
return;
|
|
@@ -78,6 +81,7 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) =>
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
else if (e.key === 'ArrowDown') {
|
|
84
|
+
e.preventDefault();
|
|
81
85
|
const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
|
|
82
86
|
if (currentIndex === playbackRates.length - 1) {
|
|
83
87
|
return;
|
|
@@ -90,9 +94,17 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) =>
|
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
else if (e.key === 'Enter') {
|
|
97
|
+
e.preventDefault();
|
|
93
98
|
setPlaybackRate(keyboardSelectedRate);
|
|
94
99
|
setIsComponentVisible(false);
|
|
95
100
|
}
|
|
101
|
+
else if (e.key === 'Escape') {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
setIsComponentVisible(false);
|
|
104
|
+
}
|
|
105
|
+
else if (e.key === 'Tab') {
|
|
106
|
+
setIsComponentVisible(false);
|
|
107
|
+
}
|
|
96
108
|
};
|
|
97
109
|
window.addEventListener('keydown', listener);
|
|
98
110
|
return () => {
|
|
@@ -82,13 +82,13 @@ const useBrowserMediaSession = ({ browserMediaControlsBehavior, videoConfig, pla
|
|
|
82
82
|
navigator.mediaSession.setActionHandler('seekbackward', () => {
|
|
83
83
|
if (browserMediaControlsBehavior.mode === 'register-media-session' &&
|
|
84
84
|
videoConfig) {
|
|
85
|
-
seek(Math.max(0, Math.round(
|
|
85
|
+
seek(Math.max(0, Math.round(getCurrentFrame() - 10 * videoConfig.fps)));
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
navigator.mediaSession.setActionHandler('seekforward', () => {
|
|
89
89
|
if (browserMediaControlsBehavior.mode === 'register-media-session' &&
|
|
90
90
|
videoConfig) {
|
|
91
|
-
seek(Math.
|
|
91
|
+
seek(Math.min(videoConfig.durationInFrames - 1, Math.round(getCurrentFrame() + 10 * videoConfig.fps)));
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
navigator.mediaSession.setActionHandler('previoustrack', () => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { TimelineImperativeContextValue } from 'remotion';
|
|
4
|
+
export declare const getTimelineImperativeContext: () => Context<TimelineImperativeContextValue | null>;
|
|
5
|
+
export declare const CoreTimelineImperativeContextProvider: React.FC<{
|
|
6
|
+
readonly children: React.ReactNode;
|
|
7
|
+
readonly value: TimelineImperativeContextValue;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const TimelineImperativeCompatibilityProvider: React.FC<{
|
|
10
|
+
readonly children: React.ReactNode;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TimelineImperativeCompatibilityProvider = exports.CoreTimelineImperativeContextProvider = exports.getTimelineImperativeContext = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const remotion_1 = require("remotion");
|
|
40
|
+
const PlayerTimelineImperativeContext = react_1.default.createContext(null);
|
|
41
|
+
const getCoreTimelineImperativeContext = () => {
|
|
42
|
+
return remotion_1.Internals.TimelineImperativeContext;
|
|
43
|
+
};
|
|
44
|
+
const getTimelineImperativeContext = () => {
|
|
45
|
+
var _a;
|
|
46
|
+
return (_a = getCoreTimelineImperativeContext()) !== null && _a !== void 0 ? _a : PlayerTimelineImperativeContext;
|
|
47
|
+
};
|
|
48
|
+
exports.getTimelineImperativeContext = getTimelineImperativeContext;
|
|
49
|
+
const CoreTimelineImperativeContextProvider = ({ children, value }) => {
|
|
50
|
+
const TimelineImperativeContext = getCoreTimelineImperativeContext();
|
|
51
|
+
if (!TimelineImperativeContext) {
|
|
52
|
+
return children;
|
|
53
|
+
}
|
|
54
|
+
return (jsx_runtime_1.jsx(TimelineImperativeContext.Provider, { value: value, children: children }));
|
|
55
|
+
};
|
|
56
|
+
exports.CoreTimelineImperativeContextProvider = CoreTimelineImperativeContextProvider;
|
|
57
|
+
const LegacyTimelineImperativeContextProvider = ({ children }) => {
|
|
58
|
+
const timelineContext = remotion_1.Internals.Timeline.useTimelineContext();
|
|
59
|
+
const frameRef = (0, react_1.useRef)(timelineContext.frame);
|
|
60
|
+
frameRef.current = timelineContext.frame;
|
|
61
|
+
const value = (0, react_1.useMemo)(() => {
|
|
62
|
+
return {
|
|
63
|
+
frameRef,
|
|
64
|
+
imperativePlaying: timelineContext.imperativePlaying,
|
|
65
|
+
audioAndVideoTags: timelineContext.audioAndVideoTags,
|
|
66
|
+
};
|
|
67
|
+
}, [timelineContext.audioAndVideoTags, timelineContext.imperativePlaying]);
|
|
68
|
+
return (jsx_runtime_1.jsx(PlayerTimelineImperativeContext.Provider, { value: value, children: children }));
|
|
69
|
+
};
|
|
70
|
+
const TimelineImperativeCompatibilityProvider = ({ children }) => {
|
|
71
|
+
if (getCoreTimelineImperativeContext()) {
|
|
72
|
+
return children;
|
|
73
|
+
}
|
|
74
|
+
return (jsx_runtime_1.jsx(LegacyTimelineImperativeContextProvider, { children: children }));
|
|
75
|
+
};
|
|
76
|
+
exports.TimelineImperativeCompatibilityProvider = TimelineImperativeCompatibilityProvider;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SyntheticEvent } from 'react';
|
|
2
|
+
import type { PlayerEmitter } from './event-emitter.js';
|
|
3
|
+
type UsePlayerMethods = {
|
|
4
|
+
frameBack: (frames: number) => void;
|
|
5
|
+
frameForward: (frames: number) => void;
|
|
6
|
+
isLastFrame: boolean;
|
|
7
|
+
isFirstFrame: boolean;
|
|
8
|
+
emitter: PlayerEmitter;
|
|
9
|
+
playing: boolean;
|
|
10
|
+
play: (e?: SyntheticEvent | PointerEvent) => void;
|
|
11
|
+
pause: () => void;
|
|
12
|
+
pauseAndReturnToPlayStart: () => void;
|
|
13
|
+
seek: (newFrame: number) => void;
|
|
14
|
+
getCurrentFrame: () => number;
|
|
15
|
+
isPlaying: () => boolean;
|
|
16
|
+
hasPlayed: boolean;
|
|
17
|
+
isBuffering: () => boolean;
|
|
18
|
+
toggle: (e?: SyntheticEvent | PointerEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare const usePlayer: () => UsePlayerMethods;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePlayer = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const emitter_context_js_1 = require("./emitter-context.js");
|
|
7
|
+
const usePlayer = () => {
|
|
8
|
+
var _a;
|
|
9
|
+
const [playing, setPlaying, imperativePlaying] = remotion_1.Internals.Timeline.usePlayingState();
|
|
10
|
+
const [hasPlayed, setHasPlayed] = (0, react_1.useState)(false);
|
|
11
|
+
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
12
|
+
const playStart = (0, react_1.useRef)(frame);
|
|
13
|
+
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
14
|
+
const setTimelinePosition = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
15
|
+
const audioContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
16
|
+
const audioTagsContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioTagsContext);
|
|
17
|
+
const { audioAndVideoTags } = remotion_1.Internals.useTimelineContext();
|
|
18
|
+
const frameRef = (0, react_1.useRef)(frame);
|
|
19
|
+
frameRef.current = frame;
|
|
20
|
+
const video = remotion_1.Internals.useVideo();
|
|
21
|
+
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
22
|
+
const emitter = (0, react_1.useContext)(emitter_context_js_1.PlayerEventEmitterContext);
|
|
23
|
+
const lastFrame = ((_a = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _a !== void 0 ? _a : 1) - 1;
|
|
24
|
+
const isLastFrame = frame === lastFrame;
|
|
25
|
+
const isFirstFrame = frame === 0;
|
|
26
|
+
if (!emitter) {
|
|
27
|
+
throw new TypeError('Expected Player event emitter context');
|
|
28
|
+
}
|
|
29
|
+
const bufferingContext = (0, react_1.useContext)(remotion_1.Internals.BufferingContextReact);
|
|
30
|
+
if (!bufferingContext) {
|
|
31
|
+
throw new Error('Missing the buffering context. Most likely you have a Remotion version mismatch.');
|
|
32
|
+
}
|
|
33
|
+
const { buffering } = bufferingContext;
|
|
34
|
+
const seek = (0, react_1.useCallback)((newFrame) => {
|
|
35
|
+
const frameToSeekTo = config
|
|
36
|
+
? remotion_1.Internals.TimelinePosition.clampFrameToCompositionRange(newFrame, config.durationInFrames)
|
|
37
|
+
: Math.max(0, newFrame);
|
|
38
|
+
if (video === null || video === void 0 ? void 0 : video.id) {
|
|
39
|
+
setTimelinePosition((c) => c[video.id] === frameToSeekTo ? c : { ...c, [video.id]: frameToSeekTo });
|
|
40
|
+
}
|
|
41
|
+
frameRef.current = frameToSeekTo;
|
|
42
|
+
emitter.dispatchSeek(frameToSeekTo);
|
|
43
|
+
}, [config, emitter, setTimelinePosition, video === null || video === void 0 ? void 0 : video.id]);
|
|
44
|
+
const play = (0, react_1.useCallback)((e) => {
|
|
45
|
+
if (imperativePlaying.current) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setHasPlayed(true);
|
|
49
|
+
if (isLastFrame) {
|
|
50
|
+
seek(0);
|
|
51
|
+
}
|
|
52
|
+
audioContext === null || audioContext === void 0 ? void 0 : audioContext.resume();
|
|
53
|
+
/**
|
|
54
|
+
* Play silent audio tags to warm them up for autoplay
|
|
55
|
+
*/
|
|
56
|
+
if (audioTagsContext && audioTagsContext.numberOfAudioTags > 0 && e) {
|
|
57
|
+
audioTagsContext.playAllAudios();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Play audios and videos directly here so they can benefit from
|
|
61
|
+
* being triggered by a click
|
|
62
|
+
*/
|
|
63
|
+
audioAndVideoTags.current.forEach((a) => a.play('player play() was called and playing audio from a click'));
|
|
64
|
+
imperativePlaying.current = true;
|
|
65
|
+
setPlaying(true);
|
|
66
|
+
playStart.current = frameRef.current;
|
|
67
|
+
emitter.dispatchPlay();
|
|
68
|
+
}, [
|
|
69
|
+
imperativePlaying,
|
|
70
|
+
isLastFrame,
|
|
71
|
+
audioContext,
|
|
72
|
+
audioTagsContext,
|
|
73
|
+
setPlaying,
|
|
74
|
+
emitter,
|
|
75
|
+
seek,
|
|
76
|
+
audioAndVideoTags,
|
|
77
|
+
]);
|
|
78
|
+
const pause = (0, react_1.useCallback)(() => {
|
|
79
|
+
if (imperativePlaying.current) {
|
|
80
|
+
imperativePlaying.current = false;
|
|
81
|
+
setPlaying(false);
|
|
82
|
+
emitter.dispatchPause();
|
|
83
|
+
audioContext === null || audioContext === void 0 ? void 0 : audioContext.suspend();
|
|
84
|
+
}
|
|
85
|
+
}, [emitter, imperativePlaying, setPlaying, audioContext]);
|
|
86
|
+
const pauseAndReturnToPlayStart = (0, react_1.useCallback)(() => {
|
|
87
|
+
if (imperativePlaying.current) {
|
|
88
|
+
imperativePlaying.current = false;
|
|
89
|
+
frameRef.current = playStart.current;
|
|
90
|
+
if (config) {
|
|
91
|
+
setTimelinePosition((c) => ({
|
|
92
|
+
...c,
|
|
93
|
+
[config.id]: playStart.current,
|
|
94
|
+
}));
|
|
95
|
+
setPlaying(false);
|
|
96
|
+
emitter.dispatchPause();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, [config, emitter, imperativePlaying, setPlaying, setTimelinePosition]);
|
|
100
|
+
const videoId = video === null || video === void 0 ? void 0 : video.id;
|
|
101
|
+
const frameBack = (0, react_1.useCallback)((frames) => {
|
|
102
|
+
if (!videoId) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
if (imperativePlaying.current) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
setFrame((c) => {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
const prevFrame = (_b = (_a = c[videoId]) !== null && _a !== void 0 ? _a : window.remotion_initialFrame) !== null && _b !== void 0 ? _b : 0;
|
|
111
|
+
const newFrame = Math.max(0, prevFrame - frames);
|
|
112
|
+
if (prevFrame === newFrame) {
|
|
113
|
+
return c;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
...c,
|
|
117
|
+
[videoId]: newFrame,
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
}, [imperativePlaying, setFrame, videoId]);
|
|
121
|
+
const frameForward = (0, react_1.useCallback)((frames) => {
|
|
122
|
+
if (!videoId) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if (imperativePlaying.current) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
setFrame((c) => {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
const prevFrame = (_b = (_a = c[videoId]) !== null && _a !== void 0 ? _a : window.remotion_initialFrame) !== null && _b !== void 0 ? _b : 0;
|
|
131
|
+
const newFrame = Math.min(lastFrame, prevFrame + frames);
|
|
132
|
+
if (prevFrame === newFrame) {
|
|
133
|
+
return c;
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
...c,
|
|
137
|
+
[videoId]: newFrame,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}, [videoId, imperativePlaying, lastFrame, setFrame]);
|
|
141
|
+
const toggle = (0, react_1.useCallback)((e) => {
|
|
142
|
+
if (imperativePlaying.current) {
|
|
143
|
+
pause();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
play(e);
|
|
147
|
+
}
|
|
148
|
+
}, [imperativePlaying, pause, play]);
|
|
149
|
+
const isPlaying = (0, react_1.useCallback)(() => {
|
|
150
|
+
return imperativePlaying.current;
|
|
151
|
+
}, [imperativePlaying]);
|
|
152
|
+
const getCurrentFrame = (0, react_1.useCallback)(() => {
|
|
153
|
+
return frameRef.current;
|
|
154
|
+
}, [frameRef]);
|
|
155
|
+
const isBuffering = (0, react_1.useCallback)(() => {
|
|
156
|
+
return buffering.current;
|
|
157
|
+
}, [buffering]);
|
|
158
|
+
const returnValue = (0, react_1.useMemo)(() => {
|
|
159
|
+
return {
|
|
160
|
+
frameBack,
|
|
161
|
+
frameForward,
|
|
162
|
+
isLastFrame,
|
|
163
|
+
emitter,
|
|
164
|
+
playing,
|
|
165
|
+
play,
|
|
166
|
+
pause,
|
|
167
|
+
seek,
|
|
168
|
+
isFirstFrame,
|
|
169
|
+
getCurrentFrame,
|
|
170
|
+
isPlaying,
|
|
171
|
+
isBuffering,
|
|
172
|
+
pauseAndReturnToPlayStart,
|
|
173
|
+
hasPlayed,
|
|
174
|
+
toggle,
|
|
175
|
+
};
|
|
176
|
+
}, [
|
|
177
|
+
emitter,
|
|
178
|
+
frameBack,
|
|
179
|
+
frameForward,
|
|
180
|
+
hasPlayed,
|
|
181
|
+
isFirstFrame,
|
|
182
|
+
isLastFrame,
|
|
183
|
+
getCurrentFrame,
|
|
184
|
+
pause,
|
|
185
|
+
pauseAndReturnToPlayStart,
|
|
186
|
+
play,
|
|
187
|
+
playing,
|
|
188
|
+
seek,
|
|
189
|
+
toggle,
|
|
190
|
+
isPlaying,
|
|
191
|
+
isBuffering,
|
|
192
|
+
]);
|
|
193
|
+
return returnValue;
|
|
194
|
+
};
|
|
195
|
+
exports.usePlayer = usePlayer;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -823,12 +823,12 @@ var useBrowserMediaSession = ({
|
|
|
823
823
|
});
|
|
824
824
|
navigator.mediaSession.setActionHandler("seekbackward", () => {
|
|
825
825
|
if (browserMediaControlsBehavior.mode === "register-media-session" && videoConfig) {
|
|
826
|
-
seek(Math.max(0, Math.round(
|
|
826
|
+
seek(Math.max(0, Math.round(getCurrentFrame() - 10 * videoConfig.fps)));
|
|
827
827
|
}
|
|
828
828
|
});
|
|
829
829
|
navigator.mediaSession.setActionHandler("seekforward", () => {
|
|
830
830
|
if (browserMediaControlsBehavior.mode === "register-media-session" && videoConfig) {
|
|
831
|
-
seek(Math.
|
|
831
|
+
seek(Math.min(videoConfig.durationInFrames - 1, Math.round(getCurrentFrame() + 10 * videoConfig.fps)));
|
|
832
832
|
}
|
|
833
833
|
});
|
|
834
834
|
navigator.mediaSession.setActionHandler("previoustrack", () => {
|
|
@@ -1850,8 +1850,11 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
|
1850
1850
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = useState7(playbackRate);
|
|
1851
1851
|
useEffect9(() => {
|
|
1852
1852
|
const listener = (e) => {
|
|
1853
|
-
e.
|
|
1853
|
+
if (e.ctrlKey || e.metaKey || e.altKey) {
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1854
1856
|
if (e.key === "ArrowUp") {
|
|
1857
|
+
e.preventDefault();
|
|
1855
1858
|
const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
|
|
1856
1859
|
if (currentIndex === 0) {
|
|
1857
1860
|
return;
|
|
@@ -1862,6 +1865,7 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
|
1862
1865
|
setKeyboardSelectedRate(playbackRates[currentIndex - 1]);
|
|
1863
1866
|
}
|
|
1864
1867
|
} else if (e.key === "ArrowDown") {
|
|
1868
|
+
e.preventDefault();
|
|
1865
1869
|
const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
|
|
1866
1870
|
if (currentIndex === playbackRates.length - 1) {
|
|
1867
1871
|
return;
|
|
@@ -1872,8 +1876,14 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
|
1872
1876
|
setKeyboardSelectedRate(playbackRates[currentIndex + 1]);
|
|
1873
1877
|
}
|
|
1874
1878
|
} else if (e.key === "Enter") {
|
|
1879
|
+
e.preventDefault();
|
|
1875
1880
|
setPlaybackRate(keyboardSelectedRate);
|
|
1876
1881
|
setIsComponentVisible(false);
|
|
1882
|
+
} else if (e.key === "Escape") {
|
|
1883
|
+
e.preventDefault();
|
|
1884
|
+
setIsComponentVisible(false);
|
|
1885
|
+
} else if (e.key === "Tab") {
|
|
1886
|
+
setIsComponentVisible(false);
|
|
1877
1887
|
}
|
|
1878
1888
|
};
|
|
1879
1889
|
window.addEventListener("keydown", listener);
|
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.539",
|
|
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.539"
|
|
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.539",
|
|
53
53
|
"eslint": "9.19.0",
|
|
54
54
|
"typescript": "7.1.0-beta"
|
|
55
55
|
},
|