@remotion/player 4.0.301 → 4.0.303
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
CHANGED
|
@@ -59,6 +59,7 @@ export type PlayerProps<Schema extends AnyZodObject, Props extends Record<string
|
|
|
59
59
|
readonly logLevel?: LogLevel;
|
|
60
60
|
readonly noSuspense?: boolean;
|
|
61
61
|
readonly acknowledgeRemotionLicense?: boolean;
|
|
62
|
+
readonly audioLatencyHint?: AudioContextLatencyCategory;
|
|
62
63
|
} & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
63
64
|
export type PlayerPropsWithoutZod<Props extends Record<string, unknown>> = PlayerProps<AnyZodObject, Props>;
|
|
64
65
|
export declare const componentOrNullIfLazy: <Props>(props: CompProps<Props>) => ComponentType<Props> | null;
|
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, showPosterWhenBufferingAndPaused, 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) => {
|
|
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, showPosterWhenBufferingAndPaused, 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, audioLatencyHint = 'interactive', ...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)(() => {
|
|
@@ -157,7 +157,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
157
157
|
mode: 'prevent-media-session',
|
|
158
158
|
});
|
|
159
159
|
}, [passedBrowserMediaControlsBehavior]);
|
|
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
|
+
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, audioLatencyHint: audioLatencyHint, 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'
|
|
161
161
|
? clickToPlay
|
|
162
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), 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, 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) }) }) }) }) }));
|
|
163
163
|
};
|
|
@@ -6,7 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const volume_persistance_js_1 = require("./volume-persistance.js");
|
|
8
8
|
exports.PLAYER_COMP_ID = 'player-comp';
|
|
9
|
-
const SharedPlayerContexts = ({ children, timelineContext, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, }) => {
|
|
9
|
+
const SharedPlayerContexts = ({ children, timelineContext, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, audioLatencyHint, }) => {
|
|
10
10
|
const compositionManagerContext = (0, react_1.useMemo)(() => {
|
|
11
11
|
const context = {
|
|
12
12
|
compositions: [
|
|
@@ -54,6 +54,6 @@ const SharedPlayerContexts = ({ children, timelineContext, fps, compositionHeigh
|
|
|
54
54
|
mountTime: Date.now(),
|
|
55
55
|
};
|
|
56
56
|
}, [logLevel]);
|
|
57
|
-
return ((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.Timeline.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.ResolveCompositionConfig, { 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.SharedAudioContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, component: component, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.BufferingProvider, { children: children }) }) }) }) }) }) }) }) }) }) }));
|
|
57
|
+
return ((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.Timeline.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.ResolveCompositionConfig, { 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.SharedAudioContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, component: component, audioLatencyHint: audioLatencyHint, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.BufferingProvider, { children: children }) }) }) }) }) }) }) }) }) }) }));
|
|
58
58
|
};
|
|
59
59
|
exports.SharedPlayerContexts = SharedPlayerContexts;
|
package/dist/cjs/Thumbnail.js
CHANGED
|
@@ -48,7 +48,7 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
48
48
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
49
49
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
50
50
|
}, [inputProps]);
|
|
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
|
+
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, audioLatencyHint: "playback", 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) }) }) }) }));
|
|
52
52
|
};
|
|
53
53
|
const forward = react_1.forwardRef;
|
|
54
54
|
/*
|
package/dist/cjs/use-player.js
CHANGED
|
@@ -39,6 +39,7 @@ const usePlayer = () => {
|
|
|
39
39
|
emitter.dispatchSeek(newFrame);
|
|
40
40
|
}, [emitter, setTimelinePosition, video === null || video === void 0 ? void 0 : video.id]);
|
|
41
41
|
const play = (0, react_1.useCallback)((e) => {
|
|
42
|
+
var _a;
|
|
42
43
|
if (imperativePlaying.current) {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
@@ -46,6 +47,7 @@ const usePlayer = () => {
|
|
|
46
47
|
if (isLastFrame) {
|
|
47
48
|
seek(0);
|
|
48
49
|
}
|
|
50
|
+
(_a = audioContext === null || audioContext === void 0 ? void 0 : audioContext.audioContext) === null || _a === void 0 ? void 0 : _a.resume();
|
|
49
51
|
/**
|
|
50
52
|
* Play silent audio tags to warm them up for autoplay
|
|
51
53
|
*/
|
|
@@ -71,12 +73,14 @@ const usePlayer = () => {
|
|
|
71
73
|
audioAndVideoTags,
|
|
72
74
|
]);
|
|
73
75
|
const pause = (0, react_1.useCallback)(() => {
|
|
76
|
+
var _a;
|
|
74
77
|
if (imperativePlaying.current) {
|
|
75
78
|
imperativePlaying.current = false;
|
|
76
79
|
setPlaying(false);
|
|
77
80
|
emitter.dispatchPause();
|
|
81
|
+
(_a = audioContext === null || audioContext === void 0 ? void 0 : audioContext.audioContext) === null || _a === void 0 ? void 0 : _a.suspend();
|
|
78
82
|
}
|
|
79
|
-
}, [emitter, imperativePlaying, setPlaying]);
|
|
83
|
+
}, [emitter, imperativePlaying, setPlaying, audioContext]);
|
|
80
84
|
const pauseAndReturnToPlayStart = (0, react_1.useCallback)(() => {
|
|
81
85
|
if (imperativePlaying.current) {
|
|
82
86
|
imperativePlaying.current = false;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -582,6 +582,7 @@ var usePlayer = () => {
|
|
|
582
582
|
if (isLastFrame) {
|
|
583
583
|
seek(0);
|
|
584
584
|
}
|
|
585
|
+
audioContext?.audioContext?.resume();
|
|
585
586
|
if (audioContext && audioContext.numberOfAudioTags > 0 && e) {
|
|
586
587
|
audioContext.playAllAudios();
|
|
587
588
|
}
|
|
@@ -604,8 +605,9 @@ var usePlayer = () => {
|
|
|
604
605
|
imperativePlaying.current = false;
|
|
605
606
|
setPlaying(false);
|
|
606
607
|
emitter.dispatchPause();
|
|
608
|
+
audioContext?.audioContext?.suspend();
|
|
607
609
|
}
|
|
608
|
-
}, [emitter, imperativePlaying, setPlaying]);
|
|
610
|
+
}, [emitter, imperativePlaying, setPlaying, audioContext]);
|
|
609
611
|
const pauseAndReturnToPlayStart = useCallback2(() => {
|
|
610
612
|
if (imperativePlaying.current) {
|
|
611
613
|
imperativePlaying.current = false;
|
|
@@ -2866,7 +2868,8 @@ var SharedPlayerContexts = ({
|
|
|
2866
2868
|
component,
|
|
2867
2869
|
numberOfSharedAudioTags,
|
|
2868
2870
|
initiallyMuted,
|
|
2869
|
-
logLevel
|
|
2871
|
+
logLevel,
|
|
2872
|
+
audioLatencyHint
|
|
2870
2873
|
}) => {
|
|
2871
2874
|
const compositionManagerContext = useMemo13(() => {
|
|
2872
2875
|
const context = {
|
|
@@ -2932,6 +2935,7 @@ var SharedPlayerContexts = ({
|
|
|
2932
2935
|
children: /* @__PURE__ */ jsx13(Internals13.SharedAudioContextProvider, {
|
|
2933
2936
|
numberOfAudioTags: numberOfSharedAudioTags,
|
|
2934
2937
|
component,
|
|
2938
|
+
audioLatencyHint,
|
|
2935
2939
|
children: /* @__PURE__ */ jsx13(Internals13.BufferingProvider, {
|
|
2936
2940
|
children
|
|
2937
2941
|
})
|
|
@@ -3114,6 +3118,7 @@ var PlayerFn = ({
|
|
|
3114
3118
|
logLevel = "info",
|
|
3115
3119
|
noSuspense,
|
|
3116
3120
|
acknowledgeRemotionLicense,
|
|
3121
|
+
audioLatencyHint = "interactive",
|
|
3117
3122
|
...componentProps
|
|
3118
3123
|
}, ref) => {
|
|
3119
3124
|
if (typeof window !== "undefined") {
|
|
@@ -3247,6 +3252,7 @@ var PlayerFn = ({
|
|
|
3247
3252
|
numberOfSharedAudioTags,
|
|
3248
3253
|
initiallyMuted,
|
|
3249
3254
|
logLevel,
|
|
3255
|
+
audioLatencyHint,
|
|
3250
3256
|
children: /* @__PURE__ */ jsx14(Internals15.Timeline.SetTimelineContext.Provider, {
|
|
3251
3257
|
value: setTimelineContextValue,
|
|
3252
3258
|
children: /* @__PURE__ */ jsx14(PlayerEmitterProvider, {
|
|
@@ -3524,6 +3530,7 @@ var ThumbnailFn = ({
|
|
|
3524
3530
|
numberOfSharedAudioTags: 0,
|
|
3525
3531
|
initiallyMuted: true,
|
|
3526
3532
|
logLevel,
|
|
3533
|
+
audioLatencyHint: "playback",
|
|
3527
3534
|
children: /* @__PURE__ */ jsx16(ThumbnailEmitterContext.Provider, {
|
|
3528
3535
|
value: emitter,
|
|
3529
3536
|
children: /* @__PURE__ */ jsx16(ThumbnailUI_default, {
|
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.303",
|
|
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.303"
|
|
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.303"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"remotion",
|