@remotion/player 4.0.0-fastlambda.7 → 4.0.0-forcepublish.6
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/MediaVolumeSlider.js +1 -1
- package/dist/Player.d.ts +9 -6
- package/dist/Player.js +9 -6
- package/dist/PlayerControls.d.ts +13 -2
- package/dist/PlayerControls.js +12 -4
- package/dist/PlayerSeekBar.js +13 -5
- package/dist/PlayerUI.d.ts +3 -1
- package/dist/PlayerUI.js +69 -10
- package/dist/calculate-scale.d.ts +2 -2
- package/dist/emitter-context.d.ts +1 -1
- package/dist/error-boundary.js +1 -1
- package/dist/event-emitter.d.ts +5 -0
- package/dist/event-emitter.js +4 -0
- package/dist/icons.js +8 -8
- package/dist/index.d.ts +8 -2
- package/dist/player-methods.d.ts +2 -2
- package/dist/test/test-utils.d.ts +3 -3
- package/dist/test/test-utils.js +7 -3
- package/dist/test/validate-prop.test.js +13 -13
- package/dist/use-playback.d.ts +4 -1
- package/dist/use-playback.js +4 -3
- package/dist/use-player.d.ts +8 -4
- package/dist/use-player.js +19 -4
- package/dist/utils/calculate-player-size.d.ts +2 -2
- package/dist/utils/use-cancellable-promises.d.ts +1 -1
- package/dist/utils/use-click-prevention-on-double-click.d.ts +1 -1
- package/dist/utils/use-element-size.d.ts +4 -0
- package/dist/utils/use-element-size.js +8 -0
- package/package.json +5 -5
- package/dist/MediaVolumeSlider.d.ts.map +0 -1
- package/dist/MediaVolumeSlider.js.map +0 -1
- package/dist/Player.d.ts.map +0 -1
- package/dist/Player.js.map +0 -1
- package/dist/PlayerControls.d.ts.map +0 -1
- package/dist/PlayerControls.js.map +0 -1
- package/dist/PlayerSeekBar.d.ts.map +0 -1
- package/dist/PlayerSeekBar.js.map +0 -1
- package/dist/PlayerUI.d.ts.map +0 -1
- package/dist/PlayerUI.js.map +0 -1
- package/dist/calculate-next-frame.d.ts.map +0 -1
- package/dist/calculate-next-frame.js.map +0 -1
- package/dist/calculate-scale.d.ts.map +0 -1
- package/dist/calculate-scale.js.map +0 -1
- package/dist/emitter-context.d.ts.map +0 -1
- package/dist/emitter-context.js.map +0 -1
- package/dist/error-boundary.d.ts.map +0 -1
- package/dist/error-boundary.js.map +0 -1
- package/dist/event-emitter.d.ts.map +0 -1
- package/dist/event-emitter.js.map +0 -1
- package/dist/format-time.d.ts.map +0 -1
- package/dist/format-time.js.map +0 -1
- package/dist/icons.d.ts.map +0 -1
- package/dist/icons.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/player-css-classname.d.ts.map +0 -1
- package/dist/player-css-classname.js.map +0 -1
- package/dist/player-methods.d.ts.map +0 -1
- package/dist/player-methods.js.map +0 -1
- package/dist/test/index.test.d.ts.map +0 -1
- package/dist/test/index.test.js.map +0 -1
- package/dist/test/test-utils.d.ts.map +0 -1
- package/dist/test/test-utils.js.map +0 -1
- package/dist/test/validate-prop.test.d.ts.map +0 -1
- package/dist/test/validate-prop.test.js.map +0 -1
- package/dist/use-hover-state.d.ts.map +0 -1
- package/dist/use-hover-state.js.map +0 -1
- package/dist/use-playback.d.ts.map +0 -1
- package/dist/use-playback.js.map +0 -1
- package/dist/use-player.d.ts.map +0 -1
- package/dist/use-player.js.map +0 -1
- package/dist/utils/browser-supports-fullscreen.d.ts +0 -11
- package/dist/utils/browser-supports-fullscreen.d.ts.map +0 -1
- package/dist/utils/browser-supports-fullscreen.js +0 -5
- package/dist/utils/browser-supports-fullscreen.js.map +0 -1
- package/dist/utils/calculate-player-size.d.ts.map +0 -1
- package/dist/utils/calculate-player-size.js.map +0 -1
- package/dist/utils/cancellable-promise.d.ts.map +0 -1
- package/dist/utils/cancellable-promise.js.map +0 -1
- package/dist/utils/delay.d.ts.map +0 -1
- package/dist/utils/delay.js.map +0 -1
- package/dist/utils/is-node.d.ts.map +0 -1
- package/dist/utils/is-node.js.map +0 -1
- package/dist/utils/preview-size.d.ts.map +0 -1
- package/dist/utils/preview-size.js.map +0 -1
- package/dist/utils/use-cancellable-promises.d.ts.map +0 -1
- package/dist/utils/use-cancellable-promises.js.map +0 -1
- package/dist/utils/use-click-prevention-on-double-click.d.ts.map +0 -1
- package/dist/utils/use-click-prevention-on-double-click.js.map +0 -1
- package/dist/utils/use-element-size.d.ts.map +0 -1
- package/dist/utils/use-element-size.js.map +0 -1
- package/dist/utils/validate-playbackrate.d.ts.map +0 -1
- package/dist/utils/validate-playbackrate.js.map +0 -1
- package/dist/volume-persistance.d.ts.map +0 -1
- package/dist/volume-persistance.js.map +0 -1
|
@@ -88,6 +88,6 @@ const MediaVolumeSlider = () => {
|
|
|
88
88
|
}
|
|
89
89
|
setMediaMuted((mute) => !mute);
|
|
90
90
|
}, [mediaVolume, setMediaMuted, setMediaVolume]);
|
|
91
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: parentDivRef, style: parentDivStyle, children: [(0, jsx_runtime_1.jsx)("button", { "aria-label": isMutedOrZero ? 'Unmute sound' : 'Mute sound', title: isMutedOrZero ? 'Unmute sound' : 'Mute sound', onClick: onClick, onBlur: onBlur, onFocus: () => setFocused(true), style: volumeContainer, type: "button", children: isMutedOrZero ? (0, jsx_runtime_1.jsx)(icons_1.VolumeOffIcon, {}
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: parentDivRef, style: parentDivStyle, children: [(0, jsx_runtime_1.jsx)("button", { "aria-label": isMutedOrZero ? 'Unmute sound' : 'Mute sound', title: isMutedOrZero ? 'Unmute sound' : 'Mute sound', onClick: onClick, onBlur: onBlur, onFocus: () => setFocused(true), style: volumeContainer, type: "button", children: isMutedOrZero ? (0, jsx_runtime_1.jsx)(icons_1.VolumeOffIcon, {}) : (0, jsx_runtime_1.jsx)(icons_1.VolumeOnIcon, {}) }), (focused || hover) && !mediaMuted ? ((0, jsx_runtime_1.jsx)("input", { ref: inputRef, "aria-label": "Change volume", className: player_css_classname_1.VOLUME_SLIDER_INPUT_CSS_CLASSNAME, max: 1, min: 0, onBlur: () => setFocused(false), onChange: onVolumeChange, step: 0.01, type: "range", value: mediaVolume })) : null] }));
|
|
92
92
|
};
|
|
93
93
|
exports.MediaVolumeSlider = MediaVolumeSlider;
|
package/dist/Player.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { ComponentType, MutableRefObject } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { CompProps } from 'remotion';
|
|
4
|
+
import type { PlayerRef } from './player-methods';
|
|
5
|
+
import type { RenderLoading } from './PlayerUI';
|
|
5
6
|
declare type PropsIfHasProps<Props> = {} extends Props ? {
|
|
6
7
|
inputProps?: Props;
|
|
7
8
|
} : {
|
|
@@ -28,9 +29,11 @@ export declare type PlayerProps<T> = {
|
|
|
28
29
|
numberOfSharedAudioTags?: number;
|
|
29
30
|
playbackRate?: number;
|
|
30
31
|
renderLoading?: RenderLoading;
|
|
32
|
+
moveToBeginningWhenEnded?: boolean;
|
|
33
|
+
className?: string;
|
|
31
34
|
} & PropsIfHasProps<T> & CompProps<T>;
|
|
32
|
-
export declare const componentOrNullIfLazy: <T>(props: CompProps<T>) =>
|
|
33
|
-
export declare const PlayerFn: <T>({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls, loop, autoPlay, showVolumeControls, allowFullscreen, clickToPlay, doubleClickToFullscreen, spaceKeyToPlayOrPause, numberOfSharedAudioTags, errorFallback, playbackRate, renderLoading, ...componentProps }: PlayerProps<T>, ref: MutableRefObject<PlayerRef>) => JSX.Element;
|
|
35
|
+
export declare const componentOrNullIfLazy: <T>(props: CompProps<T>) => ComponentType<T> | null;
|
|
36
|
+
export declare const PlayerFn: <T>({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls, loop, autoPlay, showVolumeControls, allowFullscreen, clickToPlay, doubleClickToFullscreen, spaceKeyToPlayOrPause, moveToBeginningWhenEnded, numberOfSharedAudioTags, errorFallback, playbackRate, renderLoading, className, ...componentProps }: PlayerProps<T>, ref: MutableRefObject<PlayerRef>) => JSX.Element;
|
|
34
37
|
declare module 'react' {
|
|
35
38
|
function forwardRef<T, P = {}>(render: (props: P, ref: React.MutableRefObject<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
|
|
36
39
|
}
|
package/dist/Player.js
CHANGED
|
@@ -13,7 +13,6 @@ const player_css_classname_1 = require("./player-css-classname");
|
|
|
13
13
|
const PlayerUI_1 = __importDefault(require("./PlayerUI"));
|
|
14
14
|
const validate_playbackrate_1 = require("./utils/validate-playbackrate");
|
|
15
15
|
const volume_persistance_1 = require("./volume-persistance");
|
|
16
|
-
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${player_css_classname_1.PLAYER_CSS_CLASSNAME}`, '#fff'));
|
|
17
16
|
const componentOrNullIfLazy = (props) => {
|
|
18
17
|
if ('component' in props) {
|
|
19
18
|
return props.component;
|
|
@@ -21,7 +20,7 @@ const componentOrNullIfLazy = (props) => {
|
|
|
21
20
|
return null;
|
|
22
21
|
};
|
|
23
22
|
exports.componentOrNullIfLazy = componentOrNullIfLazy;
|
|
24
|
-
const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls = false, loop = false, autoPlay = false, showVolumeControls = true, allowFullscreen = true, clickToPlay, doubleClickToFullscreen = false, spaceKeyToPlayOrPause = true, numberOfSharedAudioTags = 5, errorFallback = () => '⚠️', playbackRate = 1, renderLoading, ...componentProps }, ref) => {
|
|
23
|
+
const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls = false, loop = false, autoPlay = false, showVolumeControls = true, allowFullscreen = true, clickToPlay, doubleClickToFullscreen = false, spaceKeyToPlayOrPause = true, moveToBeginningWhenEnded = true, numberOfSharedAudioTags = 5, errorFallback = () => '⚠️', playbackRate = 1, renderLoading, className, ...componentProps }, ref) => {
|
|
25
24
|
if (typeof window !== 'undefined') {
|
|
26
25
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
26
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -59,7 +58,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
59
58
|
remotion_1.Internals.validateDimension(compositionHeight, 'compositionHeight', 'of the <Player /> component');
|
|
60
59
|
remotion_1.Internals.validateDimension(compositionWidth, 'compositionWidth', 'of the <Player /> component');
|
|
61
60
|
remotion_1.Internals.validateDurationInFrames(durationInFrames, 'of the <Player/> component');
|
|
62
|
-
remotion_1.Internals.validateFps(fps, 'as a prop of the <Player/> component');
|
|
61
|
+
remotion_1.Internals.validateFps(fps, 'as a prop of the <Player/> component', false);
|
|
63
62
|
if (typeof controls !== 'boolean' && typeof controls !== 'undefined') {
|
|
64
63
|
throw new TypeError(`'controls' must be a boolean or undefined but got '${typeof controls}' instead`);
|
|
65
64
|
}
|
|
@@ -179,9 +178,13 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
179
178
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
180
179
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
181
180
|
}, [inputProps]);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
182
|
+
// Inject CSS only on client, and also only after the Player has hydrated
|
|
183
|
+
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${player_css_classname_1.PLAYER_CSS_CLASSNAME}`, '#fff'));
|
|
184
|
+
}, []);
|
|
185
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CompositionManager.Provider, { value: compositionManagerContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.MediaVolumeContext.Provider, { value: mediaVolumeContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetMediaVolumeContext.Provider, { value: setMediaVolumeContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: (0, jsx_runtime_1.jsx)(emitter_context_1.PlayerEventEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(PlayerUI_1.default, { ref: rootRef, renderLoading: renderLoading, autoPlay: Boolean(autoPlay), loop: Boolean(loop), controls: Boolean(controls), errorFallback: errorFallback, style: style, inputProps: passedInputProps, allowFullscreen: Boolean(allowFullscreen), moveToBeginningWhenEnded: Boolean(moveToBeginningWhenEnded), clickToPlay: typeof clickToPlay === 'boolean'
|
|
186
|
+
? clickToPlay
|
|
187
|
+
: Boolean(controls), showVolumeControls: Boolean(showVolumeControls), setMediaVolume: setMediaVolumeAndPersist, mediaVolume: mediaVolume, mediaMuted: mediaMuted, doubleClickToFullscreen: Boolean(doubleClickToFullscreen), setMediaMuted: setMediaMuted, spaceKeyToPlayOrPause: Boolean(spaceKeyToPlayOrPause), playbackRate: playbackRate, className: className !== null && className !== void 0 ? className : undefined }) }) }) }) }) }) }) }) }));
|
|
185
188
|
};
|
|
186
189
|
exports.PlayerFn = PlayerFn;
|
|
187
190
|
exports.Player = (0, react_1.forwardRef)(exports.PlayerFn);
|
package/dist/PlayerControls.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import type { MouseEventHandler } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { usePlayer } from './use-player';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Document {
|
|
6
|
+
webkitFullscreenEnabled?: boolean;
|
|
7
|
+
webkitFullscreenElement?: Element;
|
|
8
|
+
webkitExitFullscreen?: Document['exitFullscreen'];
|
|
9
|
+
}
|
|
10
|
+
interface HTMLDivElement {
|
|
11
|
+
webkitRequestFullScreen: HTMLDivElement['requestFullscreen'];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
3
14
|
export declare const Controls: React.FC<{
|
|
4
15
|
fps: number;
|
|
5
16
|
durationInFrames: number;
|
package/dist/PlayerControls.js
CHANGED
|
@@ -8,7 +8,6 @@ const format_time_1 = require("./format-time");
|
|
|
8
8
|
const icons_1 = require("./icons");
|
|
9
9
|
const MediaVolumeSlider_1 = require("./MediaVolumeSlider");
|
|
10
10
|
const PlayerSeekBar_1 = require("./PlayerSeekBar");
|
|
11
|
-
const browser_supports_fullscreen_1 = require("./utils/browser-supports-fullscreen");
|
|
12
11
|
const containerStyle = {
|
|
13
12
|
boxSizing: 'border-box',
|
|
14
13
|
position: 'absolute',
|
|
@@ -66,6 +65,7 @@ const timeLabel = {
|
|
|
66
65
|
const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVolumeControls, onFullscreenButtonClick, allowFullscreen, onExitFullscreenButtonClick, spaceKeyToPlayOrPause, }) => {
|
|
67
66
|
const playButtonRef = (0, react_1.useRef)(null);
|
|
68
67
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
68
|
+
const [supportsFullscreen, setSupportsFullscreen] = (0, react_1.useState)(false);
|
|
69
69
|
const containerCss = (0, react_1.useMemo)(() => {
|
|
70
70
|
// Hide if playing and mouse outside
|
|
71
71
|
const shouldShow = hovered || !player.playing;
|
|
@@ -77,11 +77,19 @@ const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVo
|
|
|
77
77
|
(0, react_1.useEffect)(() => {
|
|
78
78
|
if (playButtonRef.current && spaceKeyToPlayOrPause) {
|
|
79
79
|
// This switches focus to play button when player.playing flag changes
|
|
80
|
-
playButtonRef.current.focus(
|
|
80
|
+
playButtonRef.current.focus({
|
|
81
|
+
preventScroll: true,
|
|
82
|
+
});
|
|
81
83
|
}
|
|
82
84
|
}, [player.playing, spaceKeyToPlayOrPause]);
|
|
83
|
-
|
|
85
|
+
(0, react_1.useEffect)(() => {
|
|
86
|
+
var _a;
|
|
87
|
+
// Must be handled client-side to avoid SSR hydration mismatch
|
|
88
|
+
setSupportsFullscreen((_a = (typeof document !== 'undefined' &&
|
|
89
|
+
(document.fullscreenEnabled || document.webkitFullscreenEnabled))) !== null && _a !== void 0 ? _a : false);
|
|
90
|
+
}, []);
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: containerCss, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlsRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftPartStyle, children: [(0, jsx_runtime_1.jsx)("button", { ref: playButtonRef, type: "button", style: buttonStyle, onClick: player.playing ? player.pause : player.play, "aria-label": player.playing ? 'Pause video' : 'Play video', title: player.playing ? 'Pause video' : 'Play video', children: player.playing ? (0, jsx_runtime_1.jsx)(icons_1.PauseIcon, {}) : (0, jsx_runtime_1.jsx)(icons_1.PlayIcon, {}) }), showVolumeControls ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsx)(MediaVolumeSlider_1.MediaVolumeSlider, {})] })) : null, (0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsxs)("div", { style: timeLabel, children: [(0, format_time_1.formatTime)(frame / fps), " / ", (0, format_time_1.formatTime)(durationInFrames / fps)] }), (0, jsx_runtime_1.jsx)("div", { style: xSpacer })] }), (0, jsx_runtime_1.jsx)("div", { style: flex1 }), (0, jsx_runtime_1.jsx)("div", { style: fullscreen, children: supportsFullscreen && allowFullscreen ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "aria-label": isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', title: isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', style: buttonStyle, onClick: isFullscreen
|
|
84
92
|
? onExitFullscreenButtonClick
|
|
85
|
-
: onFullscreenButtonClick, children: (0, jsx_runtime_1.jsx)(icons_1.FullscreenIcon, { minimized: !isFullscreen }
|
|
93
|
+
: onFullscreenButtonClick, children: (0, jsx_runtime_1.jsx)(icons_1.FullscreenIcon, { minimized: !isFullscreen }) })) : null })] }), (0, jsx_runtime_1.jsx)("div", { style: ySpacer }), (0, jsx_runtime_1.jsx)(PlayerSeekBar_1.PlayerSeekBar, { durationInFrames: durationInFrames })] }));
|
|
86
94
|
};
|
|
87
95
|
exports.Controls = Controls;
|
package/dist/PlayerSeekBar.js
CHANGED
|
@@ -34,6 +34,13 @@ const barBackground = {
|
|
|
34
34
|
width: '100%',
|
|
35
35
|
borderRadius: BAR_HEIGHT / 2,
|
|
36
36
|
};
|
|
37
|
+
const findBodyInWhichDivIsLocated = (div) => {
|
|
38
|
+
let current = div;
|
|
39
|
+
while (current.parentElement) {
|
|
40
|
+
current = current.parentElement;
|
|
41
|
+
}
|
|
42
|
+
return current;
|
|
43
|
+
};
|
|
37
44
|
const PlayerSeekBar = ({ durationInFrames }) => {
|
|
38
45
|
const containerRef = (0, react_1.useRef)(null);
|
|
39
46
|
const barHovered = (0, use_hover_state_1.useHoverState)(containerRef);
|
|
@@ -87,11 +94,12 @@ const PlayerSeekBar = ({ durationInFrames }) => {
|
|
|
87
94
|
if (!dragging.dragging) {
|
|
88
95
|
return;
|
|
89
96
|
}
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
const body = findBodyInWhichDivIsLocated(containerRef.current);
|
|
98
|
+
body.addEventListener('pointermove', onPointerMove);
|
|
99
|
+
body.addEventListener('pointerup', onPointerUp);
|
|
92
100
|
return () => {
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
body.removeEventListener('pointermove', onPointerMove);
|
|
102
|
+
body.removeEventListener('pointerup', onPointerUp);
|
|
95
103
|
};
|
|
96
104
|
}, [dragging.dragging, onPointerMove, onPointerUp]);
|
|
97
105
|
const knobStyle = (0, react_1.useMemo)(() => {
|
|
@@ -117,6 +125,6 @@ const PlayerSeekBar = ({ durationInFrames }) => {
|
|
|
117
125
|
borderRadius: BAR_HEIGHT / 2,
|
|
118
126
|
};
|
|
119
127
|
}, [durationInFrames, frame]);
|
|
120
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: containerRef, onPointerDown: onPointerDown, style: containerStyle, children: [(0, jsx_runtime_1.jsx)("div", { style: barBackground, children: (0, jsx_runtime_1.jsx)("div", { style: fillStyle }
|
|
128
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: containerRef, onPointerDown: onPointerDown, style: containerStyle, children: [(0, jsx_runtime_1.jsx)("div", { style: barBackground, children: (0, jsx_runtime_1.jsx)("div", { style: fillStyle }) }), (0, jsx_runtime_1.jsx)("div", { style: knobStyle })] }));
|
|
121
129
|
};
|
|
122
130
|
exports.PlayerSeekBar = PlayerSeekBar;
|
package/dist/PlayerUI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PlayerRef } from './player-methods';
|
|
2
|
+
import type { PlayerRef } from './player-methods';
|
|
3
3
|
export declare type ErrorFallback = (info: {
|
|
4
4
|
error: Error;
|
|
5
5
|
}) => React.ReactNode;
|
|
@@ -25,5 +25,7 @@ declare const _default: (props: {
|
|
|
25
25
|
errorFallback: ErrorFallback;
|
|
26
26
|
playbackRate: number;
|
|
27
27
|
renderLoading?: RenderLoading | undefined;
|
|
28
|
+
className: string | undefined;
|
|
29
|
+
moveToBeginningWhenEnded: boolean;
|
|
28
30
|
} & React.RefAttributes<PlayerRef | null>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
29
31
|
export default _default;
|
package/dist/PlayerUI.js
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const react_1 = require("react");
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
5
28
|
const remotion_1 = require("remotion");
|
|
6
29
|
const calculate_scale_1 = require("./calculate-scale");
|
|
7
30
|
const error_boundary_1 = require("./error-boundary");
|
|
@@ -10,12 +33,16 @@ const PlayerControls_1 = require("./PlayerControls");
|
|
|
10
33
|
const use_hover_state_1 = require("./use-hover-state");
|
|
11
34
|
const use_playback_1 = require("./use-playback");
|
|
12
35
|
const use_player_1 = require("./use-player");
|
|
13
|
-
const browser_supports_fullscreen_1 = require("./utils/browser-supports-fullscreen");
|
|
14
36
|
const calculate_player_size_1 = require("./utils/calculate-player-size");
|
|
15
37
|
const is_node_1 = require("./utils/is-node");
|
|
16
38
|
const use_click_prevention_on_double_click_1 = require("./utils/use-click-prevention-on-double-click");
|
|
17
39
|
const use_element_size_1 = require("./utils/use-element-size");
|
|
18
|
-
const
|
|
40
|
+
const reactVersion = react_1.default.version.split('.')[0];
|
|
41
|
+
if (reactVersion === '0') {
|
|
42
|
+
throw new Error(`Version ${reactVersion} of "react" is not supported by Remotion`);
|
|
43
|
+
}
|
|
44
|
+
const doesReactVersionSupportSuspense = parseInt(reactVersion, 10) >= 18;
|
|
45
|
+
const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps, clickToPlay, showVolumeControls, mediaVolume, mediaMuted, doubleClickToFullscreen, setMediaMuted, setMediaVolume, spaceKeyToPlayOrPause, errorFallback, playbackRate, renderLoading, className, moveToBeginningWhenEnded, }, ref) => {
|
|
19
46
|
var _a, _b, _c;
|
|
20
47
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
21
48
|
const video = remotion_1.Internals.useVideo();
|
|
@@ -28,7 +55,13 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
28
55
|
const [hasPausedToResume, setHasPausedToResume] = (0, react_1.useState)(false);
|
|
29
56
|
const [shouldAutoplay, setShouldAutoPlay] = (0, react_1.useState)(autoPlay);
|
|
30
57
|
const [isFullscreen, setIsFullscreen] = (0, react_1.useState)(() => false);
|
|
31
|
-
(0, use_playback_1.usePlayback)({
|
|
58
|
+
(0, use_playback_1.usePlayback)({
|
|
59
|
+
loop,
|
|
60
|
+
playbackRate,
|
|
61
|
+
moveToBeginningWhenEnded,
|
|
62
|
+
inFrame: null,
|
|
63
|
+
outFrame: null,
|
|
64
|
+
});
|
|
32
65
|
const player = (0, use_player_1.usePlayer)();
|
|
33
66
|
(0, react_1.useEffect)(() => {
|
|
34
67
|
if (hasPausedToResume && !player.playing) {
|
|
@@ -64,7 +97,8 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
64
97
|
if (!allowFullscreen) {
|
|
65
98
|
throw new Error('allowFullscreen is false');
|
|
66
99
|
}
|
|
67
|
-
|
|
100
|
+
const supportsFullScreen = document.fullscreenEnabled || document.webkitFullscreenEnabled;
|
|
101
|
+
if (!supportsFullScreen) {
|
|
68
102
|
throw new Error('Browser doesnt support fullscreen');
|
|
69
103
|
}
|
|
70
104
|
if (!container.current) {
|
|
@@ -85,6 +119,32 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
85
119
|
document.exitFullscreen();
|
|
86
120
|
}
|
|
87
121
|
}, []);
|
|
122
|
+
(0, react_1.useEffect)(() => {
|
|
123
|
+
const { current } = container;
|
|
124
|
+
if (!current) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const fullscreenChange = () => {
|
|
128
|
+
var _a;
|
|
129
|
+
const element = (_a = document.webkitFullscreenElement) !== null && _a !== void 0 ? _a : document.fullscreenElement;
|
|
130
|
+
if (element && element === container.current) {
|
|
131
|
+
player.emitter.dispatchFullscreenChangeUpdate({
|
|
132
|
+
isFullscreen: true,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
player.emitter.dispatchFullscreenChangeUpdate({
|
|
137
|
+
isFullscreen: false,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
current.addEventListener('webkitfullscreenchange', fullscreenChange);
|
|
142
|
+
current.addEventListener('fullscreenchange', fullscreenChange);
|
|
143
|
+
return () => {
|
|
144
|
+
current.removeEventListener('webkitfullscreenchange', fullscreenChange);
|
|
145
|
+
current.removeEventListener('fullscreenchange', fullscreenChange);
|
|
146
|
+
};
|
|
147
|
+
}, [player.emitter]);
|
|
88
148
|
const durationInFrames = (_a = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _a !== void 0 ? _a : 1;
|
|
89
149
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
90
150
|
const methods = {
|
|
@@ -250,10 +310,9 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
250
310
|
if (!config) {
|
|
251
311
|
return null;
|
|
252
312
|
}
|
|
253
|
-
const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: outer, onClick: clickToPlay ? handleClick : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: (0, jsx_runtime_1.jsx)("div", { style: containerStyle, className: player_css_classname_1.PLAYER_CSS_CLASSNAME, children: VideoComponent ? ((0, jsx_runtime_1.jsx)(error_boundary_1.ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: (0, jsx_runtime_1.jsx)(VideoComponent, { ...((_b = video === null || video === void 0 ? void 0 : video.defaultProps) !== null && _b !== void 0 ? _b : {}), ...((_c = inputProps) !== null && _c !== void 0 ? _c : {}) }
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, children: content }, void 0));
|
|
313
|
+
const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: outer, onClick: clickToPlay ? handleClick : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: (0, jsx_runtime_1.jsx)("div", { style: containerStyle, className: player_css_classname_1.PLAYER_CSS_CLASSNAME, children: VideoComponent ? ((0, jsx_runtime_1.jsx)(error_boundary_1.ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: (0, jsx_runtime_1.jsx)(VideoComponent, { ...((_b = video === null || video === void 0 ? void 0 : video.defaultProps) !== null && _b !== void 0 ? _b : {}), ...((_c = inputProps) !== null && _c !== void 0 ? _c : {}) }) })) : null }) }), controls ? ((0, jsx_runtime_1.jsx)(PlayerControls_1.Controls, { fps: config.fps, durationInFrames: config.durationInFrames, hovered: hovered, player: player, onFullscreenButtonClick: onFullscreenButtonClick, isFullscreen: isFullscreen, allowFullscreen: allowFullscreen, showVolumeControls: showVolumeControls, onExitFullscreenButtonClick: onExitFullscreenButtonClick, spaceKeyToPlayOrPause: spaceKeyToPlayOrPause })) : null] }));
|
|
314
|
+
if (is_node_1.IS_NODE && !doesReactVersionSupportSuspense) {
|
|
315
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
257
316
|
}
|
|
258
317
|
const loadingMarkup = renderLoading
|
|
259
318
|
? renderLoading({
|
|
@@ -261,6 +320,6 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
261
320
|
width: outerStyle.width,
|
|
262
321
|
})
|
|
263
322
|
: null;
|
|
264
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: loadingMarkup, children: content }
|
|
323
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: loadingMarkup, children: content }) }));
|
|
265
324
|
};
|
|
266
325
|
exports.default = (0, react_1.forwardRef)(PlayerUI);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PreviewSize } from './utils/preview-size';
|
|
2
|
-
import { Size } from './utils/use-element-size';
|
|
1
|
+
import type { PreviewSize } from './utils/preview-size';
|
|
2
|
+
import type { Size } from './utils/use-element-size';
|
|
3
3
|
export declare const calculateScale: ({ previewSize, compositionWidth, compositionHeight, canvasSize, }: {
|
|
4
4
|
previewSize: PreviewSize;
|
|
5
5
|
compositionWidth: number;
|
package/dist/error-boundary.js
CHANGED
|
@@ -31,7 +31,7 @@ class ErrorBoundary extends react_1.default.Component {
|
|
|
31
31
|
// You can render any custom fallback UI
|
|
32
32
|
return ((0, jsx_runtime_1.jsx)("div", { style: errorStyle, children: this.props.errorFallback({
|
|
33
33
|
error: this.state.hasError,
|
|
34
|
-
}) }
|
|
34
|
+
}) }));
|
|
35
35
|
}
|
|
36
36
|
return this.props.children;
|
|
37
37
|
}
|
package/dist/event-emitter.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ declare type TimeUpdateEventPayload = {
|
|
|
10
10
|
declare type RateChangeEventPayload = {
|
|
11
11
|
playbackRate: number;
|
|
12
12
|
};
|
|
13
|
+
declare type FullscreenChangeEventPayload = {
|
|
14
|
+
isFullscreen: boolean;
|
|
15
|
+
};
|
|
13
16
|
declare type StateEventMap = {
|
|
14
17
|
seeked: SeekPayload;
|
|
15
18
|
pause: undefined;
|
|
@@ -18,6 +21,7 @@ declare type StateEventMap = {
|
|
|
18
21
|
ended: undefined;
|
|
19
22
|
error: ErrorPayload;
|
|
20
23
|
timeupdate: TimeUpdateEventPayload;
|
|
24
|
+
fullscreenchange: FullscreenChangeEventPayload;
|
|
21
25
|
};
|
|
22
26
|
export declare type EventTypes = keyof StateEventMap;
|
|
23
27
|
export declare type CallbackListener<T extends EventTypes> = (data: {
|
|
@@ -38,5 +42,6 @@ export declare class PlayerEmitter {
|
|
|
38
42
|
dispatchRatechange(playbackRate: number): void;
|
|
39
43
|
dispatchError(error: Error): void;
|
|
40
44
|
dispatchTimeUpdate(event: TimeUpdateEventPayload): void;
|
|
45
|
+
dispatchFullscreenChangeUpdate(event: FullscreenChangeEventPayload): void;
|
|
41
46
|
}
|
|
42
47
|
export {};
|
package/dist/event-emitter.js
CHANGED
|
@@ -11,6 +11,7 @@ class PlayerEmitter {
|
|
|
11
11
|
ratechange: [],
|
|
12
12
|
seeked: [],
|
|
13
13
|
timeupdate: [],
|
|
14
|
+
fullscreenchange: [],
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
addEventListener(name, callback) {
|
|
@@ -51,5 +52,8 @@ class PlayerEmitter {
|
|
|
51
52
|
dispatchTimeUpdate(event) {
|
|
52
53
|
this.dispatchEvent('timeupdate', event);
|
|
53
54
|
}
|
|
55
|
+
dispatchFullscreenChangeUpdate(event) {
|
|
56
|
+
this.dispatchEvent('fullscreenchange', event);
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
exports.PlayerEmitter = PlayerEmitter;
|
package/dist/icons.js
CHANGED
|
@@ -8,11 +8,11 @@ const rotate = {
|
|
|
8
8
|
transform: `rotate(90deg)`,
|
|
9
9
|
};
|
|
10
10
|
const PlayIcon = () => {
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: (0, jsx_runtime_1.jsx)("path", { fill: "#fff", stroke: "#fff", strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: (0, jsx_runtime_1.jsx)("path", { fill: "#fff", stroke: "#fff", strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }) }));
|
|
12
12
|
};
|
|
13
13
|
exports.PlayIcon = PlayIcon;
|
|
14
14
|
const PauseIcon = () => {
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 100 100", width: exports.ICON_SIZE, height: exports.ICON_SIZE, children: [(0, jsx_runtime_1.jsx)("rect", { x: "25", y: "20", width: "20", height: "60", fill: "#fff", ry: "5", rx: "5" }
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 100 100", width: exports.ICON_SIZE, height: exports.ICON_SIZE, children: [(0, jsx_runtime_1.jsx)("rect", { x: "25", y: "20", width: "20", height: "60", fill: "#fff", ry: "5", rx: "5" }), (0, jsx_runtime_1.jsx)("rect", { x: "55", y: "20", width: "20", height: "60", fill: "#fff", ry: "5", rx: "5" })] }));
|
|
16
16
|
};
|
|
17
17
|
exports.PauseIcon = PauseIcon;
|
|
18
18
|
const FullscreenIcon = ({ minimized }) => {
|
|
@@ -25,26 +25,26 @@ const FullscreenIcon = ({ minimized }) => {
|
|
|
25
25
|
M ${out} ${inset}
|
|
26
26
|
L ${middleInset} ${middleInset}
|
|
27
27
|
L ${inset} ${out}
|
|
28
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }
|
|
28
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
29
29
|
M ${viewSize - out} ${inset}
|
|
30
30
|
L ${viewSize - middleInset} ${middleInset}
|
|
31
31
|
L ${viewSize - inset} ${out}
|
|
32
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }
|
|
32
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
33
33
|
M ${out} ${viewSize - inset}
|
|
34
34
|
L ${middleInset} ${viewSize - middleInset}
|
|
35
35
|
L ${inset} ${viewSize - out}
|
|
36
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }
|
|
36
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
37
37
|
M ${viewSize - out} ${viewSize - inset}
|
|
38
38
|
L ${viewSize - middleInset} ${viewSize - middleInset}
|
|
39
39
|
L ${viewSize - inset} ${viewSize - out}
|
|
40
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }
|
|
40
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" })] }));
|
|
41
41
|
};
|
|
42
42
|
exports.FullscreenIcon = FullscreenIcon;
|
|
43
43
|
const VolumeOffIcon = () => {
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { d: "M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z", fill: "#fff" }
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { d: "M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z", fill: "#fff" }) }));
|
|
45
45
|
};
|
|
46
46
|
exports.VolumeOffIcon = VolumeOffIcon;
|
|
47
47
|
const VolumeOnIcon = () => {
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: (0, jsx_runtime_1.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" }
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: (0, jsx_runtime_1.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" }) }));
|
|
49
49
|
};
|
|
50
50
|
exports.VolumeOnIcon = VolumeOnIcon;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CallbackListener, EventTypes
|
|
1
|
+
import type { CallbackListener, EventTypes } from './event-emitter';
|
|
2
|
+
import { PlayerEmitter } from './event-emitter';
|
|
2
3
|
export { ErrorFallback, Player } from './Player';
|
|
3
4
|
export { PlayerMethods, PlayerRef } from './player-methods';
|
|
4
5
|
export type { RenderLoading } from './PlayerUI';
|
|
@@ -12,17 +13,22 @@ export declare const PlayerInternals: {
|
|
|
12
13
|
frameBack: (frames: number) => void;
|
|
13
14
|
frameForward: (frames: number) => void;
|
|
14
15
|
isLastFrame: boolean;
|
|
16
|
+
isFirstFrame: boolean;
|
|
15
17
|
emitter: PlayerEmitter;
|
|
16
18
|
playing: boolean;
|
|
17
19
|
play: (e?: import("react").SyntheticEvent<Element, Event> | undefined) => void;
|
|
18
20
|
pause: () => void;
|
|
21
|
+
pauseAndReturnToPlayStart: () => void;
|
|
19
22
|
seek: (newFrame: number) => void;
|
|
20
23
|
getCurrentFrame: () => number;
|
|
21
24
|
isPlaying: () => boolean;
|
|
22
25
|
};
|
|
23
|
-
usePlayback: ({ loop, playbackRate, }: {
|
|
26
|
+
usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, }: {
|
|
24
27
|
loop: boolean;
|
|
25
28
|
playbackRate: number;
|
|
29
|
+
moveToBeginningWhenEnded: boolean;
|
|
30
|
+
inFrame: number | null;
|
|
31
|
+
outFrame: number | null;
|
|
26
32
|
}) => void;
|
|
27
33
|
useElementSize: (ref: import("react").RefObject<HTMLElement>, options: {
|
|
28
34
|
triggerOnWindowResize: boolean;
|
package/dist/player-methods.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SyntheticEvent } from 'react';
|
|
2
|
-
import { PlayerEmitter } from './event-emitter';
|
|
1
|
+
import type { SyntheticEvent } from 'react';
|
|
2
|
+
import type { PlayerEmitter } from './event-emitter';
|
|
3
3
|
export declare type PlayerMethods = {
|
|
4
4
|
play: (e?: SyntheticEvent) => void;
|
|
5
5
|
pause: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { queries, RenderOptions } from '@testing-library/react';
|
|
2
|
-
import { FC, ReactElement } from 'react';
|
|
1
|
+
import type { queries, RenderOptions } from '@testing-library/react';
|
|
2
|
+
import type { FC, ReactElement } from 'react';
|
|
3
3
|
declare const HelloWorld: FC;
|
|
4
|
-
declare const customRender: (ui: ReactElement, options?: Omit<RenderOptions
|
|
4
|
+
declare const customRender: (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>) => import("@testing-library/react").RenderResult<typeof queries, HTMLElement, HTMLElement>;
|
|
5
5
|
export * from '@testing-library/react';
|
|
6
6
|
export { customRender as render, HelloWorld };
|
package/dist/test/test-utils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,14 +18,14 @@ exports.HelloWorld = exports.render = void 0;
|
|
|
14
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
19
|
const react_1 = require("@testing-library/react");
|
|
16
20
|
const HelloWorld = () => {
|
|
17
|
-
return (0, jsx_runtime_1.jsx)("div", { children: "Hello World" }
|
|
21
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Hello World" });
|
|
18
22
|
};
|
|
19
23
|
exports.HelloWorld = HelloWorld;
|
|
20
24
|
const AllTheProviders = ({ children }) => {
|
|
21
25
|
// overwriting console.error console does not gets poluted with all the errors
|
|
22
26
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
23
27
|
window.console.error = () => { };
|
|
24
|
-
return (0, jsx_runtime_1.jsx)("div", { children: children }
|
|
28
|
+
return (0, jsx_runtime_1.jsx)("div", { children: children });
|
|
25
29
|
};
|
|
26
30
|
const customRender = (ui, options) => (0, react_1.render)(ui, { wrapper: AllTheProviders, ...options });
|
|
27
31
|
exports.render = customRender;
|