@remotion/player 4.0.232 → 4.0.234
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.d.ts +1 -0
- package/dist/cjs/Player.js +4 -4
- package/dist/cjs/PlayerControls.d.ts +2 -2
- package/dist/cjs/PlayerControls.js +8 -20
- package/dist/cjs/PlayerSeekBar.js +5 -5
- package/dist/cjs/PlayerTimeLabel.d.ts +6 -0
- package/dist/cjs/PlayerTimeLabel.js +22 -0
- package/dist/cjs/PlayerUI.d.ts +1 -0
- package/dist/cjs/PlayerUI.js +16 -17
- package/dist/cjs/Thumbnail.d.ts +1 -0
- package/dist/cjs/Thumbnail.js +2 -2
- package/dist/cjs/ThumbnailUI.d.ts +1 -0
- package/dist/cjs/ThumbnailUI.js +2 -2
- package/dist/cjs/error-boundary.d.ts +1 -1
- package/dist/cjs/index.d.ts +4 -3
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/license-blacklist.d.ts +3 -0
- package/dist/cjs/license-blacklist.js +86 -0
- package/dist/cjs/player-css-classname.d.ts +1 -1
- package/dist/cjs/player-css-classname.js +5 -2
- package/dist/cjs/use-frame-imperative.d.ts +2 -0
- package/dist/cjs/use-frame-imperative.js +15 -0
- package/dist/cjs/use-playback.d.ts +3 -2
- package/dist/cjs/use-playback.js +8 -8
- package/dist/cjs/use-player.d.ts +1 -4
- package/dist/cjs/use-player.js +22 -9
- package/dist/esm/index.mjs +477 -358
- package/package.json +3 -3
- package/LICENSE.md +0 -49
package/dist/cjs/use-player.d.ts
CHANGED
|
@@ -15,10 +15,7 @@ type UsePlayerMethods = {
|
|
|
15
15
|
isPlaying: () => boolean;
|
|
16
16
|
hasPlayed: boolean;
|
|
17
17
|
isBuffering: () => boolean;
|
|
18
|
-
|
|
19
|
-
* @deprecated Remotion internal API
|
|
20
|
-
*/
|
|
21
|
-
remotionInternal_currentFrameRef: React.MutableRefObject<number>;
|
|
18
|
+
toggle: (e?: SyntheticEvent | PointerEvent) => void;
|
|
22
19
|
};
|
|
23
20
|
export declare const usePlayer: () => UsePlayerMethods;
|
|
24
21
|
export {};
|
package/dist/cjs/use-player.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.usePlayer = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const emitter_context_js_1 = require("./emitter-context.js");
|
|
7
|
+
const use_frame_imperative_js_1 = require("./use-frame-imperative.js");
|
|
7
8
|
const usePlayer = () => {
|
|
8
9
|
var _a;
|
|
9
10
|
const [playing, setPlaying, imperativePlaying] = remotion_1.Internals.Timeline.usePlayingState();
|
|
@@ -123,6 +124,15 @@ const usePlayer = () => {
|
|
|
123
124
|
};
|
|
124
125
|
});
|
|
125
126
|
}, [videoId, imperativePlaying, lastFrame, setFrame]);
|
|
127
|
+
const getCurrentFrame = (0, use_frame_imperative_js_1.useFrameImperative)();
|
|
128
|
+
const toggle = (0, react_1.useCallback)((e) => {
|
|
129
|
+
if (imperativePlaying.current) {
|
|
130
|
+
pause();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
play(e);
|
|
134
|
+
}
|
|
135
|
+
}, [imperativePlaying, pause, play]);
|
|
126
136
|
const returnValue = (0, react_1.useMemo)(() => {
|
|
127
137
|
return {
|
|
128
138
|
frameBack,
|
|
@@ -134,27 +144,30 @@ const usePlayer = () => {
|
|
|
134
144
|
pause,
|
|
135
145
|
seek,
|
|
136
146
|
isFirstFrame,
|
|
137
|
-
getCurrentFrame
|
|
147
|
+
getCurrentFrame,
|
|
138
148
|
isPlaying: () => imperativePlaying.current,
|
|
139
149
|
isBuffering: () => buffering.current,
|
|
140
150
|
pauseAndReturnToPlayStart,
|
|
141
151
|
hasPlayed,
|
|
142
152
|
remotionInternal_currentFrameRef: frameRef,
|
|
153
|
+
toggle,
|
|
143
154
|
};
|
|
144
155
|
}, [
|
|
156
|
+
buffering,
|
|
157
|
+
emitter,
|
|
145
158
|
frameBack,
|
|
146
159
|
frameForward,
|
|
160
|
+
getCurrentFrame,
|
|
161
|
+
hasPlayed,
|
|
162
|
+
imperativePlaying,
|
|
163
|
+
isFirstFrame,
|
|
147
164
|
isLastFrame,
|
|
148
|
-
emitter,
|
|
149
|
-
playing,
|
|
150
|
-
play,
|
|
151
165
|
pause,
|
|
152
|
-
seek,
|
|
153
|
-
isFirstFrame,
|
|
154
166
|
pauseAndReturnToPlayStart,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
167
|
+
play,
|
|
168
|
+
playing,
|
|
169
|
+
seek,
|
|
170
|
+
toggle,
|
|
158
171
|
]);
|
|
159
172
|
return returnValue;
|
|
160
173
|
};
|