@remotion/player 3.3.44 → 3.3.51
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/MediaVolumeSlider.js +7 -7
- package/dist/cjs/Player.d.ts +4 -4
- package/dist/cjs/Player.js +14 -14
- package/dist/cjs/PlayerControls.d.ts +1 -1
- package/dist/cjs/PlayerControls.js +9 -9
- package/dist/cjs/PlayerSeekBar.js +6 -6
- package/dist/cjs/PlayerUI.d.ts +2 -2
- package/dist/cjs/PlayerUI.js +21 -21
- package/dist/cjs/SharedPlayerContext.js +3 -3
- package/dist/cjs/Thumbnail.d.ts +3 -3
- package/dist/cjs/Thumbnail.js +6 -6
- package/dist/cjs/ThumbnailUI.d.ts +2 -2
- package/dist/cjs/ThumbnailUI.js +14 -14
- package/dist/cjs/calculate-scale.d.ts +2 -2
- package/dist/cjs/calculate-scale.js +2 -2
- package/dist/cjs/emitter-context.d.ts +1 -1
- package/dist/cjs/error-boundary.d.ts +1 -1
- package/dist/cjs/index.d.ts +12 -12
- package/dist/cjs/index.js +20 -20
- package/dist/cjs/player-methods.d.ts +1 -1
- package/dist/cjs/test/index.test.js +2 -2
- package/dist/cjs/test/validate-in-out-frames.test.js +11 -11
- package/dist/cjs/test/validate-prop.test.js +22 -22
- package/dist/cjs/use-playback.js +4 -4
- package/dist/cjs/use-player.d.ts +1 -1
- package/dist/cjs/use-player.js +2 -2
- package/dist/cjs/use-thumbnail.d.ts +1 -1
- package/dist/cjs/use-thumbnail.js +2 -2
- package/dist/cjs/use-video-controls-resize.js +11 -11
- package/dist/cjs/utils/calculate-player-size.d.ts +1 -1
- package/dist/cjs/utils/use-cancellable-promises.d.ts +1 -1
- package/dist/cjs/utils/use-click-prevention-on-double-click.js +5 -5
- package/dist/esm/MediaVolumeSlider.js +2 -2
- package/dist/esm/Player.d.ts +4 -4
- package/dist/esm/Player.js +8 -8
- package/dist/esm/PlayerControls.d.ts +1 -1
- package/dist/esm/PlayerControls.js +5 -5
- package/dist/esm/PlayerSeekBar.js +3 -3
- package/dist/esm/PlayerUI.d.ts +2 -2
- package/dist/esm/PlayerUI.js +10 -10
- package/dist/esm/SharedPlayerContext.js +1 -1
- package/dist/esm/Thumbnail.d.ts +3 -3
- package/dist/esm/Thumbnail.js +4 -4
- package/dist/esm/ThumbnailUI.d.ts +2 -2
- package/dist/esm/ThumbnailUI.js +6 -6
- package/dist/esm/calculate-scale.d.ts +2 -2
- package/dist/esm/calculate-scale.js +1 -1
- package/dist/esm/emitter-context.d.ts +1 -1
- package/dist/esm/index.d.ts +12 -12
- package/dist/esm/index.js +9 -9
- package/dist/esm/player-methods.d.ts +1 -1
- package/dist/esm/test/index.test.js +1 -1
- package/dist/esm/test/validate-in-out-frames.test.js +1 -1
- package/dist/esm/test/validate-prop.test.js +2 -2
- package/dist/esm/use-playback.js +2 -2
- package/dist/esm/use-player.d.ts +1 -1
- package/dist/esm/use-player.js +1 -1
- package/dist/esm/use-thumbnail.d.ts +1 -1
- package/dist/esm/use-thumbnail.js +1 -1
- package/dist/esm/use-video-controls-resize.js +3 -3
- package/dist/esm/utils/calculate-player-size.d.ts +1 -1
- package/dist/esm/utils/use-cancellable-promises.d.ts +1 -1
- package/dist/esm/utils/use-click-prevention-on-double-click.js +3 -3
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -4,8 +4,8 @@ exports.MediaVolumeSlider = exports.VOLUME_SLIDER_WIDTH = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const icons_js_1 = require("./icons.js");
|
|
8
|
+
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
9
9
|
const BAR_HEIGHT = 5;
|
|
10
10
|
const KNOB_SIZE = 12;
|
|
11
11
|
exports.VOLUME_SLIDER_WIDTH = 100;
|
|
@@ -15,7 +15,7 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
15
15
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
16
16
|
const parentDivRef = (0, react_1.useRef)(null);
|
|
17
17
|
const inputRef = (0, react_1.useRef)(null);
|
|
18
|
-
const hover = (0,
|
|
18
|
+
const hover = (0, use_hover_state_js_1.useHoverState)(parentDivRef);
|
|
19
19
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
20
|
const randomId = typeof react_1.useId === 'undefined' ? 'volume-slider' : (0, react_1.useId)();
|
|
21
21
|
const [randomClass] = (0, react_1.useState)(() => `__remotion-volume-slider-${(0, remotion_1.random)(randomId)}`.replace('.', ''));
|
|
@@ -55,8 +55,8 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
55
55
|
const volumeContainer = (0, react_1.useMemo)(() => {
|
|
56
56
|
return {
|
|
57
57
|
display: 'inline',
|
|
58
|
-
width:
|
|
59
|
-
height:
|
|
58
|
+
width: icons_js_1.ICON_SIZE,
|
|
59
|
+
height: icons_js_1.ICON_SIZE,
|
|
60
60
|
cursor: 'pointer',
|
|
61
61
|
appearance: 'none',
|
|
62
62
|
background: 'none',
|
|
@@ -82,7 +82,7 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
82
82
|
...commonStyle,
|
|
83
83
|
transform: `rotate(-90deg)`,
|
|
84
84
|
position: 'absolute',
|
|
85
|
-
bottom:
|
|
85
|
+
bottom: icons_js_1.ICON_SIZE + exports.VOLUME_SLIDER_WIDTH / 2 + 5,
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
return {
|
|
@@ -113,6 +113,6 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
113
113
|
// eslint-disable-next-line react/no-danger
|
|
114
114
|
dangerouslySetInnerHTML: {
|
|
115
115
|
__html: sliderStyle,
|
|
116
|
-
} }), (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)(
|
|
116
|
+
} }), (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_js_1.VolumeOffIcon, {}) : (0, jsx_runtime_1.jsx)(icons_js_1.VolumeOnIcon, {}) }), (focused || hover) && !mediaMuted ? ((0, jsx_runtime_1.jsx)("input", { ref: inputRef, "aria-label": "Change volume", className: randomClass, max: 1, min: 0, onBlur: () => setFocused(false), onChange: onVolumeChange, step: 0.01, type: "range", value: mediaVolume, style: inputStyle })) : null] }));
|
|
117
117
|
};
|
|
118
118
|
exports.MediaVolumeSlider = MediaVolumeSlider;
|
package/dist/cjs/Player.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { CompProps } from 'remotion';
|
|
4
|
-
import type { PlayerRef } from './player-methods';
|
|
5
|
-
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls';
|
|
6
|
-
import type { RenderLoading, RenderPoster } from './PlayerUI';
|
|
7
|
-
import type { PropsIfHasProps } from './utils/props-if-has-props';
|
|
4
|
+
import type { PlayerRef } from './player-methods.js';
|
|
5
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
6
|
+
import type { RenderLoading, RenderPoster } from './PlayerUI.js';
|
|
7
|
+
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
8
8
|
export declare type ErrorFallback = (info: {
|
|
9
9
|
error: Error;
|
|
10
10
|
}) => React.ReactNode;
|
package/dist/cjs/Player.js
CHANGED
|
@@ -7,14 +7,14 @@ exports.Player = exports.componentOrNullIfLazy = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const remotion_1 = require("remotion");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
10
|
+
const emitter_context_js_1 = require("./emitter-context.js");
|
|
11
|
+
const event_emitter_js_1 = require("./event-emitter.js");
|
|
12
|
+
const player_css_classname_js_1 = require("./player-css-classname.js");
|
|
13
|
+
const PlayerUI_js_1 = __importDefault(require("./PlayerUI.js"));
|
|
14
|
+
const SharedPlayerContext_js_1 = require("./SharedPlayerContext.js");
|
|
15
|
+
const validate_in_out_frame_js_1 = require("./utils/validate-in-out-frame.js");
|
|
16
|
+
const validate_initial_frame_js_1 = require("./utils/validate-initial-frame.js");
|
|
17
|
+
const validate_playbackrate_js_1 = require("./utils/validate-playbackrate.js");
|
|
18
18
|
const componentOrNullIfLazy = (props) => {
|
|
19
19
|
if ('component' in props) {
|
|
20
20
|
return props.component;
|
|
@@ -42,11 +42,11 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
42
42
|
throw new TypeError(`'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.`);
|
|
43
43
|
}
|
|
44
44
|
const component = remotion_1.Internals.useLazyComponent(componentProps);
|
|
45
|
-
(0,
|
|
45
|
+
(0, validate_initial_frame_js_1.validateInitialFrame)({ initialFrame, durationInFrames });
|
|
46
46
|
const [frame, setFrame] = (0, react_1.useState)(() => initialFrame !== null && initialFrame !== void 0 ? initialFrame : 0);
|
|
47
47
|
const [playing, setPlaying] = (0, react_1.useState)(false);
|
|
48
48
|
const [rootId] = (0, react_1.useState)('player-comp');
|
|
49
|
-
const [emitter] = (0, react_1.useState)(() => new
|
|
49
|
+
const [emitter] = (0, react_1.useState)(() => new event_emitter_js_1.PlayerEmitter());
|
|
50
50
|
const rootRef = (0, react_1.useRef)(null);
|
|
51
51
|
const audioAndVideoTags = (0, react_1.useRef)([]);
|
|
52
52
|
const imperativePlaying = (0, react_1.useRef)(false);
|
|
@@ -60,7 +60,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
60
60
|
remotion_1.Internals.validateDimension(compositionWidth, 'compositionWidth', 'of the <Player /> component');
|
|
61
61
|
remotion_1.Internals.validateDurationInFrames(durationInFrames, 'of the <Player/> component');
|
|
62
62
|
remotion_1.Internals.validateFps(fps, 'as a prop of the <Player/> component', false);
|
|
63
|
-
(0,
|
|
63
|
+
(0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
64
64
|
durationInFrames,
|
|
65
65
|
inFrame,
|
|
66
66
|
outFrame,
|
|
@@ -100,7 +100,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
100
100
|
numberOfSharedAudioTags < 0) {
|
|
101
101
|
throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${numberOfSharedAudioTags}' instead`);
|
|
102
102
|
}
|
|
103
|
-
(0,
|
|
103
|
+
(0, validate_playbackrate_js_1.validatePlaybackRate)(playbackRate);
|
|
104
104
|
(0, react_1.useEffect)(() => {
|
|
105
105
|
emitter.dispatchRatechange(playbackRate);
|
|
106
106
|
}, [emitter, playbackRate]);
|
|
@@ -132,10 +132,10 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
132
132
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
133
133
|
(0, react_1.useLayoutEffect)(() => {
|
|
134
134
|
// Inject CSS only on client, and also only after the Player has hydrated
|
|
135
|
-
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${
|
|
135
|
+
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${player_css_classname_js_1.PLAYER_CSS_CLASSNAME}`, '#fff'));
|
|
136
136
|
}, []);
|
|
137
137
|
}
|
|
138
|
-
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(
|
|
138
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineContextValue, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, inputProps: inputProps, numberOfSharedAudioTags: numberOfSharedAudioTags, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(emitter_context_js_1.PlayerEventEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(PlayerUI_js_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'
|
|
139
139
|
? clickToPlay
|
|
140
140
|
: Boolean(controls), showVolumeControls: Boolean(showVolumeControls), doubleClickToFullscreen: Boolean(doubleClickToFullscreen), spaceKeyToPlayOrPause: Boolean(spaceKeyToPlayOrPause), playbackRate: playbackRate, className: className !== null && className !== void 0 ? className : undefined, showPosterWhenUnplayed: Boolean(showPosterWhenUnplayed), showPosterWhenEnded: Boolean(showPosterWhenEnded), showPosterWhenPaused: Boolean(showPosterWhenPaused), renderPoster: renderPoster, inFrame: inFrame !== null && inFrame !== void 0 ? inFrame : null, outFrame: outFrame !== null && outFrame !== void 0 ? outFrame : null, initiallyShowControls: initiallyShowControls !== null && initiallyShowControls !== void 0 ? initiallyShowControls : true, renderFullscreen: renderFullscreenButton !== null && renderFullscreenButton !== void 0 ? renderFullscreenButton : null, renderPlayPauseButton: renderPlayPauseButton !== null && renderPlayPauseButton !== void 0 ? renderPlayPauseButton : null }) }) }) }) }));
|
|
141
141
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { usePlayer } from './use-player';
|
|
3
|
+
import type { usePlayer } from './use-player.js';
|
|
4
4
|
export declare type RenderPlayPauseButton = (props: {
|
|
5
5
|
playing: boolean;
|
|
6
6
|
}) => ReactNode;
|
|
@@ -4,11 +4,11 @@ exports.Controls = exports.X_PADDING = exports.X_SPACER = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
7
|
+
const format_time_js_1 = require("./format-time.js");
|
|
8
|
+
const icons_js_1 = require("./icons.js");
|
|
9
|
+
const MediaVolumeSlider_js_1 = require("./MediaVolumeSlider.js");
|
|
10
|
+
const PlayerSeekBar_js_1 = require("./PlayerSeekBar.js");
|
|
11
|
+
const use_video_controls_resize_js_1 = require("./use-video-controls-resize.js");
|
|
12
12
|
exports.X_SPACER = 10;
|
|
13
13
|
exports.X_PADDING = 12;
|
|
14
14
|
const gradientSteps = [
|
|
@@ -74,12 +74,12 @@ const flex1 = {
|
|
|
74
74
|
flex: 1,
|
|
75
75
|
};
|
|
76
76
|
const fullscreen = {};
|
|
77
|
-
const PlayPauseButton = ({ playing }) => playing ? (0, jsx_runtime_1.jsx)(
|
|
77
|
+
const PlayPauseButton = ({ playing }) => playing ? (0, jsx_runtime_1.jsx)(icons_js_1.PauseIcon, {}) : (0, jsx_runtime_1.jsx)(icons_js_1.PlayIcon, {});
|
|
78
78
|
const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVolumeControls, onFullscreenButtonClick, allowFullscreen, onExitFullscreenButtonClick, spaceKeyToPlayOrPause, onSeekEnd, onSeekStart, inFrame, outFrame, initiallyShowControls, playerWidth, renderPlayPauseButton, renderFullscreenButton, }) => {
|
|
79
79
|
const playButtonRef = (0, react_1.useRef)(null);
|
|
80
80
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
81
81
|
const [supportsFullscreen, setSupportsFullscreen] = (0, react_1.useState)(false);
|
|
82
|
-
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = (0,
|
|
82
|
+
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = (0, use_video_controls_resize_js_1.useVideoControlsResize)({ allowFullscreen, playerWidth });
|
|
83
83
|
const [shouldShowInitially, setInitiallyShowControls] = (0, react_1.useState)(() => {
|
|
84
84
|
if (typeof initiallyShowControls === 'boolean') {
|
|
85
85
|
return initiallyShowControls;
|
|
@@ -145,8 +145,8 @@ const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVo
|
|
|
145
145
|
textOverflow: 'ellipsis',
|
|
146
146
|
};
|
|
147
147
|
}, [maxTimeLabelWidth]);
|
|
148
|
-
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: renderPlayPauseButton === null ? ((0, jsx_runtime_1.jsx)(PlayPauseButton, { playing: player.playing })) : (renderPlayPauseButton({ playing: player.playing })) }), showVolumeControls ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsx)(
|
|
148
|
+
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: renderPlayPauseButton === null ? ((0, jsx_runtime_1.jsx)(PlayPauseButton, { playing: player.playing })) : (renderPlayPauseButton({ playing: player.playing })) }), 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_js_1.MediaVolumeSlider, { displayVerticalVolumeSlider: displayVerticalVolumeSlider })] })) : null, (0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsxs)("div", { style: timeLabel, children: [(0, format_time_js_1.formatTime)(frame / fps), " / ", (0, format_time_js_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
|
|
149
149
|
? onExitFullscreenButtonClick
|
|
150
|
-
: onFullscreenButtonClick, children: renderFullscreenButton === null ? ((0, jsx_runtime_1.jsx)(
|
|
150
|
+
: onFullscreenButtonClick, children: renderFullscreenButton === null ? ((0, jsx_runtime_1.jsx)(icons_js_1.FullscreenIcon, { isFullscreen: isFullscreen })) : (renderFullscreenButton({ isFullscreen })) })) : null })] }), (0, jsx_runtime_1.jsx)("div", { style: ySpacer }), (0, jsx_runtime_1.jsx)(PlayerSeekBar_js_1.PlayerSeekBar, { onSeekEnd: onSeekEnd, onSeekStart: onSeekStart, durationInFrames: durationInFrames, inFrame: inFrame, outFrame: outFrame })] }));
|
|
151
151
|
};
|
|
152
152
|
exports.Controls = Controls;
|
|
@@ -4,9 +4,9 @@ exports.PlayerSeekBar = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
8
|
+
const use_player_js_1 = require("./use-player.js");
|
|
9
|
+
const use_element_size_js_1 = require("./utils/use-element-size.js");
|
|
10
10
|
const getFrameFromX = (clientX, durationInFrames, width) => {
|
|
11
11
|
var _a;
|
|
12
12
|
const pos = clientX;
|
|
@@ -43,12 +43,12 @@ const findBodyInWhichDivIsLocated = (div) => {
|
|
|
43
43
|
};
|
|
44
44
|
const PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
|
|
45
45
|
const containerRef = (0, react_1.useRef)(null);
|
|
46
|
-
const barHovered = (0,
|
|
47
|
-
const size = (0,
|
|
46
|
+
const barHovered = (0, use_hover_state_js_1.useHoverState)(containerRef);
|
|
47
|
+
const size = (0, use_element_size_js_1.useElementSize)(containerRef, {
|
|
48
48
|
triggerOnWindowResize: true,
|
|
49
49
|
shouldApplyCssTransforms: true,
|
|
50
50
|
});
|
|
51
|
-
const { seek, play, pause, playing } = (0,
|
|
51
|
+
const { seek, play, pause, playing } = (0, use_player_js_1.usePlayer)();
|
|
52
52
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
53
53
|
const [dragging, setDragging] = (0, react_1.useState)({
|
|
54
54
|
dragging: false,
|
package/dist/cjs/PlayerUI.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PlayerRef } from './player-methods';
|
|
3
|
-
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls';
|
|
2
|
+
import type { PlayerRef } from './player-methods.js';
|
|
3
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
4
4
|
export declare type ErrorFallback = (info: {
|
|
5
5
|
error: Error;
|
|
6
6
|
}) => React.ReactNode;
|
package/dist/cjs/PlayerUI.js
CHANGED
|
@@ -26,16 +26,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const remotion_1 = require("remotion");
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
29
|
+
const calculate_scale_js_1 = require("./calculate-scale.js");
|
|
30
|
+
const error_boundary_js_1 = require("./error-boundary.js");
|
|
31
|
+
const player_css_classname_js_1 = require("./player-css-classname.js");
|
|
32
|
+
const PlayerControls_js_1 = require("./PlayerControls.js");
|
|
33
|
+
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
34
|
+
const use_playback_js_1 = require("./use-playback.js");
|
|
35
|
+
const use_player_js_1 = require("./use-player.js");
|
|
36
|
+
const is_node_js_1 = require("./utils/is-node.js");
|
|
37
|
+
const use_click_prevention_on_double_click_js_1 = require("./utils/use-click-prevention-on-double-click.js");
|
|
38
|
+
const use_element_size_js_1 = require("./utils/use-element-size.js");
|
|
39
39
|
const reactVersion = react_1.default.version.split('.')[0];
|
|
40
40
|
if (reactVersion === '0') {
|
|
41
41
|
throw new Error(`Version ${reactVersion} of "react" is not supported by Remotion`);
|
|
@@ -46,8 +46,8 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
46
46
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
47
47
|
const video = remotion_1.Internals.useVideo();
|
|
48
48
|
const container = (0, react_1.useRef)(null);
|
|
49
|
-
const hovered = (0,
|
|
50
|
-
const canvasSize = (0,
|
|
49
|
+
const hovered = (0, use_hover_state_js_1.useHoverState)(container);
|
|
50
|
+
const canvasSize = (0, use_element_size_js_1.useElementSize)(container, {
|
|
51
51
|
triggerOnWindowResize: false,
|
|
52
52
|
shouldApplyCssTransforms: false,
|
|
53
53
|
});
|
|
@@ -55,14 +55,14 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
55
55
|
const [shouldAutoplay, setShouldAutoPlay] = (0, react_1.useState)(autoPlay);
|
|
56
56
|
const [isFullscreen, setIsFullscreen] = (0, react_1.useState)(() => false);
|
|
57
57
|
const [seeking, setSeeking] = (0, react_1.useState)(false);
|
|
58
|
-
(0,
|
|
58
|
+
(0, use_playback_js_1.usePlayback)({
|
|
59
59
|
loop,
|
|
60
60
|
playbackRate,
|
|
61
61
|
moveToBeginningWhenEnded,
|
|
62
62
|
inFrame,
|
|
63
63
|
outFrame,
|
|
64
64
|
});
|
|
65
|
-
const player = (0,
|
|
65
|
+
const player = (0, use_player_js_1.usePlayer)();
|
|
66
66
|
(0, react_1.useEffect)(() => {
|
|
67
67
|
if (hasPausedToResume && !player.playing) {
|
|
68
68
|
setHasPausedToResume(false);
|
|
@@ -150,7 +150,7 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
150
150
|
if (!config || !canvasSize) {
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
return (0,
|
|
153
|
+
return (0, calculate_scale_js_1.calculateCanvasTransformation)({
|
|
154
154
|
canvasSize,
|
|
155
155
|
compositionHeight: config.height,
|
|
156
156
|
compositionWidth: config.width,
|
|
@@ -228,13 +228,13 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
228
228
|
]);
|
|
229
229
|
const VideoComponent = video ? video.component : null;
|
|
230
230
|
const outerStyle = (0, react_1.useMemo)(() => {
|
|
231
|
-
return (0,
|
|
231
|
+
return (0, calculate_scale_js_1.calculateOuterStyle)({ canvasSize, config, style });
|
|
232
232
|
}, [canvasSize, config, style]);
|
|
233
233
|
const outer = (0, react_1.useMemo)(() => {
|
|
234
|
-
return (0,
|
|
234
|
+
return (0, calculate_scale_js_1.calculateOuter)({ config, layout, scale });
|
|
235
235
|
}, [config, layout, scale]);
|
|
236
236
|
const containerStyle = (0, react_1.useMemo)(() => {
|
|
237
|
-
return (0,
|
|
237
|
+
return (0, calculate_scale_js_1.calculateContainerStyle)({ canvasSize, config, layout, scale });
|
|
238
238
|
}, [canvasSize, config, layout, scale]);
|
|
239
239
|
const onError = (0, react_1.useCallback)((error) => {
|
|
240
240
|
player.pause();
|
|
@@ -266,7 +266,7 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
266
266
|
requestFullscreen();
|
|
267
267
|
}
|
|
268
268
|
}, [exitFullscreen, isFullscreen, requestFullscreen]);
|
|
269
|
-
const [handleClick, handleDoubleClick] = (0,
|
|
269
|
+
const [handleClick, handleDoubleClick] = (0, use_click_prevention_on_double_click_js_1.useClickPreventionOnDoubleClick)(onSingleClick, onDoubleClick, doubleClickToFullscreen);
|
|
270
270
|
(0, react_1.useEffect)(() => {
|
|
271
271
|
if (shouldAutoplay) {
|
|
272
272
|
player.play();
|
|
@@ -299,8 +299,8 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
299
299
|
showPosterWhenEnded && player.isLastFrame && !player.isPlaying(),
|
|
300
300
|
showPosterWhenUnplayed && !player.hasPlayed && !player.isPlaying(),
|
|
301
301
|
].some(Boolean);
|
|
302
|
-
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:
|
|
303
|
-
if (
|
|
302
|
+
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_js_1.PLAYER_CSS_CLASSNAME, children: VideoComponent ? ((0, jsx_runtime_1.jsx)(error_boundary_js_1.ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: (0, jsx_runtime_1.jsx)(VideoComponent, { ...((_c = video === null || video === void 0 ? void 0 : video.defaultProps) !== null && _c !== void 0 ? _c : {}), ...((_d = inputProps) !== null && _d !== void 0 ? _d : {}) }) })) : null }) }), shouldShowPoster ? ((0, jsx_runtime_1.jsx)("div", { style: outer, onClick: clickToPlay ? handleClick : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null, controls ? ((0, jsx_runtime_1.jsx)(PlayerControls_js_1.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, playerWidth: (_e = canvasSize === null || canvasSize === void 0 ? void 0 : canvasSize.width) !== null && _e !== void 0 ? _e : 0, renderFullscreenButton: renderFullscreenButton, renderPlayPauseButton: renderPlayPauseButton })) : null] }));
|
|
303
|
+
if (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense) {
|
|
304
304
|
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
305
305
|
}
|
|
306
306
|
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 }) }));
|
|
@@ -4,7 +4,7 @@ exports.SharedPlayerContexts = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
7
|
+
const volume_persistance_js_1 = require("./volume-persistance.js");
|
|
8
8
|
const SharedPlayerContexts = ({ children, timelineContext, inputProps, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, }) => {
|
|
9
9
|
const compositionManagerContext = (0, react_1.useMemo)(() => {
|
|
10
10
|
return {
|
|
@@ -50,7 +50,7 @@ const SharedPlayerContexts = ({ children, timelineContext, inputProps, fps, comp
|
|
|
50
50
|
inputProps,
|
|
51
51
|
]);
|
|
52
52
|
const [mediaMuted, setMediaMuted] = (0, react_1.useState)(false);
|
|
53
|
-
const [mediaVolume, setMediaVolume] = (0, react_1.useState)((0,
|
|
53
|
+
const [mediaVolume, setMediaVolume] = (0, react_1.useState)((0, volume_persistance_js_1.getPreferredVolume)());
|
|
54
54
|
const mediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
55
55
|
return {
|
|
56
56
|
mediaMuted,
|
|
@@ -59,7 +59,7 @@ const SharedPlayerContexts = ({ children, timelineContext, inputProps, fps, comp
|
|
|
59
59
|
}, [mediaMuted, mediaVolume]);
|
|
60
60
|
const setMediaVolumeAndPersist = (0, react_1.useCallback)((vol) => {
|
|
61
61
|
setMediaVolume(vol);
|
|
62
|
-
(0,
|
|
62
|
+
(0, volume_persistance_js_1.persistVolume)(vol);
|
|
63
63
|
}, []);
|
|
64
64
|
const setMediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
65
65
|
return {
|
package/dist/cjs/Thumbnail.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CSSProperties, MutableRefObject } from 'react';
|
|
2
2
|
import type { CompProps } from 'remotion';
|
|
3
|
-
import type { ThumbnailMethods } from './player-methods';
|
|
4
|
-
import type { ErrorFallback, RenderLoading } from './PlayerUI';
|
|
5
|
-
import type { PropsIfHasProps } from './utils/props-if-has-props';
|
|
3
|
+
import type { ThumbnailMethods } from './player-methods.js';
|
|
4
|
+
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
5
|
+
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
6
6
|
declare type ThumbnailProps<T> = PropsIfHasProps<T> & CompProps<T> & {
|
|
7
7
|
frameToDisplay: number;
|
|
8
8
|
style?: CSSProperties;
|
package/dist/cjs/Thumbnail.js
CHANGED
|
@@ -7,10 +7,10 @@ exports.Thumbnail = exports.ThumbnailFn = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const remotion_1 = require("remotion");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
10
|
+
const emitter_context_js_1 = require("./emitter-context.js");
|
|
11
|
+
const event_emitter_js_1 = require("./event-emitter.js");
|
|
12
|
+
const SharedPlayerContext_js_1 = require("./SharedPlayerContext.js");
|
|
13
|
+
const ThumbnailUI_js_1 = __importDefault(require("./ThumbnailUI.js"));
|
|
14
14
|
const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback = () => '⚠️', renderLoading, ...componentProps }, ref) => {
|
|
15
15
|
const [thumbnailId] = (0, react_1.useState)(() => String((0, remotion_1.random)(null)));
|
|
16
16
|
const rootRef = (0, react_1.useRef)(null);
|
|
@@ -31,11 +31,11 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
31
31
|
}, [frameToDisplay, thumbnailId]);
|
|
32
32
|
(0, react_1.useImperativeHandle)(ref, () => rootRef.current, []);
|
|
33
33
|
const Component = remotion_1.Internals.useLazyComponent(componentProps);
|
|
34
|
-
const [emitter] = (0, react_1.useState)(() => new
|
|
34
|
+
const [emitter] = (0, react_1.useState)(() => new event_emitter_js_1.ThumbnailEmitter());
|
|
35
35
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
36
36
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
37
37
|
}, [inputProps]);
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineState, component: Component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, inputProps: inputProps, numberOfSharedAudioTags: 0, children: (0, jsx_runtime_1.jsx)(emitter_context_js_1.ThumbnailEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(ThumbnailUI_js_1.default, { className: className, errorFallback: errorFallback, inputProps: passedInputProps, renderLoading: renderLoading, style: style }) }) }) }));
|
|
39
39
|
};
|
|
40
40
|
exports.ThumbnailFn = ThumbnailFn;
|
|
41
41
|
const forward = react_1.forwardRef;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ThumbnailMethods } from './player-methods';
|
|
3
|
-
import type { ErrorFallback, RenderLoading } from './PlayerUI';
|
|
2
|
+
import type { ThumbnailMethods } from './player-methods.js';
|
|
3
|
+
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<{
|
|
5
5
|
inputProps: unknown;
|
|
6
6
|
style?: React.CSSProperties | undefined;
|
package/dist/cjs/ThumbnailUI.js
CHANGED
|
@@ -26,12 +26,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const remotion_1 = require("remotion");
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
29
|
+
const calculate_scale_js_1 = require("./calculate-scale.js");
|
|
30
|
+
const error_boundary_js_1 = require("./error-boundary.js");
|
|
31
|
+
const player_css_classname_js_1 = require("./player-css-classname.js");
|
|
32
|
+
const use_thumbnail_js_1 = require("./use-thumbnail.js");
|
|
33
|
+
const is_node_js_1 = require("./utils/is-node.js");
|
|
34
|
+
const use_element_size_js_1 = require("./utils/use-element-size.js");
|
|
35
35
|
const reactVersion = react_1.default.version.split('.')[0];
|
|
36
36
|
if (reactVersion === '0') {
|
|
37
37
|
throw new Error(`Version ${reactVersion} of "react" is not supported by Remotion`);
|
|
@@ -42,7 +42,7 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
|
|
|
42
42
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
43
43
|
const video = remotion_1.Internals.useVideo();
|
|
44
44
|
const container = (0, react_1.useRef)(null);
|
|
45
|
-
const canvasSize = (0,
|
|
45
|
+
const canvasSize = (0, use_element_size_js_1.useElementSize)(container, {
|
|
46
46
|
triggerOnWindowResize: false,
|
|
47
47
|
shouldApplyCssTransforms: false,
|
|
48
48
|
});
|
|
@@ -50,7 +50,7 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
|
|
|
50
50
|
if (!config || !canvasSize) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
|
-
return (0,
|
|
53
|
+
return (0, calculate_scale_js_1.calculateCanvasTransformation)({
|
|
54
54
|
canvasSize,
|
|
55
55
|
compositionHeight: config.height,
|
|
56
56
|
compositionWidth: config.width,
|
|
@@ -58,7 +58,7 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
|
|
|
58
58
|
});
|
|
59
59
|
}, [canvasSize, config]);
|
|
60
60
|
const scale = (_a = layout === null || layout === void 0 ? void 0 : layout.scale) !== null && _a !== void 0 ? _a : 1;
|
|
61
|
-
const thumbnail = (0,
|
|
61
|
+
const thumbnail = (0, use_thumbnail_js_1.useThumbnail)();
|
|
62
62
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
63
63
|
const methods = {
|
|
64
64
|
getContainerNode: () => container.current,
|
|
@@ -68,13 +68,13 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
|
|
|
68
68
|
}, [scale, thumbnail.emitter]);
|
|
69
69
|
const VideoComponent = video ? video.component : null;
|
|
70
70
|
const outerStyle = (0, react_1.useMemo)(() => {
|
|
71
|
-
return (0,
|
|
71
|
+
return (0, calculate_scale_js_1.calculateOuterStyle)({ config, style, canvasSize });
|
|
72
72
|
}, [canvasSize, config, style]);
|
|
73
73
|
const outer = (0, react_1.useMemo)(() => {
|
|
74
|
-
return (0,
|
|
74
|
+
return (0, calculate_scale_js_1.calculateOuter)({ config, layout, scale });
|
|
75
75
|
}, [config, layout, scale]);
|
|
76
76
|
const containerStyle = (0, react_1.useMemo)(() => {
|
|
77
|
-
return (0,
|
|
77
|
+
return (0, calculate_scale_js_1.calculateContainerStyle)({
|
|
78
78
|
canvasSize,
|
|
79
79
|
config,
|
|
80
80
|
layout,
|
|
@@ -98,8 +98,8 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
|
|
|
98
98
|
if (!config) {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
|
-
const content = ((0, jsx_runtime_1.jsx)("div", { style: outer, children: (0, jsx_runtime_1.jsx)("div", { style: containerStyle, className:
|
|
102
|
-
if (
|
|
101
|
+
const content = ((0, jsx_runtime_1.jsx)("div", { style: outer, children: (0, jsx_runtime_1.jsx)("div", { style: containerStyle, className: player_css_classname_js_1.PLAYER_CSS_CLASSNAME, children: VideoComponent ? ((0, jsx_runtime_1.jsx)(error_boundary_js_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 }) }));
|
|
102
|
+
if (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense) {
|
|
103
103
|
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
104
104
|
}
|
|
105
105
|
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 }) }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { VideoConfig } from 'remotion';
|
|
2
|
-
import type { PreviewSize } from './utils/preview-size';
|
|
3
|
-
import type { Size } from './utils/use-element-size';
|
|
2
|
+
import type { PreviewSize } from './utils/preview-size.js';
|
|
3
|
+
import type { Size } from './utils/use-element-size.js';
|
|
4
4
|
export declare const calculateScale: ({ canvasSize, compositionHeight, compositionWidth, previewSize, }: {
|
|
5
5
|
previewSize: PreviewSize['size'];
|
|
6
6
|
compositionWidth: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateOuter = exports.calculateContainerStyle = exports.calculateOuterStyle = exports.calculateCanvasTransformation = exports.calculateScale = void 0;
|
|
4
|
-
const
|
|
4
|
+
const calculate_player_size_js_1 = require("./utils/calculate-player-size.js");
|
|
5
5
|
const calculateScale = ({ canvasSize, compositionHeight, compositionWidth, previewSize, }) => {
|
|
6
6
|
const heightRatio = canvasSize.height / compositionHeight;
|
|
7
7
|
const widthRatio = canvasSize.width / compositionWidth;
|
|
@@ -39,7 +39,7 @@ const calculateOuterStyle = ({ config, style, canvasSize, }) => {
|
|
|
39
39
|
return {
|
|
40
40
|
position: 'relative',
|
|
41
41
|
overflow: 'hidden',
|
|
42
|
-
...(0,
|
|
42
|
+
...(0, calculate_player_size_js_1.calculatePlayerSize)({
|
|
43
43
|
compositionHeight: config.height,
|
|
44
44
|
compositionWidth: config.width,
|
|
45
45
|
currentSize: canvasSize,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PlayerEmitter, ThumbnailEmitter } from './event-emitter';
|
|
2
|
+
import type { PlayerEmitter, ThumbnailEmitter } from './event-emitter.js';
|
|
3
3
|
export declare const PlayerEventEmitterContext: React.Context<PlayerEmitter | undefined>;
|
|
4
4
|
export declare const ThumbnailEmitterContext: React.Context<ThumbnailEmitter | undefined>;
|
|
@@ -15,5 +15,5 @@ export declare class ErrorBoundary extends React.Component<{
|
|
|
15
15
|
hasError: Error;
|
|
16
16
|
};
|
|
17
17
|
componentDidCatch(error: Error): void;
|
|
18
|
-
render(): string | number | boolean |
|
|
18
|
+
render(): string | number | boolean | JSX.Element | React.ReactFragment | null | undefined;
|
|
19
19
|
}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { CallbackListener, PlayerEventTypes } from './event-emitter';
|
|
3
|
-
import { PlayerEmitter } from './event-emitter';
|
|
4
|
-
export { Player, PlayerProps } from './Player';
|
|
5
|
-
export { PlayerMethods, PlayerRef, ThumbnailMethods, ThumbnailRef, } from './player-methods';
|
|
6
|
-
export type { RenderFullscreenButton, RenderPlayPauseButton, } from './PlayerControls';
|
|
7
|
-
export type { ErrorFallback, RenderLoading, RenderPoster } from './PlayerUI';
|
|
8
|
-
export { Thumbnail } from './Thumbnail';
|
|
9
|
-
export { PreviewSize, Translation } from './utils/preview-size';
|
|
10
|
-
export { Size } from './utils/use-element-size';
|
|
2
|
+
import type { CallbackListener, PlayerEventTypes } from './event-emitter.js';
|
|
3
|
+
import { PlayerEmitter } from './event-emitter.js';
|
|
4
|
+
export { Player, PlayerProps } from './Player.js';
|
|
5
|
+
export { PlayerMethods, PlayerRef, ThumbnailMethods, ThumbnailRef, } from './player-methods.js';
|
|
6
|
+
export type { RenderFullscreenButton, RenderPlayPauseButton, } from './PlayerControls.js';
|
|
7
|
+
export type { ErrorFallback, RenderLoading, RenderPoster } from './PlayerUI.js';
|
|
8
|
+
export { Thumbnail } from './Thumbnail.js';
|
|
9
|
+
export { PreviewSize, Translation } from './utils/preview-size.js';
|
|
10
|
+
export { Size } from './utils/use-element-size.js';
|
|
11
11
|
export type { CallbackListener, PlayerEventTypes as EventTypes };
|
|
12
12
|
export declare const PlayerInternals: {
|
|
13
13
|
PlayerEventEmitterContext: import("react").Context<PlayerEmitter | undefined>;
|
|
@@ -37,12 +37,12 @@ export declare const PlayerInternals: {
|
|
|
37
37
|
useElementSize: (ref: import("react").RefObject<HTMLElement>, options: {
|
|
38
38
|
triggerOnWindowResize: boolean;
|
|
39
39
|
shouldApplyCssTransforms: boolean;
|
|
40
|
-
}) => import("./utils/use-element-size").Size | null;
|
|
40
|
+
}) => import("./utils/use-element-size.js").Size | null;
|
|
41
41
|
calculateCanvasTransformation: ({ previewSize, compositionWidth, compositionHeight, canvasSize, }: {
|
|
42
42
|
previewSize: number | "auto";
|
|
43
43
|
compositionWidth: number;
|
|
44
44
|
compositionHeight: number;
|
|
45
|
-
canvasSize: import("./utils/use-element-size").Size;
|
|
45
|
+
canvasSize: import("./utils/use-element-size.js").Size;
|
|
46
46
|
}) => {
|
|
47
47
|
centerX: number;
|
|
48
48
|
centerY: number;
|
|
@@ -56,6 +56,6 @@ export declare const PlayerInternals: {
|
|
|
56
56
|
previewSize: number | "auto";
|
|
57
57
|
compositionWidth: number;
|
|
58
58
|
compositionHeight: number;
|
|
59
|
-
canvasSize: import("./utils/use-element-size").Size;
|
|
59
|
+
canvasSize: import("./utils/use-element-size.js").Size;
|
|
60
60
|
}) => number;
|
|
61
61
|
};
|