@remotion/player 4.0.0-alpha13 → 4.0.0-alpha16
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.d.ts +3 -0
- package/dist/cjs/PlaybackrateControl.js +50 -23
- package/dist/cjs/Player.d.ts +2 -2
- package/dist/cjs/PlayerControls.d.ts +4 -3
- package/dist/cjs/PlayerControls.js +7 -17
- package/dist/cjs/PlayerUI.d.ts +3 -3
- package/dist/cjs/PlayerUI.js +2 -2
- package/dist/cjs/Thumbnail.d.ts +1 -1
- package/dist/cjs/calculate-scale.d.ts +1 -1
- package/dist/cjs/event-emitter.d.ts +16 -16
- package/dist/cjs/icons.d.ts +0 -3
- package/dist/cjs/icons.js +1 -5
- package/dist/cjs/player-methods.d.ts +4 -4
- package/dist/cjs/use-player.d.ts +1 -1
- package/dist/cjs/use-thumbnail.d.ts +1 -1
- package/dist/cjs/use-video-controls-resize.d.ts +1 -1
- package/dist/cjs/utils/cancellable-promise.d.ts +1 -1
- package/dist/cjs/utils/preview-size.d.ts +2 -2
- package/dist/cjs/utils/props-if-has-props.d.ts +1 -1
- package/dist/cjs/utils/use-element-size.d.ts +1 -1
- package/dist/esm/PlaybackrateControl.d.ts +3 -0
- package/dist/esm/Player.d.ts +2 -2
- package/dist/esm/PlayerControls.d.ts +4 -3
- package/dist/esm/PlayerUI.d.ts +3 -3
- package/dist/esm/Thumbnail.d.ts +1 -1
- package/dist/esm/calculate-scale.d.ts +1 -1
- package/dist/esm/event-emitter.d.ts +16 -16
- package/dist/esm/icons.d.ts +0 -3
- package/dist/esm/index.mjs +58 -43
- package/dist/esm/player-methods.d.ts +4 -4
- package/dist/esm/use-player.d.ts +1 -1
- package/dist/esm/use-thumbnail.d.ts +1 -1
- package/dist/esm/use-video-controls-resize.d.ts +1 -1
- package/dist/esm/utils/cancellable-promise.d.ts +1 -1
- package/dist/esm/utils/preview-size.d.ts +2 -2
- package/dist/esm/utils/props-if-has-props.d.ts +1 -1
- package/dist/esm/utils/use-element-size.d.ts +1 -1
- package/dist/tsconfig-esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -712,9 +712,6 @@ const VolumeOffIcon = () => {
|
|
|
712
712
|
const VolumeOnIcon = () => {
|
|
713
713
|
return (jsx("svg", { width: ICON_SIZE, height: ICON_SIZE, viewBox: "0 0 24 24", children: jsx("path", { d: "M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z", fill: "#fff" }) }));
|
|
714
714
|
};
|
|
715
|
-
const SettingsIcon = ({ iconSize }) => {
|
|
716
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", height: iconSize !== null && iconSize !== void 0 ? iconSize : ICON_SIZE, viewBox: "0 0 512 512", style: { fill: '#fff' }, children: jsx("path", { d: "M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z" }) }));
|
|
717
|
-
};
|
|
718
715
|
|
|
719
716
|
const BAR_HEIGHT$1 = 5;
|
|
720
717
|
const KNOB_SIZE$1 = 12;
|
|
@@ -845,17 +842,10 @@ function useComponentVisible(initialIsVisible) {
|
|
|
845
842
|
return { ref, isComponentVisible, setIsComponentVisible };
|
|
846
843
|
}
|
|
847
844
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
bottom: 35,
|
|
853
|
-
background: '#fff',
|
|
854
|
-
borderRadius: 4,
|
|
855
|
-
overflow: 'hidden',
|
|
856
|
-
color: 'black',
|
|
857
|
-
textAlign: 'left',
|
|
858
|
-
};
|
|
845
|
+
// To align
|
|
846
|
+
const BOTTOM = 35;
|
|
847
|
+
// Arbitrary to clamp the height of the popup
|
|
848
|
+
const THRESHOLD = 70;
|
|
859
849
|
const rateDiv = {
|
|
860
850
|
height: 30,
|
|
861
851
|
paddingRight: 15,
|
|
@@ -875,7 +865,7 @@ const checkmarkStyle = {
|
|
|
875
865
|
color: 'black',
|
|
876
866
|
};
|
|
877
867
|
const Checkmark = () => (jsx("svg", { viewBox: "0 0 512 512", style: checkmarkStyle, children: jsx("path", { fill: "currentColor", d: "M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z" }) }));
|
|
878
|
-
const PlaybackPopup = ({ setIsComponentVisible, playbackRates }) => {
|
|
868
|
+
const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
879
869
|
const { setPlaybackRate, playbackRate } = useContext(Internals.Timeline.TimelineContext);
|
|
880
870
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = useState(playbackRate);
|
|
881
871
|
useEffect(() => {
|
|
@@ -924,6 +914,20 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates }) => {
|
|
|
924
914
|
setPlaybackRate(rate);
|
|
925
915
|
setIsComponentVisible(false);
|
|
926
916
|
}, [setIsComponentVisible, setPlaybackRate]);
|
|
917
|
+
const playbackPopup = useMemo(() => {
|
|
918
|
+
return {
|
|
919
|
+
position: 'absolute',
|
|
920
|
+
right: 0,
|
|
921
|
+
width: 125,
|
|
922
|
+
maxHeight: canvasSize.height - THRESHOLD - BOTTOM,
|
|
923
|
+
bottom: 35,
|
|
924
|
+
background: '#fff',
|
|
925
|
+
borderRadius: 4,
|
|
926
|
+
overflow: 'auto',
|
|
927
|
+
color: 'black',
|
|
928
|
+
textAlign: 'left',
|
|
929
|
+
};
|
|
930
|
+
}, [canvasSize.height]);
|
|
927
931
|
return (jsx("div", { style: playbackPopup, children: playbackRates.map((rate) => {
|
|
928
932
|
return (jsx(PlaybackrateOption, { selectedRate: playbackRate, onSelect: onSelect, rate: rate, keyboardSelectedRate: keyboardSelectedRate }, rate));
|
|
929
933
|
}) }));
|
|
@@ -949,24 +953,45 @@ const PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate
|
|
|
949
953
|
}, [hovered, keyboardSelectedRate, rate]);
|
|
950
954
|
return (jsxs("div", { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, tabIndex: 0, style: actualStyle, onClick: onClick, children: [jsx("div", { style: checkmarkContainer, children: rate === selectedRate ? jsx(Checkmark, {}) : null }), rate.toFixed(1), "x"] }, rate));
|
|
951
955
|
};
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
956
|
+
const label = {
|
|
957
|
+
fontSize: 13,
|
|
958
|
+
fontWeight: 'bold',
|
|
959
|
+
color: 'white',
|
|
960
|
+
border: '2px solid white',
|
|
961
|
+
borderRadius: 20,
|
|
962
|
+
paddingLeft: 8,
|
|
963
|
+
paddingRight: 8,
|
|
964
|
+
paddingTop: 2,
|
|
965
|
+
paddingBottom: 2,
|
|
966
|
+
};
|
|
967
|
+
const playerButtonStyle = {
|
|
968
|
+
appearance: 'none',
|
|
969
|
+
backgroundColor: 'transparent',
|
|
957
970
|
border: 'none',
|
|
958
|
-
background: 'none',
|
|
959
|
-
height: 36,
|
|
960
971
|
cursor: 'pointer',
|
|
972
|
+
paddingLeft: 0,
|
|
973
|
+
paddingRight: 0,
|
|
974
|
+
paddingTop: 6,
|
|
975
|
+
paddingBottom: 6,
|
|
976
|
+
height: 37,
|
|
977
|
+
display: 'inline-flex',
|
|
978
|
+
marginBottom: 0,
|
|
979
|
+
marginTop: 0,
|
|
980
|
+
alignItems: 'center',
|
|
981
|
+
};
|
|
982
|
+
const button = {
|
|
983
|
+
...playerButtonStyle,
|
|
984
|
+
position: 'relative',
|
|
961
985
|
};
|
|
962
|
-
const PlaybackrateControl = ({ playbackRates }) => {
|
|
986
|
+
const PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
963
987
|
const { ref, isComponentVisible, setIsComponentVisible } = useComponentVisible(false);
|
|
988
|
+
const { playbackRate } = useContext(Internals.Timeline.TimelineContext);
|
|
964
989
|
const onClick = useCallback((e) => {
|
|
965
990
|
e.stopPropagation();
|
|
966
991
|
e.preventDefault();
|
|
967
992
|
setIsComponentVisible(!isComponentVisible);
|
|
968
993
|
}, [isComponentVisible, setIsComponentVisible]);
|
|
969
|
-
return (jsx("div", { ref: ref, children: jsxs("button", { type: "button", "aria-label": "Change playback rate", style:
|
|
994
|
+
return (jsx("div", { ref: ref, children: jsxs("button", { type: "button", "aria-label": "Change playback rate", style: button, onClick: onClick, children: [jsxs("div", { style: label, children: [playbackRate, "x"] }), isComponentVisible && (jsx(PlaybackPopup, { canvasSize: canvasSize, playbackRates: playbackRates, setIsComponentVisible: setIsComponentVisible }))] }) }));
|
|
970
995
|
};
|
|
971
996
|
|
|
972
997
|
const getFrameFromX = (clientX, durationInFrames, width) => {
|
|
@@ -1167,20 +1192,6 @@ const containerStyle = {
|
|
|
1167
1192
|
flexDirection: 'column',
|
|
1168
1193
|
transition: 'opacity 0.3s',
|
|
1169
1194
|
};
|
|
1170
|
-
const buttonStyle = {
|
|
1171
|
-
appearance: 'none',
|
|
1172
|
-
backgroundColor: 'transparent',
|
|
1173
|
-
border: 'none',
|
|
1174
|
-
cursor: 'pointer',
|
|
1175
|
-
paddingLeft: 0,
|
|
1176
|
-
paddingRight: 0,
|
|
1177
|
-
paddingTop: 6,
|
|
1178
|
-
paddingBottom: 6,
|
|
1179
|
-
height: 37,
|
|
1180
|
-
display: 'inline',
|
|
1181
|
-
marginBottom: 0,
|
|
1182
|
-
marginTop: 0,
|
|
1183
|
-
};
|
|
1184
1195
|
const controlsRow = {
|
|
1185
1196
|
display: 'flex',
|
|
1186
1197
|
flexDirection: 'row',
|
|
@@ -1206,11 +1217,15 @@ const flex1 = {
|
|
|
1206
1217
|
};
|
|
1207
1218
|
const fullscreen = {};
|
|
1208
1219
|
const PlayPauseButton = ({ playing }) => playing ? jsx(PauseIcon, {}) : jsx(PlayIcon, {});
|
|
1209
|
-
const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVolumeControls, onFullscreenButtonClick, allowFullscreen, onExitFullscreenButtonClick, spaceKeyToPlayOrPause, onSeekEnd, onSeekStart, inFrame, outFrame, initiallyShowControls,
|
|
1220
|
+
const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVolumeControls, onFullscreenButtonClick, allowFullscreen, onExitFullscreenButtonClick, spaceKeyToPlayOrPause, onSeekEnd, onSeekStart, inFrame, outFrame, initiallyShowControls, canvasSize, renderPlayPauseButton, renderFullscreenButton, alwaysShowControls, showPlaybackRateControl, }) => {
|
|
1221
|
+
var _a;
|
|
1210
1222
|
const playButtonRef = useRef(null);
|
|
1211
1223
|
const frame = Internals.Timeline.useTimelinePosition();
|
|
1212
1224
|
const [supportsFullscreen, setSupportsFullscreen] = useState(false);
|
|
1213
|
-
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
|
|
1225
|
+
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
|
|
1226
|
+
allowFullscreen,
|
|
1227
|
+
playerWidth: (_a = canvasSize === null || canvasSize === void 0 ? void 0 : canvasSize.width) !== null && _a !== void 0 ? _a : 0,
|
|
1228
|
+
});
|
|
1214
1229
|
const [shouldShowInitially, setInitiallyShowControls] = useState(() => {
|
|
1215
1230
|
if (typeof initiallyShowControls === 'boolean') {
|
|
1216
1231
|
return initiallyShowControls;
|
|
@@ -1293,7 +1308,7 @@ const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVo
|
|
|
1293
1308
|
}
|
|
1294
1309
|
return null;
|
|
1295
1310
|
}, [showPlaybackRateControl]);
|
|
1296
|
-
return (jsxs("div", { style: containerCss, children: [jsxs("div", { style: controlsRow, children: [jsxs("div", { style: leftPartStyle, children: [jsx("button", { ref: playButtonRef, type: "button", style:
|
|
1311
|
+
return (jsxs("div", { style: containerCss, children: [jsxs("div", { style: controlsRow, children: [jsxs("div", { style: leftPartStyle, children: [jsx("button", { ref: playButtonRef, type: "button", style: playerButtonStyle, onClick: player.playing ? player.pause : player.play, "aria-label": player.playing ? 'Pause video' : 'Play video', title: player.playing ? 'Pause video' : 'Play video', children: renderPlayPauseButton === null ? (jsx(PlayPauseButton, { playing: player.playing })) : (renderPlayPauseButton({ playing: player.playing })) }), showVolumeControls ? (jsxs(Fragment, { children: [jsx("div", { style: xSpacer }), jsx(MediaVolumeSlider, { displayVerticalVolumeSlider: displayVerticalVolumeSlider })] })) : null, jsx("div", { style: xSpacer }), jsxs("div", { style: timeLabel, children: [formatTime(frame / fps), " / ", formatTime(durationInFrames / fps)] }), jsx("div", { style: xSpacer })] }), jsx("div", { style: flex1 }), playbackRates && canvasSize && (jsx(PlaybackrateControl, { canvasSize: canvasSize, playbackRates: playbackRates })), playbackRates && supportsFullscreen && allowFullscreen ? (jsx("div", { style: xSpacer })) : null, jsx("div", { style: fullscreen, children: supportsFullscreen && allowFullscreen ? (jsx("button", { type: "button", "aria-label": isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', title: isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', style: playerButtonStyle, onClick: isFullscreen
|
|
1297
1312
|
? onExitFullscreenButtonClick
|
|
1298
1313
|
: onFullscreenButtonClick, children: renderFullscreenButton === null ? (jsx(FullscreenIcon, { isFullscreen: isFullscreen })) : (renderFullscreenButton({ isFullscreen })) })) : null })] }), jsx("div", { style: ySpacer }), jsx(PlayerSeekBar, { onSeekEnd: onSeekEnd, onSeekStart: onSeekStart, durationInFrames: durationInFrames, inFrame: inFrame, outFrame: outFrame })] }));
|
|
1299
1314
|
};
|
|
@@ -1387,7 +1402,7 @@ if (reactVersion$1 === '0') {
|
|
|
1387
1402
|
}
|
|
1388
1403
|
const doesReactVersionSupportSuspense$1 = parseInt(reactVersion$1, 10) >= 18;
|
|
1389
1404
|
const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps, clickToPlay, showVolumeControls, doubleClickToFullscreen, spaceKeyToPlayOrPause, errorFallback, playbackRate, renderLoading, renderPoster, className, moveToBeginningWhenEnded, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, inFrame, outFrame, initiallyShowControls, renderFullscreen: renderFullscreenButton, renderPlayPauseButton, alwaysShowControls, showPlaybackRateControl, }, ref) => {
|
|
1390
|
-
var _a, _b, _c
|
|
1405
|
+
var _a, _b, _c;
|
|
1391
1406
|
const config = Internals.useUnsafeVideoConfig();
|
|
1392
1407
|
const video = Internals.useVideo();
|
|
1393
1408
|
const container = useRef(null);
|
|
@@ -1662,7 +1677,7 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
1662
1677
|
showPosterWhenEnded && player.isLastFrame && !player.isPlaying(),
|
|
1663
1678
|
showPosterWhenUnplayed && !player.hasPlayed && !player.isPlaying(),
|
|
1664
1679
|
].some(Boolean);
|
|
1665
|
-
const content = (jsxs(Fragment, { children: [jsx("div", { style: outer, onClick: clickToPlay ? handleClick : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: jsx("div", { style: containerStyle, className: PLAYER_CSS_CLASSNAME, children: VideoComponent ? (jsx(ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: jsx(VideoComponent, { ...((_c = video === null || video === void 0 ? void 0 : video.defaultProps) !== null && _c !== void 0 ? _c : {}), ...(inputProps !== null && inputProps !== void 0 ? inputProps : {}) }) })) : null }) }), shouldShowPoster ? (jsx("div", { style: outer, onClick: clickToPlay ? handleClick : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null, controls ? (jsx(Controls, { fps: config.fps, durationInFrames: config.durationInFrames, hovered: hovered, player: player, onFullscreenButtonClick: onFullscreenButtonClick, isFullscreen: isFullscreen, allowFullscreen: allowFullscreen, showVolumeControls: showVolumeControls, onExitFullscreenButtonClick: onExitFullscreenButtonClick, spaceKeyToPlayOrPause: spaceKeyToPlayOrPause, onSeekEnd: onSeekEnd, onSeekStart: onSeekStart, inFrame: inFrame, outFrame: outFrame, initiallyShowControls: initiallyShowControls,
|
|
1680
|
+
const content = (jsxs(Fragment, { children: [jsx("div", { style: outer, onClick: clickToPlay ? handleClick : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: jsx("div", { style: containerStyle, className: PLAYER_CSS_CLASSNAME, children: VideoComponent ? (jsx(ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: jsx(VideoComponent, { ...((_c = video === null || video === void 0 ? void 0 : video.defaultProps) !== null && _c !== void 0 ? _c : {}), ...(inputProps !== null && inputProps !== void 0 ? inputProps : {}) }) })) : null }) }), shouldShowPoster ? (jsx("div", { style: outer, onClick: clickToPlay ? handleClick : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null, controls ? (jsx(Controls, { fps: config.fps, durationInFrames: config.durationInFrames, hovered: hovered, player: player, onFullscreenButtonClick: onFullscreenButtonClick, isFullscreen: isFullscreen, allowFullscreen: allowFullscreen, showVolumeControls: showVolumeControls, onExitFullscreenButtonClick: onExitFullscreenButtonClick, spaceKeyToPlayOrPause: spaceKeyToPlayOrPause, onSeekEnd: onSeekEnd, onSeekStart: onSeekStart, inFrame: inFrame, outFrame: outFrame, initiallyShowControls: initiallyShowControls, canvasSize: canvasSize, renderFullscreenButton: renderFullscreenButton, renderPlayPauseButton: renderPlayPauseButton, alwaysShowControls: alwaysShowControls, showPlaybackRateControl: showPlaybackRateControl })) : null] }));
|
|
1666
1681
|
if (IS_NODE && !doesReactVersionSupportSuspense$1) {
|
|
1667
1682
|
return (jsx("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
1668
1683
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { SyntheticEvent } from 'react';
|
|
2
2
|
import type { PlayerEmitter } from './event-emitter.js';
|
|
3
|
-
export
|
|
3
|
+
export type ThumbnailMethods = {
|
|
4
4
|
getContainerNode: () => HTMLDivElement | null;
|
|
5
5
|
getScale: () => number;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type PlayerMethods = ThumbnailMethods & {
|
|
8
8
|
play: (e?: SyntheticEvent) => void;
|
|
9
9
|
pause: () => void;
|
|
10
10
|
toggle: (e?: SyntheticEvent) => void;
|
|
@@ -20,5 +20,5 @@ export declare type PlayerMethods = ThumbnailMethods & {
|
|
|
20
20
|
mute: () => void;
|
|
21
21
|
unmute: () => void;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
24
|
-
export
|
|
23
|
+
export type ThumbnailRef = PlayerEmitter & ThumbnailMethods;
|
|
24
|
+
export type PlayerRef = PlayerEmitter & PlayerMethods;
|
package/dist/esm/use-player.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SyntheticEvent } from 'react';
|
|
2
2
|
import type { PlayerEmitter } from './event-emitter.js';
|
|
3
|
-
|
|
3
|
+
type UsePlayerMethods = {
|
|
4
4
|
frameBack: (frames: number) => void;
|
|
5
5
|
frameForward: (frames: number) => void;
|
|
6
6
|
isLastFrame: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyZodObject, z } from 'zod';
|
|
2
|
-
export
|
|
2
|
+
export type PropsIfHasProps<Schema extends AnyZodObject, Props> = AnyZodObject extends Schema ? {} extends Props ? {
|
|
3
3
|
inputProps?: z.infer<Schema> & Props;
|
|
4
4
|
} : {
|
|
5
5
|
inputProps: Props;
|