@remotion/player 4.0.270 → 4.0.272
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Player.d.ts +1 -0
- package/dist/cjs/Player.js +3 -2
- package/dist/cjs/PlayerUI.d.ts +1 -0
- package/dist/cjs/PlayerUI.js +2 -2
- package/dist/cjs/Thumbnail.d.ts +1 -0
- package/dist/cjs/Thumbnail.js +3 -2
- package/dist/cjs/ThumbnailUI.d.ts +1 -0
- package/dist/cjs/ThumbnailUI.js +2 -2
- package/dist/cjs/utils/use-element-size.js +21 -9
- package/dist/esm/index.mjs +29 -15
- package/package.json +3 -3
package/dist/cjs/Player.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export type PlayerProps<Schema extends AnyZodObject, Props extends Record<string
|
|
|
56
56
|
readonly browserMediaControlsBehavior?: BrowserMediaControlsBehavior;
|
|
57
57
|
readonly overrideInternalClassName?: string;
|
|
58
58
|
readonly logLevel?: LogLevel;
|
|
59
|
+
readonly noSuspense?: boolean;
|
|
59
60
|
readonly acknowledgeRemotionLicense?: boolean;
|
|
60
61
|
} & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
61
62
|
export type PlayerPropsWithoutZod<Props extends Record<string, unknown>> = PlayerProps<AnyZodObject, Props>;
|
package/dist/cjs/Player.js
CHANGED
|
@@ -23,7 +23,7 @@ const componentOrNullIfLazy = (props) => {
|
|
|
23
23
|
return null;
|
|
24
24
|
};
|
|
25
25
|
exports.componentOrNullIfLazy = componentOrNullIfLazy;
|
|
26
|
-
const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls = false, loop = false, autoPlay = false, showVolumeControls = true, allowFullscreen = true, clickToPlay, doubleClickToFullscreen = false, spaceKeyToPlayOrPause = true, moveToBeginningWhenEnded = true, numberOfSharedAudioTags = 5, errorFallback = () => '⚠️', playbackRate = 1, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, renderFullscreenButton, renderPlayPauseButton, renderVolumeSlider, alwaysShowControls = false, initiallyMuted = false, showPlaybackRateControl = false, posterFillMode = 'player-size', bufferStateDelayInMilliseconds, hideControlsWhenPointerDoesntMove = true, overflowVisible = false, renderMuteButton, browserMediaControlsBehavior: passedBrowserMediaControlsBehavior, overrideInternalClassName, logLevel = 'info', acknowledgeRemotionLicense, ...componentProps }, ref) => {
|
|
26
|
+
const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls = false, loop = false, autoPlay = false, showVolumeControls = true, allowFullscreen = true, clickToPlay, doubleClickToFullscreen = false, spaceKeyToPlayOrPause = true, moveToBeginningWhenEnded = true, numberOfSharedAudioTags = 5, errorFallback = () => '⚠️', playbackRate = 1, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, renderFullscreenButton, renderPlayPauseButton, renderVolumeSlider, alwaysShowControls = false, initiallyMuted = false, showPlaybackRateControl = false, posterFillMode = 'player-size', bufferStateDelayInMilliseconds, hideControlsWhenPointerDoesntMove = true, overflowVisible = false, renderMuteButton, browserMediaControlsBehavior: passedBrowserMediaControlsBehavior, overrideInternalClassName, logLevel = 'info', noSuspense, acknowledgeRemotionLicense, ...componentProps }, ref) => {
|
|
27
27
|
if (typeof window !== 'undefined') {
|
|
28
28
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
29
29
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -46,6 +46,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
46
46
|
const component = remotion_1.Internals.useLazyComponent({
|
|
47
47
|
compProps: componentProps,
|
|
48
48
|
componentName: 'Player',
|
|
49
|
+
noSuspense: Boolean(noSuspense),
|
|
49
50
|
});
|
|
50
51
|
(0, validate_initial_frame_js_1.validateInitialFrame)({ initialFrame, durationInFrames });
|
|
51
52
|
const [frame, setFrame] = (0, react_1.useState)(() => ({
|
|
@@ -158,7 +159,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
158
159
|
}, [passedBrowserMediaControlsBehavior]);
|
|
159
160
|
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, numberOfSharedAudioTags: numberOfSharedAudioTags, initiallyMuted: initiallyMuted, logLevel: logLevel, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.SetTimelineContext.Provider, { value: setTimelineContextValue, 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'
|
|
160
161
|
? clickToPlay
|
|
161
|
-
: 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), 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, 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 }) }) }) }) }));
|
|
162
|
+
: 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), 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, 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) }) }) }) }) }));
|
|
162
163
|
};
|
|
163
164
|
const forward = react_1.forwardRef;
|
|
164
165
|
/*
|
package/dist/cjs/PlayerUI.d.ts
CHANGED
|
@@ -50,5 +50,6 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
50
50
|
readonly overflowVisible: boolean;
|
|
51
51
|
readonly browserMediaControlsBehavior: BrowserMediaControlsBehavior;
|
|
52
52
|
readonly overrideInternalClassName: string | undefined;
|
|
53
|
+
readonly noSuspense: boolean;
|
|
53
54
|
} & React.RefAttributes<PlayerRef>>;
|
|
54
55
|
export default _default;
|
package/dist/cjs/PlayerUI.js
CHANGED
|
@@ -41,7 +41,7 @@ if (reactVersion === '0') {
|
|
|
41
41
|
throw new Error(`Version ${reactVersion} of "react" is not supported by Remotion`);
|
|
42
42
|
}
|
|
43
43
|
const doesReactVersionSupportSuspense = parseInt(reactVersion, 10) >= 18;
|
|
44
|
-
const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps, clickToPlay, showVolumeControls, doubleClickToFullscreen, spaceKeyToPlayOrPause, errorFallback, playbackRate, renderLoading, renderPoster, className, moveToBeginningWhenEnded, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, inFrame, outFrame, initiallyShowControls, renderFullscreen: renderFullscreenButton, renderPlayPauseButton, renderMuteButton, renderVolumeSlider, alwaysShowControls, showPlaybackRateControl, posterFillMode, bufferStateDelayInMilliseconds, hideControlsWhenPointerDoesntMove, overflowVisible, browserMediaControlsBehavior, overrideInternalClassName, }, ref) => {
|
|
44
|
+
const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps, clickToPlay, showVolumeControls, doubleClickToFullscreen, spaceKeyToPlayOrPause, errorFallback, playbackRate, renderLoading, renderPoster, className, moveToBeginningWhenEnded, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, inFrame, outFrame, initiallyShowControls, renderFullscreen: renderFullscreenButton, renderPlayPauseButton, renderMuteButton, renderVolumeSlider, alwaysShowControls, showPlaybackRateControl, posterFillMode, bufferStateDelayInMilliseconds, hideControlsWhenPointerDoesntMove, overflowVisible, browserMediaControlsBehavior, overrideInternalClassName, noSuspense, }, ref) => {
|
|
45
45
|
var _a, _b, _c;
|
|
46
46
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
47
47
|
const video = remotion_1.Internals.useVideo();
|
|
@@ -425,7 +425,7 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
|
|
|
425
425
|
}, onPointerDown: clickToPlay ? handlePointerDown : undefined, onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined, children: poster })) : null] }), (0, jsx_runtime_1.jsx)(license_blacklist_js_1.RenderWarningIfBlacklist, {})] }), 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: player.playing, toggle: player.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
|
|
426
426
|
? handlePointerDown
|
|
427
427
|
: undefined, renderMuteButton: renderMuteButton, renderVolumeSlider: renderVolumeSlider })) : null] }));
|
|
428
|
-
if (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense) {
|
|
428
|
+
if (noSuspense || (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense)) {
|
|
429
429
|
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
430
430
|
}
|
|
431
431
|
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 }) }));
|
package/dist/cjs/Thumbnail.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type ThumbnailProps<Schema extends AnyZodObject, Props extends Record<str
|
|
|
17
17
|
readonly className?: string;
|
|
18
18
|
readonly overrideInternalClassName?: string;
|
|
19
19
|
readonly logLevel?: LogLevel;
|
|
20
|
+
readonly noSuspense?: boolean;
|
|
20
21
|
};
|
|
21
22
|
export type ThumbnailPropsWithoutZod<Props extends Record<string, unknown>> = ThumbnailProps<AnyZodObject, Props>;
|
|
22
23
|
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
|
@@ -11,7 +11,7 @@ const emitter_context_js_1 = require("./emitter-context.js");
|
|
|
11
11
|
const event_emitter_js_1 = require("./event-emitter.js");
|
|
12
12
|
const SharedPlayerContext_js_1 = require("./SharedPlayerContext.js");
|
|
13
13
|
const ThumbnailUI_js_1 = __importDefault(require("./ThumbnailUI.js"));
|
|
14
|
-
const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback = () => '⚠️', renderLoading, overflowVisible = false, overrideInternalClassName, logLevel = 'info', ...componentProps }, ref) => {
|
|
14
|
+
const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback = () => '⚠️', renderLoading, overflowVisible = false, overrideInternalClassName, logLevel = 'info', noSuspense, ...componentProps }, ref) => {
|
|
15
15
|
if (typeof window !== 'undefined') {
|
|
16
16
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
17
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -42,12 +42,13 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
42
42
|
const Component = remotion_1.Internals.useLazyComponent({
|
|
43
43
|
compProps: componentProps,
|
|
44
44
|
componentName: 'Thumbnail',
|
|
45
|
+
noSuspense: Boolean(noSuspense),
|
|
45
46
|
});
|
|
46
47
|
const [emitter] = (0, react_1.useState)(() => new event_emitter_js_1.ThumbnailEmitter());
|
|
47
48
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
48
49
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
49
50
|
}, [inputProps]);
|
|
50
|
-
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, numberOfSharedAudioTags: 0, initiallyMuted: true, logLevel: logLevel, 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 }) }) }) }));
|
|
51
|
+
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, numberOfSharedAudioTags: 0, initiallyMuted: true, logLevel: logLevel, 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) }) }) }) }));
|
|
51
52
|
};
|
|
52
53
|
const forward = react_1.forwardRef;
|
|
53
54
|
/*
|
|
@@ -9,5 +9,6 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
9
9
|
readonly className: string | undefined;
|
|
10
10
|
readonly overflowVisible: boolean;
|
|
11
11
|
readonly overrideInternalClassName: string | undefined;
|
|
12
|
+
readonly noSuspense: boolean;
|
|
12
13
|
} & React.RefAttributes<ThumbnailMethods>>;
|
|
13
14
|
export default _default;
|
package/dist/cjs/ThumbnailUI.js
CHANGED
|
@@ -38,7 +38,7 @@ if (reactVersion === '0') {
|
|
|
38
38
|
throw new Error(`Version ${reactVersion} of "react" is not supported by Remotion`);
|
|
39
39
|
}
|
|
40
40
|
const doesReactVersionSupportSuspense = parseInt(reactVersion, 10) >= 18;
|
|
41
|
-
const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, className, overflowVisible, overrideInternalClassName, }, ref) => {
|
|
41
|
+
const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, className, overflowVisible, noSuspense, overrideInternalClassName, }, ref) => {
|
|
42
42
|
var _a, _b;
|
|
43
43
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
44
44
|
const video = remotion_1.Internals.useVideo();
|
|
@@ -113,7 +113,7 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
|
|
|
113
113
|
return null;
|
|
114
114
|
}
|
|
115
115
|
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 }) }));
|
|
116
|
-
if (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense) {
|
|
116
|
+
if (noSuspense || (is_node_js_1.IS_NODE && !doesReactVersionSupportSuspense)) {
|
|
117
117
|
return ((0, jsx_runtime_1.jsx)("div", { ref: container, style: outerStyle, className: className, children: content }));
|
|
118
118
|
}
|
|
119
119
|
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 }) }));
|
|
@@ -49,15 +49,27 @@ const useElementSize = (ref, options) => {
|
|
|
49
49
|
const height = options.shouldApplyCssTransforms
|
|
50
50
|
? newSize[0].height
|
|
51
51
|
: newSize[0].height * (1 / probableCssParentScale);
|
|
52
|
-
setSize({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
height
|
|
59
|
-
width
|
|
60
|
-
|
|
52
|
+
setSize((prevState) => {
|
|
53
|
+
const isSame = prevState &&
|
|
54
|
+
prevState.width === width &&
|
|
55
|
+
prevState.height === height &&
|
|
56
|
+
prevState.left === newSize[0].x &&
|
|
57
|
+
prevState.top === newSize[0].y &&
|
|
58
|
+
prevState.windowSize.height === window.innerHeight &&
|
|
59
|
+
prevState.windowSize.width === window.innerWidth;
|
|
60
|
+
if (isSame) {
|
|
61
|
+
return prevState;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
width,
|
|
65
|
+
height,
|
|
66
|
+
left: newSize[0].x,
|
|
67
|
+
top: newSize[0].y,
|
|
68
|
+
windowSize: {
|
|
69
|
+
height: window.innerHeight,
|
|
70
|
+
width: window.innerWidth,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
61
73
|
});
|
|
62
74
|
});
|
|
63
75
|
}, [options.shouldApplyCssTransforms]);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1058,15 +1058,21 @@ var useElementSize = (ref, options) => {
|
|
|
1058
1058
|
const probableCssParentScale = contentRect.width === 0 ? 1 : newSize[0].width / contentRect.width;
|
|
1059
1059
|
const width = options.shouldApplyCssTransforms ? newSize[0].width : newSize[0].width * (1 / probableCssParentScale);
|
|
1060
1060
|
const height = options.shouldApplyCssTransforms ? newSize[0].height : newSize[0].height * (1 / probableCssParentScale);
|
|
1061
|
-
setSize({
|
|
1062
|
-
width
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
top: newSize[0].y,
|
|
1066
|
-
windowSize: {
|
|
1067
|
-
height: window.innerHeight,
|
|
1068
|
-
width: window.innerWidth
|
|
1061
|
+
setSize((prevState) => {
|
|
1062
|
+
const isSame = prevState && prevState.width === width && prevState.height === height && prevState.left === newSize[0].x && prevState.top === newSize[0].y && prevState.windowSize.height === window.innerHeight && prevState.windowSize.width === window.innerWidth;
|
|
1063
|
+
if (isSame) {
|
|
1064
|
+
return prevState;
|
|
1069
1065
|
}
|
|
1066
|
+
return {
|
|
1067
|
+
width,
|
|
1068
|
+
height,
|
|
1069
|
+
left: newSize[0].x,
|
|
1070
|
+
top: newSize[0].y,
|
|
1071
|
+
windowSize: {
|
|
1072
|
+
height: window.innerHeight,
|
|
1073
|
+
width: window.innerWidth
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1070
1076
|
});
|
|
1071
1077
|
});
|
|
1072
1078
|
}, [options.shouldApplyCssTransforms]);
|
|
@@ -2385,7 +2391,8 @@ var PlayerUI = ({
|
|
|
2385
2391
|
hideControlsWhenPointerDoesntMove,
|
|
2386
2392
|
overflowVisible,
|
|
2387
2393
|
browserMediaControlsBehavior,
|
|
2388
|
-
overrideInternalClassName
|
|
2394
|
+
overrideInternalClassName,
|
|
2395
|
+
noSuspense
|
|
2389
2396
|
}, ref) => {
|
|
2390
2397
|
const config = Internals11.useUnsafeVideoConfig();
|
|
2391
2398
|
const video = Internals11.useVideo();
|
|
@@ -2804,7 +2811,7 @@ var PlayerUI = ({
|
|
|
2804
2811
|
}) : null
|
|
2805
2812
|
]
|
|
2806
2813
|
});
|
|
2807
|
-
if (IS_NODE && !doesReactVersionSupportSuspense) {
|
|
2814
|
+
if (noSuspense || IS_NODE && !doesReactVersionSupportSuspense) {
|
|
2808
2815
|
return /* @__PURE__ */ jsx12("div", {
|
|
2809
2816
|
ref: container,
|
|
2810
2817
|
style: outerStyle,
|
|
@@ -3132,6 +3139,7 @@ var PlayerFn = ({
|
|
|
3132
3139
|
browserMediaControlsBehavior: passedBrowserMediaControlsBehavior,
|
|
3133
3140
|
overrideInternalClassName,
|
|
3134
3141
|
logLevel = "info",
|
|
3142
|
+
noSuspense,
|
|
3135
3143
|
acknowledgeRemotionLicense,
|
|
3136
3144
|
...componentProps
|
|
3137
3145
|
}, ref) => {
|
|
@@ -3153,7 +3161,8 @@ var PlayerFn = ({
|
|
|
3153
3161
|
useState13(() => acknowledgeRemotionLicenseMessage(Boolean(acknowledgeRemotionLicense), logLevel));
|
|
3154
3162
|
const component = Internals15.useLazyComponent({
|
|
3155
3163
|
compProps: componentProps,
|
|
3156
|
-
componentName: "Player"
|
|
3164
|
+
componentName: "Player",
|
|
3165
|
+
noSuspense: Boolean(noSuspense)
|
|
3157
3166
|
});
|
|
3158
3167
|
validateInitialFrame({ initialFrame, durationInFrames });
|
|
3159
3168
|
const [frame, setFrame] = useState13(() => ({
|
|
@@ -3305,7 +3314,8 @@ var PlayerFn = ({
|
|
|
3305
3314
|
hideControlsWhenPointerDoesntMove,
|
|
3306
3315
|
overflowVisible,
|
|
3307
3316
|
browserMediaControlsBehavior,
|
|
3308
|
-
overrideInternalClassName: overrideInternalClassName ?? undefined
|
|
3317
|
+
overrideInternalClassName: overrideInternalClassName ?? undefined,
|
|
3318
|
+
noSuspense: Boolean(noSuspense)
|
|
3309
3319
|
})
|
|
3310
3320
|
})
|
|
3311
3321
|
})
|
|
@@ -3365,6 +3375,7 @@ var ThumbnailUI = ({
|
|
|
3365
3375
|
renderLoading,
|
|
3366
3376
|
className: className2,
|
|
3367
3377
|
overflowVisible,
|
|
3378
|
+
noSuspense,
|
|
3368
3379
|
overrideInternalClassName
|
|
3369
3380
|
}, ref) => {
|
|
3370
3381
|
const config = Internals16.useUnsafeVideoConfig();
|
|
@@ -3454,7 +3465,7 @@ var ThumbnailUI = ({
|
|
|
3454
3465
|
}) : null
|
|
3455
3466
|
})
|
|
3456
3467
|
});
|
|
3457
|
-
if (IS_NODE && !doesReactVersionSupportSuspense2) {
|
|
3468
|
+
if (noSuspense || IS_NODE && !doesReactVersionSupportSuspense2) {
|
|
3458
3469
|
return /* @__PURE__ */ jsx15("div", {
|
|
3459
3470
|
ref: container,
|
|
3460
3471
|
style: outerStyle,
|
|
@@ -3490,6 +3501,7 @@ var ThumbnailFn = ({
|
|
|
3490
3501
|
overflowVisible = false,
|
|
3491
3502
|
overrideInternalClassName,
|
|
3492
3503
|
logLevel = "info",
|
|
3504
|
+
noSuspense,
|
|
3493
3505
|
...componentProps
|
|
3494
3506
|
}, ref) => {
|
|
3495
3507
|
if (typeof window !== "undefined") {
|
|
@@ -3520,7 +3532,8 @@ var ThumbnailFn = ({
|
|
|
3520
3532
|
useImperativeHandle4(ref, () => rootRef.current, []);
|
|
3521
3533
|
const Component = Internals17.useLazyComponent({
|
|
3522
3534
|
compProps: componentProps,
|
|
3523
|
-
componentName: "Thumbnail"
|
|
3535
|
+
componentName: "Thumbnail",
|
|
3536
|
+
noSuspense: Boolean(noSuspense)
|
|
3524
3537
|
});
|
|
3525
3538
|
const [emitter] = useState14(() => new ThumbnailEmitter);
|
|
3526
3539
|
const passedInputProps = useMemo17(() => {
|
|
@@ -3547,7 +3560,8 @@ var ThumbnailFn = ({
|
|
|
3547
3560
|
renderLoading,
|
|
3548
3561
|
style: style2,
|
|
3549
3562
|
overflowVisible,
|
|
3550
|
-
overrideInternalClassName
|
|
3563
|
+
overrideInternalClassName,
|
|
3564
|
+
noSuspense: Boolean(noSuspense)
|
|
3551
3565
|
})
|
|
3552
3566
|
})
|
|
3553
3567
|
})
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/player"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/player",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.272",
|
|
7
7
|
"description": "React component for embedding a Remotion preview into your app",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"remotion": "4.0.
|
|
31
|
+
"remotion": "4.0.272"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=16.8.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"webpack": "5.96.1",
|
|
44
44
|
"zod": "3.22.3",
|
|
45
45
|
"eslint": "9.19.0",
|
|
46
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
46
|
+
"@remotion/eslint-config-internal": "4.0.272"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"remotion",
|