@remotion/player 4.0.537 → 4.0.538
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/BufferingIndicator.js +3 -5
- package/dist/cjs/DefaultPlayPauseButton.js +3 -3
- package/dist/cjs/EmitterProvider.js +1 -1
- package/dist/cjs/MediaVolumeSlider.js +2 -2
- package/dist/cjs/PlaybackrateControl.js +5 -7
- package/dist/cjs/Player.d.ts +6 -1
- package/dist/cjs/Player.js +6 -4
- package/dist/cjs/PlayerControls.js +3 -11
- package/dist/cjs/PlayerSeekBar.js +1 -5
- package/dist/cjs/PlayerTimeLabel.js +1 -1
- package/dist/cjs/PlayerUI.d.ts +3 -3
- package/dist/cjs/PlayerUI.js +4 -7
- package/dist/cjs/SharedPlayerContext.d.ts +1 -0
- package/dist/cjs/SharedPlayerContext.js +2 -2
- package/dist/cjs/Thumbnail.d.ts +1 -1
- package/dist/cjs/Thumbnail.js +1 -1
- package/dist/cjs/ThumbnailUI.d.ts +1 -1
- package/dist/cjs/ThumbnailUI.js +3 -3
- package/dist/cjs/calculate-scale.d.ts +11 -11
- package/dist/cjs/error-boundary.js +5 -2
- package/dist/cjs/event-emitter.js +88 -84
- package/dist/cjs/icons.js +9 -13
- package/dist/cjs/index.d.ts +14 -32
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/license-blacklist.js +1 -1
- package/dist/cjs/player-css-classname.d.ts +1 -1
- package/dist/cjs/render-volume-slider.js +3 -5
- package/dist/cjs/set-global-time-anchor.d.ts +2 -1
- package/dist/cjs/use-hover-state.d.ts +1 -1
- package/dist/cjs/use-playback.d.ts +2 -1
- package/dist/cjs/use-playback.js +48 -38
- package/dist/cjs/use-player-methods.js +9 -8
- package/dist/cjs/use-remotion-license-acknowledge.d.ts +2 -1
- package/dist/cjs/utils/calculate-player-size.d.ts +4 -3
- package/dist/cjs/volume-persistence.d.ts +2 -1
- package/dist/esm/index.mjs +70 -50
- package/package.json +5 -5
|
@@ -22,8 +22,7 @@ const studioStyle = {
|
|
|
22
22
|
};
|
|
23
23
|
const BufferingIndicator = ({ type, color = 'white' }) => {
|
|
24
24
|
const style = type === 'player' ? playerStyle : studioStyle;
|
|
25
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
26
|
-
jsx_runtime_1.jsx("style", { type: "text/css", children: `
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { type: "text/css", children: `
|
|
27
26
|
@keyframes ${remotionBufferingAnimation} {
|
|
28
27
|
0% {
|
|
29
28
|
rotate: 0deg;
|
|
@@ -36,9 +35,8 @@ const BufferingIndicator = ({ type, color = 'white' }) => {
|
|
|
36
35
|
.${className} {
|
|
37
36
|
animation: ${remotionBufferingAnimation} 1s linear infinite;
|
|
38
37
|
}
|
|
39
|
-
` }), jsx_runtime_1.jsx("div", { style: style, children: jsx_runtime_1.jsx("svg", { viewBox: type === 'player' ? '0 0 22 22' : '0 0 18 18', style: style, className: className, children: jsx_runtime_1.jsx("path", { d: type === 'player'
|
|
38
|
+
` }), (0, jsx_runtime_1.jsx)("div", { style: style, children: (0, jsx_runtime_1.jsx)("svg", { viewBox: type === 'player' ? '0 0 22 22' : '0 0 18 18', style: style, className: className, children: (0, jsx_runtime_1.jsx)("path", { d: type === 'player'
|
|
40
39
|
? 'M 11 4 A 7 7 0 0 1 15.1145 16.66312'
|
|
41
|
-
: 'M 9 2 A 7 7 0 0 1 13.1145 14.66312', stroke: color, strokeLinecap: "round", fill: "none", strokeWidth: 3 }) }) })
|
|
42
|
-
] }));
|
|
40
|
+
: 'M 9 2 A 7 7 0 0 1 13.1145 14.66312', stroke: color, strokeLinecap: "round", fill: "none", strokeWidth: 3 }) }) })] }));
|
|
43
41
|
};
|
|
44
42
|
exports.BufferingIndicator = BufferingIndicator;
|
|
@@ -6,11 +6,11 @@ const BufferingIndicator_js_1 = require("./BufferingIndicator.js");
|
|
|
6
6
|
const icons_js_1 = require("./icons.js");
|
|
7
7
|
const DefaultPlayPauseButton = ({ playing, buffering }) => {
|
|
8
8
|
if (playing && buffering) {
|
|
9
|
-
return jsx_runtime_1.jsx(BufferingIndicator_js_1.BufferingIndicator, { type: "player" });
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(BufferingIndicator_js_1.BufferingIndicator, { type: "player" });
|
|
10
10
|
}
|
|
11
11
|
if (playing) {
|
|
12
|
-
return jsx_runtime_1.jsx(icons_js_1.PauseIcon, {});
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(icons_js_1.PauseIcon, {});
|
|
13
13
|
}
|
|
14
|
-
return jsx_runtime_1.jsx(icons_js_1.PlayIcon, {});
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(icons_js_1.PlayIcon, {});
|
|
15
15
|
};
|
|
16
16
|
exports.DefaultPlayPauseButton = DefaultPlayPauseButton;
|
|
@@ -14,6 +14,6 @@ const PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
|
|
|
14
14
|
}
|
|
15
15
|
}, [emitter, currentPlaybackRate]);
|
|
16
16
|
(0, use_buffer_state_emitter_js_1.useBufferStateEmitter)(emitter);
|
|
17
|
-
return (jsx_runtime_1.jsx(emitter_context_js_1.PlayerEventEmitterContext.Provider, { value: emitter, children: children }));
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(emitter_context_js_1.PlayerEventEmitterContext.Provider, { value: emitter, children: children }));
|
|
18
18
|
};
|
|
19
19
|
exports.PlayerEmitterProvider = PlayerEmitterProvider;
|
|
@@ -58,7 +58,7 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, rend
|
|
|
58
58
|
}, []);
|
|
59
59
|
const renderDefaultMuteButton = (0, react_1.useCallback)(({ muted, volume }) => {
|
|
60
60
|
const isMutedOrZero = muted || volume === 0;
|
|
61
|
-
return (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 ? jsx_runtime_1.jsx(icons_js_1.VolumeOffIcon, {}) : jsx_runtime_1.jsx(icons_js_1.VolumeOnIcon, {}) }));
|
|
61
|
+
return ((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, {}) }));
|
|
62
62
|
}, [onBlur, onClick, volumeContainer]);
|
|
63
63
|
const muteButton = (0, react_1.useMemo)(() => {
|
|
64
64
|
return renderMuteButton
|
|
@@ -84,6 +84,6 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, rend
|
|
|
84
84
|
renderVolumeSlider,
|
|
85
85
|
setMediaVolume,
|
|
86
86
|
]);
|
|
87
|
-
return (jsx_runtime_1.jsxs("div", { ref: parentDivRef, style: parentDivStyle, children: [muteButton, volumeSlider] }));
|
|
87
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: parentDivRef, style: parentDivStyle, children: [muteButton, volumeSlider] }));
|
|
88
88
|
};
|
|
89
89
|
exports.MediaVolumeSlider = MediaVolumeSlider;
|
|
@@ -30,7 +30,7 @@ const checkmarkStyle = {
|
|
|
30
30
|
height: 14,
|
|
31
31
|
color: 'black',
|
|
32
32
|
};
|
|
33
|
-
const Checkmark = () => (jsx_runtime_1.jsx("svg", { viewBox: "0 0 512 512", style: checkmarkStyle, children: jsx_runtime_1.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" }) }));
|
|
33
|
+
const Checkmark = () => ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 512 512", style: checkmarkStyle, children: (0, jsx_runtime_1.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" }) }));
|
|
34
34
|
exports.Checkmark = Checkmark;
|
|
35
35
|
const formatPlaybackRate = (rate) => {
|
|
36
36
|
const str = rate.toString();
|
|
@@ -57,8 +57,7 @@ const PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate
|
|
|
57
57
|
backgroundColor: hovered || isFocused ? '#eee' : 'transparent',
|
|
58
58
|
};
|
|
59
59
|
}, [hovered, isFocused]);
|
|
60
|
-
return (jsx_runtime_1.jsxs("div", { onPointerEnter: onMouseEnter, onPointerLeave: onMouseLeave, tabIndex: 0, style: actualStyle, onClick: onClick, children: [
|
|
61
|
-
jsx_runtime_1.jsx("div", { style: checkmarkContainer, children: rate === selectedRate ? jsx_runtime_1.jsx(exports.Checkmark, {}) : null }), formatPlaybackRate(rate), "x"] }, rate));
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)("div", { onPointerEnter: onMouseEnter, onPointerLeave: onMouseLeave, tabIndex: 0, style: actualStyle, onClick: onClick, children: [(0, jsx_runtime_1.jsx)("div", { style: checkmarkContainer, children: rate === selectedRate ? (0, jsx_runtime_1.jsx)(exports.Checkmark, {}) : null }), formatPlaybackRate(rate), "x"] }, rate));
|
|
62
61
|
};
|
|
63
62
|
const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
64
63
|
const { setPlaybackRate, playbackRate } = remotion_1.Internals.usePlaybackRate();
|
|
@@ -123,8 +122,8 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) =>
|
|
|
123
122
|
textAlign: 'left',
|
|
124
123
|
};
|
|
125
124
|
}, [canvasSize.height]);
|
|
126
|
-
return (jsx_runtime_1.jsx("div", { style: playbackPopup, children: playbackRates.map((rate) => {
|
|
127
|
-
return (jsx_runtime_1.jsx(PlaybackrateOption, { selectedRate: playbackRate, onSelect: onSelect, rate: rate, keyboardSelectedRate: keyboardSelectedRate }, rate));
|
|
125
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: playbackPopup, children: playbackRates.map((rate) => {
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)(PlaybackrateOption, { selectedRate: playbackRate, onSelect: onSelect, rate: rate, keyboardSelectedRate: keyboardSelectedRate }, rate));
|
|
128
127
|
}) }));
|
|
129
128
|
};
|
|
130
129
|
const label = {
|
|
@@ -165,7 +164,6 @@ const PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
|
165
164
|
e.preventDefault();
|
|
166
165
|
setIsComponentVisible((prevIsComponentVisible) => !prevIsComponentVisible);
|
|
167
166
|
}, [setIsComponentVisible]);
|
|
168
|
-
return (jsx_runtime_1.jsx("div", { ref: ref, children: jsx_runtime_1.jsxs("button", { type: "button", "aria-label": "Change playback rate", style: button, onClick: onClick, children: [
|
|
169
|
-
jsx_runtime_1.jsxs("div", { style: label, children: [playbackRate, "x"] }), isComponentVisible && (jsx_runtime_1.jsx(PlaybackPopup, { canvasSize: canvasSize, playbackRates: playbackRates, setIsComponentVisible: setIsComponentVisible }))] }) }));
|
|
167
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", "aria-label": "Change playback rate", style: button, onClick: onClick, children: [(0, jsx_runtime_1.jsxs)("div", { style: label, children: [playbackRate, "x"] }), isComponentVisible && ((0, jsx_runtime_1.jsx)(PlaybackPopup, { canvasSize: canvasSize, playbackRates: playbackRates, setIsComponentVisible: setIsComponentVisible }))] }) }));
|
|
170
168
|
};
|
|
171
169
|
exports.PlaybackrateControl = PlaybackrateControl;
|
package/dist/cjs/Player.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ export type PlayerProps<Schema extends AnyZodObject, Props extends Record<string
|
|
|
28
28
|
readonly spaceKeyToPlayOrPause?: boolean;
|
|
29
29
|
readonly numberOfSharedAudioTags?: number;
|
|
30
30
|
readonly playbackRate?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Preserve @remotion/media audio pitch when changing the Player playback rate.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
readonly preservePitch?: boolean;
|
|
31
36
|
readonly renderLoading?: RenderLoading;
|
|
32
37
|
readonly moveToBeginningWhenEnded?: boolean;
|
|
33
38
|
readonly className?: string;
|
|
@@ -68,4 +73,4 @@ export type PlayerProps<Schema extends AnyZodObject, Props extends Record<string
|
|
|
68
73
|
} & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
69
74
|
export type PlayerPropsWithoutZod<Props extends Record<string, unknown>> = PlayerProps<AnyZodObject, Props>;
|
|
70
75
|
export declare const componentOrNullIfLazy: <Props>(props: CompProps<Props>) => ComponentType<Props> | null;
|
|
71
|
-
export declare const Player: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: PlayerProps<Schema, Props> & React.RefAttributes<PlayerRef>) => React.ReactElement
|
|
76
|
+
export declare const Player: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: PlayerProps<Schema, Props> & React.RefAttributes<PlayerRef>) => React.ReactElement | null;
|
package/dist/cjs/Player.js
CHANGED
|
@@ -73,7 +73,7 @@ const TimelineSequenceObserverComponent = ({ onTimelineSequenceChange }) => {
|
|
|
73
73
|
};
|
|
74
74
|
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 = no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES
|
|
75
75
|
? 0
|
|
76
|
-
: 5, errorFallback = () => '⚠️', playbackRate = 1, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, showPosterWhenBufferingAndPaused, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, renderFullscreenButton, renderPlayPauseButton, renderVolumeSlider, renderCustomControls, alwaysShowControls = false, initiallyMuted = false, showPlaybackRateControl = false, posterFillMode = 'player-size', bufferStateDelayInMilliseconds, defaultPremountInSeconds = no_react_1.NoReactInternals.DEFAULT_PREMOUNT_IN_SECONDS, hideControlsWhenPointerDoesntMove = true, overflowVisible = false, renderMuteButton, browserMediaControlsBehavior: passedBrowserMediaControlsBehavior, overrideInternalClassName, logLevel = 'info', noSuspense, acknowledgeRemotionLicense, audioLatencyHint = 'playback', sampleRate = 48000, volumePersistenceKey, initialVolume, _experimentalKeepAudioContextAlive = false, ...componentProps }, ref) => {
|
|
76
|
+
: 5, errorFallback = () => '⚠️', playbackRate = 1, preservePitch = false, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, showPosterWhenBufferingAndPaused, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, renderFullscreenButton, renderPlayPauseButton, renderVolumeSlider, renderCustomControls, alwaysShowControls = false, initiallyMuted = false, showPlaybackRateControl = false, posterFillMode = 'player-size', bufferStateDelayInMilliseconds, defaultPremountInSeconds = no_react_1.NoReactInternals.DEFAULT_PREMOUNT_IN_SECONDS, hideControlsWhenPointerDoesntMove = true, overflowVisible = false, renderMuteButton, browserMediaControlsBehavior: passedBrowserMediaControlsBehavior, overrideInternalClassName, logLevel = 'info', noSuspense, acknowledgeRemotionLicense, audioLatencyHint = 'playback', sampleRate = 48000, volumePersistenceKey, initialVolume, _experimentalKeepAudioContextAlive = false, ...componentProps }, ref) => {
|
|
77
77
|
no_react_1.NoReactInternals.validateDefaultPremountInSeconds(defaultPremountInSeconds);
|
|
78
78
|
if (typeof window !== 'undefined') {
|
|
79
79
|
window.remotion_isPlayer = true;
|
|
@@ -133,6 +133,9 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
133
133
|
if (typeof controls !== 'boolean' && typeof controls !== 'undefined') {
|
|
134
134
|
throw new TypeError(`'controls' must be a boolean or undefined but got '${typeof controls}' instead`);
|
|
135
135
|
}
|
|
136
|
+
if (typeof preservePitch !== 'boolean') {
|
|
137
|
+
throw new TypeError(`'preservePitch' must be a boolean but got '${typeof preservePitch}' instead`);
|
|
138
|
+
}
|
|
136
139
|
if (typeof autoPlay !== 'boolean' && typeof autoPlay !== 'undefined') {
|
|
137
140
|
throw new TypeError(`'autoPlay' must be a boolean or undefined but got '${typeof autoPlay}' instead`);
|
|
138
141
|
}
|
|
@@ -255,11 +258,10 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
255
258
|
mode: 'prevent-media-session',
|
|
256
259
|
});
|
|
257
260
|
}, [passedBrowserMediaControlsBehavior]);
|
|
258
|
-
const player = (jsx_runtime_1.jsx(remotion_1.Internals.IsPlayerContextProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContextValue, children: jsx_runtime_1.jsx(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineContextValue, playbackRateContext: playbackRateContextValue, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: numberOfSharedAudioTags, initiallyMuted: initiallyMuted, logLevel: logLevel, audioLatencyHint: audioLatencyHint, sampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, volumePersistenceKey: volumePersistenceKey, initialVolume: initialVolume, inputProps: actualInputProps, audioEnabled: true, children: jsx_runtime_1.jsx(EmitterProvider_js_1.PlayerEmitterProvider, { currentPlaybackRate: currentPlaybackRate, children: jsx_runtime_1.jsx(PlayerUI_js_1.default, { ref: rootRef, posterFillMode: posterFillMode, renderLoading: renderLoading, autoPlay: Boolean(autoPlay), loop: Boolean(loop), controls: Boolean(controls), errorFallback: errorFallback, style: style, inputProps: actualInputProps, allowFullscreen: Boolean(allowFullscreen), moveToBeginningWhenEnded: Boolean(moveToBeginningWhenEnded), clickToPlay: typeof clickToPlay === 'boolean'
|
|
261
|
+
const player = ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineContextValue, playbackRateContext: playbackRateContextValue, preservePitch: preservePitch, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: numberOfSharedAudioTags, initiallyMuted: initiallyMuted, logLevel: logLevel, audioLatencyHint: audioLatencyHint, sampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, volumePersistenceKey: volumePersistenceKey, initialVolume: initialVolume, inputProps: actualInputProps, audioEnabled: true, children: (0, jsx_runtime_1.jsx)(EmitterProvider_js_1.PlayerEmitterProvider, { currentPlaybackRate: currentPlaybackRate, children: (0, jsx_runtime_1.jsx)(PlayerUI_js_1.default, { ref: rootRef, posterFillMode: posterFillMode, renderLoading: renderLoading, autoPlay: Boolean(autoPlay), loop: Boolean(loop), controls: Boolean(controls), errorFallback: errorFallback, style: style, inputProps: actualInputProps, allowFullscreen: Boolean(allowFullscreen), moveToBeginningWhenEnded: Boolean(moveToBeginningWhenEnded), clickToPlay: typeof clickToPlay === 'boolean'
|
|
259
262
|
? clickToPlay
|
|
260
263
|
: Boolean(controls), showVolumeControls: Boolean(showVolumeControls), doubleClickToFullscreen: Boolean(doubleClickToFullscreen), spaceKeyToPlayOrPause: Boolean(spaceKeyToPlayOrPause), playbackRate: currentPlaybackRate, className: className !== null && className !== void 0 ? className : undefined, showPosterWhenUnplayed: Boolean(showPosterWhenUnplayed), showPosterWhenEnded: Boolean(showPosterWhenEnded), showPosterWhenPaused: Boolean(showPosterWhenPaused), showPosterWhenBuffering: Boolean(showPosterWhenBuffering), showPosterWhenBufferingAndPaused: Boolean(showPosterWhenBufferingAndPaused), 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, renderMuteButton: renderMuteButton !== null && renderMuteButton !== void 0 ? renderMuteButton : null, renderVolumeSlider: renderVolumeSlider !== null && renderVolumeSlider !== void 0 ? renderVolumeSlider : null, renderCustomControls: renderCustomControls !== null && renderCustomControls !== void 0 ? renderCustomControls : null, alwaysShowControls: alwaysShowControls, showPlaybackRateControl: showPlaybackRateControl, bufferStateDelayInMilliseconds: bufferStateDelayInMilliseconds !== null && bufferStateDelayInMilliseconds !== void 0 ? bufferStateDelayInMilliseconds : 300, hideControlsWhenPointerDoesntMove: hideControlsWhenPointerDoesntMove, overflowVisible: overflowVisible, browserMediaControlsBehavior: browserMediaControlsBehavior, overrideInternalClassName: overrideInternalClassName !== null && overrideInternalClassName !== void 0 ? overrideInternalClassName : undefined, noSuspense: Boolean(noSuspense) }) }) }) }) }));
|
|
261
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.DefaultPremountContext.Provider, { value: defaultPremountInSeconds, children: onTimelineSequenceChange ? (jsx_runtime_1.jsx(remotion_1.Internals.SequenceRegistrationContext.Provider, { value: true, children: jsx_runtime_1.jsxs(remotion_1.Internals.SequenceManagerProvider, { children: [
|
|
262
|
-
jsx_runtime_1.jsx(TimelineSequenceObserverComponent, { onTimelineSequenceChange: onTimelineSequenceChange }), player] }) })) : (player) }));
|
|
264
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.DefaultPremountContext.Provider, { value: defaultPremountInSeconds, children: onTimelineSequenceChange ? ((0, jsx_runtime_1.jsx)(remotion_1.Internals.SequenceRegistrationContext.Provider, { value: true, children: (0, jsx_runtime_1.jsxs)(remotion_1.Internals.SequenceManagerProvider, { children: [(0, jsx_runtime_1.jsx)(TimelineSequenceObserverComponent, { onTimelineSequenceChange: onTimelineSequenceChange }), player] }) })) : (player) }));
|
|
263
265
|
};
|
|
264
266
|
const forward = react_1.forwardRef;
|
|
265
267
|
/*
|
|
@@ -165,19 +165,11 @@ const Controls = ({ durationInFrames, isFullscreen, fps, showVolumeControls, onF
|
|
|
165
165
|
onDoubleClick === null || onDoubleClick === void 0 ? void 0 : onDoubleClick(e);
|
|
166
166
|
}
|
|
167
167
|
}, [onDoubleClick]);
|
|
168
|
-
return (jsx_runtime_1.jsxs("div", { ref: ref, style: containerCss, onPointerDown: onPointerDownIfContainer, onDoubleClick: onDoubleClickIfContainer, children: [
|
|
169
|
-
jsx_runtime_1.jsxs("div", { ref: flexRef, style: controlsRow, children: [
|
|
170
|
-
jsx_runtime_1.jsxs("div", { style: leftPartStyle, children: [
|
|
171
|
-
jsx_runtime_1.jsx("button", { ref: playButtonRef, type: "button", style: PlaybackrateControl_js_1.playerButtonStyle, onClick: toggle, "aria-label": playing ? 'Pause video' : 'Play video', title: playing ? 'Pause video' : 'Play video', children: renderPlayPauseButton === null ? (jsx_runtime_1.jsx(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: playing })) : (((_b = renderPlayPauseButton({
|
|
168
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: containerCss, onPointerDown: onPointerDownIfContainer, onDoubleClick: onDoubleClickIfContainer, children: [(0, jsx_runtime_1.jsxs)("div", { ref: flexRef, style: controlsRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftPartStyle, children: [(0, jsx_runtime_1.jsx)("button", { ref: playButtonRef, type: "button", style: PlaybackrateControl_js_1.playerButtonStyle, onClick: toggle, "aria-label": playing ? 'Pause video' : 'Play video', title: playing ? 'Pause video' : 'Play video', children: renderPlayPauseButton === null ? ((0, jsx_runtime_1.jsx)(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: playing })) : (((_b = renderPlayPauseButton({
|
|
172
169
|
playing,
|
|
173
170
|
isBuffering: buffering,
|
|
174
|
-
})) !== null && _b !== void 0 ? _b : (jsx_runtime_1.jsx(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: playing })))) }), showVolumeControls ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
175
|
-
jsx_runtime_1.jsx("div", { style: xSpacer }), jsx_runtime_1.jsx(MediaVolumeSlider_js_1.MediaVolumeSlider, { renderMuteButton: renderMuteButton, renderVolumeSlider: renderVolumeSlider, displayVerticalVolumeSlider: displayVerticalVolumeSlider })
|
|
176
|
-
] })) : null, jsx_runtime_1.jsx("div", { style: xSpacer }), jsx_runtime_1.jsx(PlayerTimeLabel_js_1.PlayerTimeLabel, { durationInFrames: durationInFrames, fps: fps, maxTimeLabelWidth: maxTimeLabelWidth }), jsx_runtime_1.jsx("div", { style: xSpacer })
|
|
177
|
-
] }), jsx_runtime_1.jsx("div", { style: flex1 }), customControlsElement, customControlsElement && playbackRates && canvasSize ? (jsx_runtime_1.jsx("div", { style: xSpacer })) : null, playbackRates && canvasSize && (jsx_runtime_1.jsx(PlaybackrateControl_js_1.PlaybackrateControl, { canvasSize: canvasSize, playbackRates: playbackRates })), playbackRates && supportsFullscreen && allowFullscreen ? (jsx_runtime_1.jsx("div", { style: xSpacer })) : null, jsx_runtime_1.jsx("div", { style: fullscreen, children: supportsFullscreen && allowFullscreen ? (jsx_runtime_1.jsx("button", { type: "button", "aria-label": isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', title: isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', style: PlaybackrateControl_js_1.playerButtonStyle, onClick: isFullscreen
|
|
171
|
+
})) !== null && _b !== void 0 ? _b : ((0, jsx_runtime_1.jsx)(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: 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, { renderMuteButton: renderMuteButton, renderVolumeSlider: renderVolumeSlider, displayVerticalVolumeSlider: displayVerticalVolumeSlider })] })) : null, (0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsx)(PlayerTimeLabel_js_1.PlayerTimeLabel, { durationInFrames: durationInFrames, fps: fps, maxTimeLabelWidth: maxTimeLabelWidth }), (0, jsx_runtime_1.jsx)("div", { style: xSpacer })] }), (0, jsx_runtime_1.jsx)("div", { style: flex1 }), customControlsElement, customControlsElement && playbackRates && canvasSize ? ((0, jsx_runtime_1.jsx)("div", { style: xSpacer })) : null, playbackRates && canvasSize && ((0, jsx_runtime_1.jsx)(PlaybackrateControl_js_1.PlaybackrateControl, { canvasSize: canvasSize, playbackRates: playbackRates })), playbackRates && supportsFullscreen && allowFullscreen ? ((0, jsx_runtime_1.jsx)("div", { style: xSpacer })) : null, (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: PlaybackrateControl_js_1.playerButtonStyle, onClick: isFullscreen
|
|
178
172
|
? onExitFullscreenButtonClick
|
|
179
|
-
: onFullscreenButtonClick, children: renderFullscreenButton === null ? (jsx_runtime_1.jsx(icons_js_1.FullscreenIcon, { isFullscreen: isFullscreen })) : (renderFullscreenButton({ isFullscreen })) })) : null })
|
|
180
|
-
] }), jsx_runtime_1.jsx("div", { style: ySpacer }), jsx_runtime_1.jsx(PlayerSeekBar_js_1.PlayerSeekBar, { onSeekEnd: onSeekEnd, onSeekStart: onSeekStart, durationInFrames: durationInFrames, inFrame: inFrame, outFrame: outFrame })
|
|
181
|
-
] }));
|
|
173
|
+
: 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 })] }));
|
|
182
174
|
};
|
|
183
175
|
exports.Controls = Controls;
|
|
@@ -145,10 +145,6 @@ const PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outF
|
|
|
145
145
|
position: 'absolute',
|
|
146
146
|
};
|
|
147
147
|
}, [durationInFrames, inFrame, outFrame]);
|
|
148
|
-
return (jsx_runtime_1.jsxs("div", { ref: containerRef, onPointerDown: onPointerDown, style: containerStyle, children: [
|
|
149
|
-
jsx_runtime_1.jsxs("div", { style: barBackground, children: [
|
|
150
|
-
jsx_runtime_1.jsx("div", { style: active }), jsx_runtime_1.jsx("div", { style: fillStyle })
|
|
151
|
-
] }), jsx_runtime_1.jsx("div", { style: knobStyle })
|
|
152
|
-
] }));
|
|
148
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: containerRef, onPointerDown: onPointerDown, style: containerStyle, children: [(0, jsx_runtime_1.jsxs)("div", { style: barBackground, children: [(0, jsx_runtime_1.jsx)("div", { style: active }), (0, jsx_runtime_1.jsx)("div", { style: fillStyle })] }), (0, jsx_runtime_1.jsx)("div", { style: knobStyle })] }));
|
|
153
149
|
};
|
|
154
150
|
exports.PlayerSeekBar = PlayerSeekBar;
|
|
@@ -20,6 +20,6 @@ const PlayerTimeLabel = ({ durationInFrames, maxTimeLabelWidth, fps }) => {
|
|
|
20
20
|
// If the video ended and is not looping, it should show 0:04 / 0:04 instead of 0:03 / 0:04
|
|
21
21
|
const isLastFrame = frame === durationInFrames - 1;
|
|
22
22
|
const frameToDisplay = isLastFrame ? frame + 1 : frame;
|
|
23
|
-
return (jsx_runtime_1.jsxs("div", { style: timeLabel, children: [(0, format_time_1.formatTime)(frameToDisplay / fps), " / ", (0, format_time_1.formatTime)(durationInFrames / fps)] }));
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: timeLabel, children: [(0, format_time_1.formatTime)(frameToDisplay / fps), " / ", (0, format_time_1.formatTime)(durationInFrames / fps)] }));
|
|
24
24
|
};
|
|
25
25
|
exports.PlayerTimeLabel = PlayerTimeLabel;
|
package/dist/cjs/PlayerUI.d.ts
CHANGED
|
@@ -21,14 +21,14 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
21
21
|
readonly allowFullscreen: boolean;
|
|
22
22
|
readonly inputProps: Record<string, unknown>;
|
|
23
23
|
readonly showVolumeControls: boolean;
|
|
24
|
-
readonly style?: React.CSSProperties
|
|
24
|
+
readonly style?: React.CSSProperties;
|
|
25
25
|
readonly clickToPlay: boolean;
|
|
26
26
|
readonly doubleClickToFullscreen: boolean;
|
|
27
27
|
readonly spaceKeyToPlayOrPause: boolean;
|
|
28
28
|
readonly errorFallback: ErrorFallback;
|
|
29
29
|
readonly playbackRate: number;
|
|
30
30
|
readonly renderLoading: RenderLoading | undefined;
|
|
31
|
-
readonly renderPoster:
|
|
31
|
+
readonly renderPoster: RenderPoster | undefined;
|
|
32
32
|
readonly className: string | undefined;
|
|
33
33
|
readonly moveToBeginningWhenEnded: boolean;
|
|
34
34
|
readonly showPosterWhenPaused: boolean;
|
|
@@ -48,7 +48,7 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
48
48
|
readonly showPlaybackRateControl: boolean | number[];
|
|
49
49
|
readonly posterFillMode: PosterFillMode;
|
|
50
50
|
readonly bufferStateDelayInMilliseconds: number;
|
|
51
|
-
readonly hideControlsWhenPointerDoesntMove:
|
|
51
|
+
readonly hideControlsWhenPointerDoesntMove: boolean | number;
|
|
52
52
|
readonly overflowVisible: boolean;
|
|
53
53
|
readonly browserMediaControlsBehavior: BrowserMediaControlsBehavior;
|
|
54
54
|
readonly overrideInternalClassName: string | undefined;
|
package/dist/cjs/PlayerUI.js
CHANGED
|
@@ -449,19 +449,16 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
449
449
|
showPosterWhenBufferingAndPaused && showBufferIndicator && !playing,
|
|
450
450
|
].some(Boolean);
|
|
451
451
|
const { left, top, width, height, ...outerWithoutScale } = outer;
|
|
452
|
-
const content = (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
453
|
-
jsx_runtime_1.jsxs("div", { style: outer, onPointerDown: clickToPlay ? handlePointerDown : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: [
|
|
454
|
-
jsx_runtime_1.jsxs("div", { ref: canvasContentRef, style: containerStyle, className: (0, player_css_classname_js_1.playerCssClassname)(overrideInternalClassName), children: [VideoComponent ? (jsx_runtime_1.jsx(error_boundary_js_1.ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: jsx_runtime_1.jsx(remotion_1.Internals.CurrentScaleContext.Provider, { value: currentScale, children: jsx_runtime_1.jsx(canvas_overlay_context_js_1.CanvasOverlayContext.Provider, { value: null, children: jsx_runtime_1.jsx(VideoComponent, { ...((_c = video === null || video === void 0 ? void 0 : video.props) !== null && _c !== void 0 ? _c : {}), ...(inputProps !== null && inputProps !== void 0 ? inputProps : {}) }) }) }) })) : null, shouldShowPoster && posterFillMode === 'composition-size' ? (jsx_runtime_1.jsx("div", { style: {
|
|
452
|
+
const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { style: outer, onPointerDown: clickToPlay ? handlePointerDown : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: [(0, jsx_runtime_1.jsxs)("div", { ref: canvasContentRef, style: containerStyle, className: (0, player_css_classname_js_1.playerCssClassname)(overrideInternalClassName), children: [VideoComponent ? ((0, jsx_runtime_1.jsx)(error_boundary_js_1.ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CurrentScaleContext.Provider, { value: currentScale, children: (0, jsx_runtime_1.jsx)(canvas_overlay_context_js_1.CanvasOverlayContext.Provider, { value: null, children: (0, jsx_runtime_1.jsx)(VideoComponent, { ...((_c = video === null || video === void 0 ? void 0 : video.props) !== null && _c !== void 0 ? _c : {}), ...(inputProps !== null && inputProps !== void 0 ? inputProps : {}) }) }) }) })) : null, shouldShowPoster && posterFillMode === 'composition-size' ? ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
455
453
|
...outerWithoutScale,
|
|
456
454
|
width: config.width,
|
|
457
455
|
height: config.height,
|
|
458
|
-
}, onPointerDown: clickToPlay ? handlePointerDown : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null] }), jsx_runtime_1.jsx(license_blacklist_js_1.RenderWarningIfBlacklist, {}), jsx_runtime_1.jsx(canvas_overlay_context_js_1.CanvasContentContext.Provider, { value: canvasContent, children: canvasOverlay })
|
|
459
|
-
] }), shouldShowPoster && posterFillMode === 'player-size' ? (jsx_runtime_1.jsx("div", { style: outer, onPointerDown: clickToPlay ? handlePointerDown : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null, controls ? (jsx_runtime_1.jsx(PlayerControls_js_1.Controls, { fps: config.fps, playing: playing, toggle: toggle, durationInFrames: config.durationInFrames, containerRef: container, 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, buffering: showBufferIndicator, hideControlsWhenPointerDoesntMove: hideControlsWhenPointerDoesntMove, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, onPointerDown: clickToPlay
|
|
456
|
+
}, onPointerDown: clickToPlay ? handlePointerDown : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null] }), (0, jsx_runtime_1.jsx)(license_blacklist_js_1.RenderWarningIfBlacklist, {}), (0, jsx_runtime_1.jsx)(canvas_overlay_context_js_1.CanvasContentContext.Provider, { value: canvasContent, children: canvasOverlay })] }), shouldShowPoster && posterFillMode === 'player-size' ? ((0, jsx_runtime_1.jsx)("div", { style: outer, onPointerDown: clickToPlay ? handlePointerDown : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null, controls ? ((0, jsx_runtime_1.jsx)(PlayerControls_js_1.Controls, { fps: config.fps, playing: playing, toggle: toggle, durationInFrames: config.durationInFrames, containerRef: container, 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, buffering: showBufferIndicator, hideControlsWhenPointerDoesntMove: hideControlsWhenPointerDoesntMove, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, onPointerDown: clickToPlay
|
|
460
457
|
? handlePointerDown
|
|
461
458
|
: undefined, renderMuteButton: renderMuteButton, renderVolumeSlider: renderVolumeSlider, renderCustomControls: renderCustomControls })) : null] }));
|
|
462
459
|
if (noSuspense || (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense)) {
|
|
463
|
-
return (jsx_runtime_1.jsx("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
460
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
464
461
|
}
|
|
465
|
-
return (jsx_runtime_1.jsx("div", { ref: container, style: outerStyle, className: className, children: jsx_runtime_1.jsx(react_1.Suspense, { fallback: loadingMarkup, children: content }) }));
|
|
462
|
+
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 }) }));
|
|
466
463
|
};
|
|
467
464
|
exports.default = (0, react_1.forwardRef)(PlayerUI);
|
|
@@ -6,6 +6,7 @@ export declare const SharedPlayerContexts: React.FC<{
|
|
|
6
6
|
readonly children: React.ReactNode;
|
|
7
7
|
readonly timelineContext: TimelineContextValue;
|
|
8
8
|
readonly playbackRateContext: PlaybackRateContextValue;
|
|
9
|
+
readonly preservePitch: boolean;
|
|
9
10
|
readonly fps: number;
|
|
10
11
|
readonly compositionWidth: number;
|
|
11
12
|
readonly compositionHeight: number;
|
|
@@ -6,7 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const volume_persistence_js_1 = require("./volume-persistence.js");
|
|
8
8
|
exports.PLAYER_COMP_ID = 'player-comp';
|
|
9
|
-
const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, audioLatencyHint, sampleRate, volumePersistenceKey, initialVolume, inputProps, audioEnabled, _experimentalKeepAudioContextAlive, }) => {
|
|
9
|
+
const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext, preservePitch, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, audioLatencyHint, sampleRate, volumePersistenceKey, initialVolume, inputProps, audioEnabled, _experimentalKeepAudioContextAlive, }) => {
|
|
10
10
|
const persistVolumeToStorage = initialVolume === undefined;
|
|
11
11
|
const compositionManagerContext = (0, react_1.useMemo)(() => {
|
|
12
12
|
const context = {
|
|
@@ -93,6 +93,6 @@ const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext,
|
|
|
93
93
|
isReadOnlyStudio: false,
|
|
94
94
|
};
|
|
95
95
|
}, []);
|
|
96
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.RemotionEnvironmentContext.Provider, { value: env, children: jsx_runtime_1.jsx(remotion_1.Internals.LogLevelContext.Provider, { value: logLevelContext, children: jsx_runtime_1.jsx(remotion_1.Internals.CanUseRemotionHooksProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.AbsoluteTimeContext.Provider, { value: timelineContext, children: jsx_runtime_1.jsx(remotion_1.Internals.PlaybackRateContext.Provider, { value: playbackRateContext, children: jsx_runtime_1.jsx(remotion_1.Internals.TimelineContext.Provider, { value: timelineContext, children: jsx_runtime_1.jsx(remotion_1.Internals.CompositionManager.Provider, { value: compositionManagerContext, children: jsx_runtime_1.jsx(remotion_1.Internals.VideoProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.PrefetchProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.DurationsContextProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.MediaVolumeContext.Provider, { value: mediaVolumeContextValue, children: jsx_runtime_1.jsx(remotion_1.Internals.SetMediaVolumeContext.Provider, { value: setMediaVolumeContextValue, children: jsx_runtime_1.jsx(remotion_1.Internals.BufferingProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled: shouldCreateAudioContext, previewSampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, children: jsx_runtime_1.jsx(remotion_1.Internals.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
96
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionEnvironmentContext.Provider, { value: env, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.LogLevelContext.Provider, { value: logLevelContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.AbsoluteTimeContext.Provider, { value: timelineContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PlaybackRateContext.Provider, { value: playbackRateContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PlaybackPitchContext.Provider, { value: preservePitch, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.TimelineContext.Provider, { value: timelineContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CompositionManager.Provider, { value: compositionManagerContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.VideoProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.DurationsContextProvider, { 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.BufferingProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled: shouldCreateAudioContext, previewSampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
97
97
|
};
|
|
98
98
|
exports.SharedPlayerContexts = SharedPlayerContexts;
|
package/dist/cjs/Thumbnail.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export type ThumbnailProps<Schema extends AnyZodObject, Props extends Record<str
|
|
|
19
19
|
readonly noSuspense?: boolean;
|
|
20
20
|
};
|
|
21
21
|
export type ThumbnailPropsWithoutZod<Props extends Record<string, unknown>> = ThumbnailProps<AnyZodObject, Props>;
|
|
22
|
-
export declare const Thumbnail: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: ThumbnailProps<Schema, Props> & import("react").RefAttributes<ThumbnailMethods>) =>
|
|
22
|
+
export declare const Thumbnail: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: ThumbnailProps<Schema, Props> & import("react").RefAttributes<ThumbnailMethods>) => React.ReactElement | null;
|
package/dist/cjs/Thumbnail.js
CHANGED
|
@@ -70,7 +70,7 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
70
70
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
71
71
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
72
72
|
}, [inputProps]);
|
|
73
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.IsPlayerContextProvider, { children: jsx_runtime_1.jsx(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContext, children: jsx_runtime_1.jsx(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineState, playbackRateContext: playbackRateContext, component: Component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: 0, initiallyMuted: true, logLevel: logLevel, audioLatencyHint: "playback", sampleRate: 48000, inputProps: passedInputProps, audioEnabled: false, _experimentalKeepAudioContextAlive: false, children: jsx_runtime_1.jsx(emitter_context_js_1.ThumbnailEmitterContext.Provider, { value: emitter, children: jsx_runtime_1.jsx(ThumbnailUI_js_1.default, { ref: rootRef, className: className, errorFallback: errorFallback, inputProps: passedInputProps, renderLoading: renderLoading, style: style, overflowVisible: overflowVisible, overrideInternalClassName: overrideInternalClassName, noSuspense: Boolean(noSuspense) }) }) }) }) }));
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContext, children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineState, playbackRateContext: playbackRateContext, preservePitch: false, component: Component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: 0, initiallyMuted: true, logLevel: logLevel, audioLatencyHint: "playback", sampleRate: 48000, inputProps: passedInputProps, audioEnabled: false, _experimentalKeepAudioContextAlive: false, children: (0, jsx_runtime_1.jsx)(emitter_context_js_1.ThumbnailEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(ThumbnailUI_js_1.default, { ref: rootRef, className: className, errorFallback: errorFallback, inputProps: passedInputProps, renderLoading: renderLoading, style: style, overflowVisible: overflowVisible, overrideInternalClassName: overrideInternalClassName, noSuspense: Boolean(noSuspense) }) }) }) }) }));
|
|
74
74
|
};
|
|
75
75
|
const forward = react_1.forwardRef;
|
|
76
76
|
/*
|
|
@@ -3,7 +3,7 @@ import type { ThumbnailMethods } from './player-methods.js';
|
|
|
3
3
|
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<{
|
|
5
5
|
readonly inputProps: Record<string, unknown>;
|
|
6
|
-
readonly style?: React.CSSProperties
|
|
6
|
+
readonly style?: React.CSSProperties;
|
|
7
7
|
readonly errorFallback: ErrorFallback;
|
|
8
8
|
readonly renderLoading: RenderLoading | undefined;
|
|
9
9
|
readonly className: string | undefined;
|
package/dist/cjs/ThumbnailUI.js
CHANGED
|
@@ -121,10 +121,10 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
|
|
|
121
121
|
if (!config) {
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
124
|
-
const content = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsx("div", { style: containerStyle, className: (0, player_css_classname_js_1.playerCssClassname)(overrideInternalClassName), children: VideoComponent ? (jsx_runtime_1.jsx(error_boundary_js_1.ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: jsx_runtime_1.jsx(remotion_1.Internals.CurrentScaleContext.Provider, { value: currentScaleContext, children: jsx_runtime_1.jsx(VideoComponent, { ...((_b = video === null || video === void 0 ? void 0 : video.props) !== null && _b !== void 0 ? _b : {}), ...(inputProps !== null && inputProps !== void 0 ? inputProps : {}) }) }) })) : null }) }));
|
|
124
|
+
const content = ((0, jsx_runtime_1.jsx)("div", { style: outer, children: (0, jsx_runtime_1.jsx)("div", { style: containerStyle, className: (0, player_css_classname_js_1.playerCssClassname)(overrideInternalClassName), children: VideoComponent ? ((0, jsx_runtime_1.jsx)(error_boundary_js_1.ErrorBoundary, { onError: onError, errorFallback: errorFallback, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CurrentScaleContext.Provider, { value: currentScaleContext, children: (0, jsx_runtime_1.jsx)(VideoComponent, { ...((_b = video === null || video === void 0 ? void 0 : video.props) !== null && _b !== void 0 ? _b : {}), ...(inputProps !== null && inputProps !== void 0 ? inputProps : {}) }) }) })) : null }) }));
|
|
125
125
|
if (noSuspense || (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense)) {
|
|
126
|
-
return (jsx_runtime_1.jsx("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
127
127
|
}
|
|
128
|
-
return (jsx_runtime_1.jsx("div", { ref: container, style: outerStyle, className: className, children: jsx_runtime_1.jsx(react_1.Suspense, { fallback: loadingMarkup, children: content }) }));
|
|
128
|
+
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 }) }));
|
|
129
129
|
};
|
|
130
130
|
exports.default = (0, react_1.forwardRef)(ThumbnailUI);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VideoConfig } from 'remotion';
|
|
1
|
+
import type { PreviewSize, VideoConfig } from 'remotion';
|
|
2
2
|
import type { Size } from './utils/use-element-size.js';
|
|
3
3
|
type Layout = {
|
|
4
4
|
centerX: number;
|
|
@@ -8,24 +8,24 @@ type Layout = {
|
|
|
8
8
|
scale: number;
|
|
9
9
|
};
|
|
10
10
|
export declare const calculateCanvasTransformation: ({ previewSize, compositionWidth, compositionHeight, canvasSize, }: {
|
|
11
|
-
previewSize:
|
|
11
|
+
previewSize: PreviewSize['size'];
|
|
12
12
|
compositionWidth: number;
|
|
13
13
|
compositionHeight: number;
|
|
14
14
|
canvasSize: Size;
|
|
15
15
|
}) => Layout;
|
|
16
16
|
export declare const calculateOuterStyle: ({ config, style, canvasSize, overflowVisible, layout, }: {
|
|
17
17
|
config: VideoConfig | null;
|
|
18
|
-
style:
|
|
18
|
+
style: React.CSSProperties | undefined;
|
|
19
19
|
canvasSize: Size | null;
|
|
20
20
|
overflowVisible: boolean;
|
|
21
21
|
layout: Layout | null;
|
|
22
|
-
}) =>
|
|
22
|
+
}) => React.CSSProperties;
|
|
23
23
|
export declare const calculateContainerStyle: ({ config, layout, scale, overflowVisible, }: {
|
|
24
24
|
config: VideoConfig | null;
|
|
25
25
|
layout: Layout | null;
|
|
26
26
|
scale: number;
|
|
27
27
|
overflowVisible: boolean;
|
|
28
|
-
}) =>
|
|
28
|
+
}) => React.CSSProperties;
|
|
29
29
|
export declare const calculateOuter: ({ layout, scale, config, overflowVisible, }: {
|
|
30
30
|
layout: Layout | null;
|
|
31
31
|
scale: number;
|
|
@@ -43,18 +43,18 @@ export declare const calculateOuter: ({ layout, scale, config, overflowVisible,
|
|
|
43
43
|
} | {
|
|
44
44
|
readonly width: number;
|
|
45
45
|
readonly height: number;
|
|
46
|
-
readonly display:
|
|
47
|
-
readonly flexDirection:
|
|
48
|
-
readonly position:
|
|
46
|
+
readonly display: 'flex';
|
|
47
|
+
readonly flexDirection: 'column';
|
|
48
|
+
readonly position: 'absolute';
|
|
49
49
|
readonly overflow: "hidden" | "visible";
|
|
50
50
|
readonly left?: undefined;
|
|
51
51
|
readonly top?: undefined;
|
|
52
52
|
} | {
|
|
53
53
|
readonly width: number;
|
|
54
54
|
readonly height: number;
|
|
55
|
-
readonly display:
|
|
56
|
-
readonly flexDirection:
|
|
57
|
-
readonly position:
|
|
55
|
+
readonly display: 'flex';
|
|
56
|
+
readonly flexDirection: 'column';
|
|
57
|
+
readonly position: 'absolute';
|
|
58
58
|
readonly left: number;
|
|
59
59
|
readonly top: number;
|
|
60
60
|
readonly overflow: "hidden" | "visible";
|
|
@@ -15,7 +15,10 @@ const errorStyle = {
|
|
|
15
15
|
width: '100%',
|
|
16
16
|
};
|
|
17
17
|
class ErrorBoundary extends react_1.default.Component {
|
|
18
|
-
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.state = { hasError: null };
|
|
21
|
+
}
|
|
19
22
|
static getDerivedStateFromError(error) {
|
|
20
23
|
// Update state so the next render will show the fallback UI.
|
|
21
24
|
return { hasError: error };
|
|
@@ -26,7 +29,7 @@ class ErrorBoundary extends react_1.default.Component {
|
|
|
26
29
|
render() {
|
|
27
30
|
if (this.state.hasError) {
|
|
28
31
|
// You can render any custom fallback UI
|
|
29
|
-
return (jsx_runtime_1.jsx("div", { style: errorStyle, children: this.props.errorFallback({
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: errorStyle, children: this.props.errorFallback({
|
|
30
33
|
error: this.state.hasError,
|
|
31
34
|
}) }));
|
|
32
35
|
}
|