@remotion/player 4.0.248 → 4.0.250
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 +2 -1
- package/dist/cjs/Player.js +5 -2
- package/dist/cjs/SharedPlayerContext.d.ts +2 -1
- package/dist/cjs/SharedPlayerContext.js +4 -4
- package/dist/cjs/Thumbnail.d.ts +2 -1
- package/dist/cjs/Thumbnail.js +2 -2
- package/dist/cjs/error-boundary.d.ts +1 -1
- package/dist/cjs/volume-persistance.d.ts +2 -1
- package/dist/cjs/volume-persistance.js +3 -3
- package/dist/esm/index.mjs +47 -35
- package/package.json +3 -3
package/dist/cjs/Player.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { CompProps } from 'remotion';
|
|
3
|
+
import type { CompProps, LogLevel } from 'remotion';
|
|
4
4
|
import type { AnyZodObject } from 'zod';
|
|
5
5
|
import type { RenderMuteButton } from './MediaVolumeSlider.js';
|
|
6
6
|
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
@@ -55,6 +55,7 @@ export type PlayerProps<Schema extends AnyZodObject, Props extends Record<string
|
|
|
55
55
|
readonly overflowVisible?: boolean;
|
|
56
56
|
readonly browserMediaControlsBehavior?: BrowserMediaControlsBehavior;
|
|
57
57
|
readonly overrideInternalClassName?: string;
|
|
58
|
+
readonly logLevel?: LogLevel;
|
|
58
59
|
} & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
59
60
|
export type PlayerPropsWithoutZod<Props extends Record<string, unknown>> = PlayerProps<AnyZodObject, Props>;
|
|
60
61
|
export declare const componentOrNullIfLazy: <Props>(props: CompProps<Props>) => ComponentType<Props> | null;
|
package/dist/cjs/Player.js
CHANGED
|
@@ -22,7 +22,7 @@ const componentOrNullIfLazy = (props) => {
|
|
|
22
22
|
return null;
|
|
23
23
|
};
|
|
24
24
|
exports.componentOrNullIfLazy = componentOrNullIfLazy;
|
|
25
|
-
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, ...componentProps }, ref) => {
|
|
25
|
+
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', ...componentProps }, ref) => {
|
|
26
26
|
if (typeof window !== 'undefined') {
|
|
27
27
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
28
28
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -111,6 +111,9 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
111
111
|
setCurrentPlaybackRate(playbackRate);
|
|
112
112
|
}, [playbackRate]);
|
|
113
113
|
(0, react_1.useImperativeHandle)(ref, () => rootRef.current, []);
|
|
114
|
+
(0, react_1.useState)(() => {
|
|
115
|
+
remotion_1.Internals.Log.trace(logLevel, `[player] Mounting <Player>. User agent = ${typeof navigator === 'undefined' ? 'server' : navigator.userAgent}`);
|
|
116
|
+
});
|
|
114
117
|
const timelineContextValue = (0, react_1.useMemo)(() => {
|
|
115
118
|
return {
|
|
116
119
|
frame,
|
|
@@ -143,7 +146,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
143
146
|
mode: 'prevent-media-session',
|
|
144
147
|
});
|
|
145
148
|
}, [passedBrowserMediaControlsBehavior]);
|
|
146
|
-
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, 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'
|
|
149
|
+
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'
|
|
147
150
|
? clickToPlay
|
|
148
151
|
: 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 }) }) }) }) }));
|
|
149
152
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { TimelineContextValue } from 'remotion';
|
|
3
|
+
import type { LogLevel, TimelineContextValue } from 'remotion';
|
|
4
4
|
export declare const PLAYER_COMP_ID = "player-comp";
|
|
5
5
|
export declare const SharedPlayerContexts: React.FC<{
|
|
6
6
|
readonly children: React.ReactNode;
|
|
@@ -12,4 +12,5 @@ export declare const SharedPlayerContexts: React.FC<{
|
|
|
12
12
|
readonly component: LazyExoticComponent<ComponentType<unknown>>;
|
|
13
13
|
readonly numberOfSharedAudioTags: number;
|
|
14
14
|
readonly initiallyMuted: boolean;
|
|
15
|
+
readonly logLevel: LogLevel;
|
|
15
16
|
}>;
|
|
@@ -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, }) => {
|
|
9
|
+
const SharedPlayerContexts = ({ children, timelineContext, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, }) => {
|
|
10
10
|
const compositionManagerContext = (0, react_1.useMemo)(() => {
|
|
11
11
|
const context = {
|
|
12
12
|
compositions: [
|
|
@@ -47,14 +47,14 @@ const SharedPlayerContexts = ({ children, timelineContext, fps, compositionHeigh
|
|
|
47
47
|
}, [mediaMuted, mediaVolume]);
|
|
48
48
|
const setMediaVolumeAndPersist = (0, react_1.useCallback)((vol) => {
|
|
49
49
|
setMediaVolume(vol);
|
|
50
|
-
(0, volume_persistance_js_1.persistVolume)(vol);
|
|
51
|
-
}, []);
|
|
50
|
+
(0, volume_persistance_js_1.persistVolume)(vol, logLevel);
|
|
51
|
+
}, [logLevel]);
|
|
52
52
|
const setMediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
53
53
|
return {
|
|
54
54
|
setMediaMuted,
|
|
55
55
|
setMediaVolume: setMediaVolumeAndPersist,
|
|
56
56
|
};
|
|
57
57
|
}, [setMediaVolumeAndPersist]);
|
|
58
|
-
return ((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 }) }) }) }) }) }) }) }) }) }));
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.LogLevelContext.Provider, { value: logLevel, 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 }) }) }) }) }) }) }) }) }) }) }));
|
|
59
59
|
};
|
|
60
60
|
exports.SharedPlayerContexts = SharedPlayerContexts;
|
package/dist/cjs/Thumbnail.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
import type { CompProps } from 'remotion';
|
|
2
|
+
import type { CompProps, LogLevel } from 'remotion';
|
|
3
3
|
import type { AnyZodObject } from 'zod';
|
|
4
4
|
import type { ThumbnailMethods } from './player-methods.js';
|
|
5
5
|
import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
|
|
@@ -16,6 +16,7 @@ export type ThumbnailProps<Schema extends AnyZodObject, Props extends Record<str
|
|
|
16
16
|
readonly renderLoading?: RenderLoading;
|
|
17
17
|
readonly className?: string;
|
|
18
18
|
readonly overrideInternalClassName?: string;
|
|
19
|
+
readonly logLevel?: LogLevel;
|
|
19
20
|
};
|
|
20
21
|
export type ThumbnailPropsWithoutZod<Props extends Record<string, unknown>> = ThumbnailProps<AnyZodObject, Props>;
|
|
21
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
|
@@ -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, ...componentProps }, ref) => {
|
|
14
|
+
const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback = () => '⚠️', renderLoading, overflowVisible = false, overrideInternalClassName, logLevel = 'info', ...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)(() => {
|
|
@@ -44,7 +44,7 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
44
44
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
45
45
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
46
46
|
}, [inputProps]);
|
|
47
|
-
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, 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 }) }) }) }));
|
|
47
|
+
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 }) }) }) }));
|
|
48
48
|
};
|
|
49
49
|
const forward = react_1.forwardRef;
|
|
50
50
|
/*
|
|
@@ -15,5 +15,5 @@ export declare class ErrorBoundary extends React.Component<{
|
|
|
15
15
|
hasError: Error;
|
|
16
16
|
};
|
|
17
17
|
componentDidCatch(error: Error): void;
|
|
18
|
-
render(): string | number | bigint | boolean |
|
|
18
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
19
19
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPreferredVolume = exports.persistVolume = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
4
5
|
const VOLUME_PERSISTANCE_KEY = 'remotion.volumePreference';
|
|
5
|
-
const persistVolume = (volume) => {
|
|
6
|
+
const persistVolume = (volume, logLevel) => {
|
|
6
7
|
if (typeof window === 'undefined') {
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
@@ -12,8 +13,7 @@ const persistVolume = (volume) => {
|
|
|
12
13
|
catch (e) {
|
|
13
14
|
// User can disallow localStorage access
|
|
14
15
|
// https://github.com/remotion-dev/remotion/issues/3540
|
|
15
|
-
|
|
16
|
-
console.log('Could not persist volume', e);
|
|
16
|
+
remotion_1.Internals.Log.error(logLevel, 'Could not persist volume', e);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
exports.persistVolume = persistVolume;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1143,7 +1143,7 @@ import {
|
|
|
1143
1143
|
useRef as useRef11,
|
|
1144
1144
|
useState as useState13
|
|
1145
1145
|
} from "react";
|
|
1146
|
-
import { Composition, Internals as
|
|
1146
|
+
import { Composition, Internals as Internals14 } from "remotion";
|
|
1147
1147
|
|
|
1148
1148
|
// src/PlayerUI.tsx
|
|
1149
1149
|
import React10, {
|
|
@@ -2824,18 +2824,19 @@ var PlayerUI_default = forwardRef(PlayerUI);
|
|
|
2824
2824
|
|
|
2825
2825
|
// src/SharedPlayerContext.tsx
|
|
2826
2826
|
import { useCallback as useCallback12, useMemo as useMemo13, useState as useState12 } from "react";
|
|
2827
|
-
import { Internals as
|
|
2827
|
+
import { Internals as Internals13 } from "remotion";
|
|
2828
2828
|
|
|
2829
2829
|
// src/volume-persistance.ts
|
|
2830
|
+
import { Internals as Internals12 } from "remotion";
|
|
2830
2831
|
var VOLUME_PERSISTANCE_KEY = "remotion.volumePreference";
|
|
2831
|
-
var persistVolume = (volume) => {
|
|
2832
|
+
var persistVolume = (volume, logLevel) => {
|
|
2832
2833
|
if (typeof window === "undefined") {
|
|
2833
2834
|
return;
|
|
2834
2835
|
}
|
|
2835
2836
|
try {
|
|
2836
2837
|
window.localStorage.setItem(VOLUME_PERSISTANCE_KEY, String(volume));
|
|
2837
2838
|
} catch (e) {
|
|
2838
|
-
|
|
2839
|
+
Internals12.Log.error(logLevel, "Could not persist volume", e);
|
|
2839
2840
|
}
|
|
2840
2841
|
};
|
|
2841
2842
|
var getPreferredVolume = () => {
|
|
@@ -2862,7 +2863,8 @@ var SharedPlayerContexts = ({
|
|
|
2862
2863
|
durationInFrames,
|
|
2863
2864
|
component,
|
|
2864
2865
|
numberOfSharedAudioTags,
|
|
2865
|
-
initiallyMuted
|
|
2866
|
+
initiallyMuted,
|
|
2867
|
+
logLevel
|
|
2866
2868
|
}) => {
|
|
2867
2869
|
const compositionManagerContext = useMemo13(() => {
|
|
2868
2870
|
const context = {
|
|
@@ -2918,31 +2920,34 @@ var SharedPlayerContexts = ({
|
|
|
2918
2920
|
}, [mediaMuted, mediaVolume]);
|
|
2919
2921
|
const setMediaVolumeAndPersist = useCallback12((vol) => {
|
|
2920
2922
|
setMediaVolume(vol);
|
|
2921
|
-
persistVolume(vol);
|
|
2922
|
-
}, []);
|
|
2923
|
+
persistVolume(vol, logLevel);
|
|
2924
|
+
}, [logLevel]);
|
|
2923
2925
|
const setMediaVolumeContextValue = useMemo13(() => {
|
|
2924
2926
|
return {
|
|
2925
2927
|
setMediaMuted,
|
|
2926
2928
|
setMediaVolume: setMediaVolumeAndPersist
|
|
2927
2929
|
};
|
|
2928
2930
|
}, [setMediaVolumeAndPersist]);
|
|
2929
|
-
return /* @__PURE__ */ jsx13(
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
children: /* @__PURE__ */ jsx13(
|
|
2933
|
-
value:
|
|
2934
|
-
children: /* @__PURE__ */ jsx13(
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
children: /* @__PURE__ */ jsx13(
|
|
2940
|
-
value:
|
|
2941
|
-
children: /* @__PURE__ */ jsx13(
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2931
|
+
return /* @__PURE__ */ jsx13(Internals13.LogLevelContext.Provider, {
|
|
2932
|
+
value: logLevel,
|
|
2933
|
+
children: /* @__PURE__ */ jsx13(Internals13.CanUseRemotionHooksProvider, {
|
|
2934
|
+
children: /* @__PURE__ */ jsx13(Internals13.Timeline.TimelineContext.Provider, {
|
|
2935
|
+
value: timelineContext,
|
|
2936
|
+
children: /* @__PURE__ */ jsx13(Internals13.CompositionManager.Provider, {
|
|
2937
|
+
value: compositionManagerContext,
|
|
2938
|
+
children: /* @__PURE__ */ jsx13(Internals13.ResolveCompositionConfig, {
|
|
2939
|
+
children: /* @__PURE__ */ jsx13(Internals13.PrefetchProvider, {
|
|
2940
|
+
children: /* @__PURE__ */ jsx13(Internals13.DurationsContextProvider, {
|
|
2941
|
+
children: /* @__PURE__ */ jsx13(Internals13.MediaVolumeContext.Provider, {
|
|
2942
|
+
value: mediaVolumeContextValue,
|
|
2943
|
+
children: /* @__PURE__ */ jsx13(Internals13.SetMediaVolumeContext.Provider, {
|
|
2944
|
+
value: setMediaVolumeContextValue,
|
|
2945
|
+
children: /* @__PURE__ */ jsx13(Internals13.SharedAudioContextProvider, {
|
|
2946
|
+
numberOfAudioTags: numberOfSharedAudioTags,
|
|
2947
|
+
component,
|
|
2948
|
+
children: /* @__PURE__ */ jsx13(Internals13.BufferingProvider, {
|
|
2949
|
+
children
|
|
2950
|
+
})
|
|
2946
2951
|
})
|
|
2947
2952
|
})
|
|
2948
2953
|
})
|
|
@@ -3103,6 +3108,7 @@ var PlayerFn = ({
|
|
|
3103
3108
|
renderMuteButton,
|
|
3104
3109
|
browserMediaControlsBehavior: passedBrowserMediaControlsBehavior,
|
|
3105
3110
|
overrideInternalClassName,
|
|
3111
|
+
logLevel = "info",
|
|
3106
3112
|
...componentProps
|
|
3107
3113
|
}, ref) => {
|
|
3108
3114
|
if (typeof window !== "undefined") {
|
|
@@ -3120,7 +3126,7 @@ var PlayerFn = ({
|
|
|
3120
3126
|
if (componentForValidation === Composition) {
|
|
3121
3127
|
throw new TypeError(`'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.`);
|
|
3122
3128
|
}
|
|
3123
|
-
const component =
|
|
3129
|
+
const component = Internals14.useLazyComponent(componentProps);
|
|
3124
3130
|
validateInitialFrame({ initialFrame, durationInFrames });
|
|
3125
3131
|
const [frame, setFrame] = useState13(() => ({
|
|
3126
3132
|
[PLAYER_COMP_ID]: initialFrame ?? 0
|
|
@@ -3182,6 +3188,9 @@ var PlayerFn = ({
|
|
|
3182
3188
|
setCurrentPlaybackRate(playbackRate);
|
|
3183
3189
|
}, [playbackRate]);
|
|
3184
3190
|
useImperativeHandle2(ref, () => rootRef.current, []);
|
|
3191
|
+
useState13(() => {
|
|
3192
|
+
Internals14.Log.trace(logLevel, `[player] Mounting <Player>. User agent = ${typeof navigator === "undefined" ? "server" : navigator.userAgent}`);
|
|
3193
|
+
});
|
|
3185
3194
|
const timelineContextValue = useMemo14(() => {
|
|
3186
3195
|
return {
|
|
3187
3196
|
frame,
|
|
@@ -3203,7 +3212,7 @@ var PlayerFn = ({
|
|
|
3203
3212
|
}, [setFrame]);
|
|
3204
3213
|
if (typeof window !== "undefined") {
|
|
3205
3214
|
useLayoutEffect(() => {
|
|
3206
|
-
|
|
3215
|
+
Internals14.CSSUtils.injectCSS(Internals14.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
|
|
3207
3216
|
}, [overrideInternalClassName]);
|
|
3208
3217
|
}
|
|
3209
3218
|
const actualInputProps = useMemo14(() => inputProps ?? {}, [inputProps]);
|
|
@@ -3212,7 +3221,7 @@ var PlayerFn = ({
|
|
|
3212
3221
|
mode: "prevent-media-session"
|
|
3213
3222
|
};
|
|
3214
3223
|
}, [passedBrowserMediaControlsBehavior]);
|
|
3215
|
-
return /* @__PURE__ */ jsx14(
|
|
3224
|
+
return /* @__PURE__ */ jsx14(Internals14.IsPlayerContextProvider, {
|
|
3216
3225
|
children: /* @__PURE__ */ jsx14(SharedPlayerContexts, {
|
|
3217
3226
|
timelineContext: timelineContextValue,
|
|
3218
3227
|
component,
|
|
@@ -3222,7 +3231,8 @@ var PlayerFn = ({
|
|
|
3222
3231
|
fps,
|
|
3223
3232
|
numberOfSharedAudioTags,
|
|
3224
3233
|
initiallyMuted,
|
|
3225
|
-
|
|
3234
|
+
logLevel,
|
|
3235
|
+
children: /* @__PURE__ */ jsx14(Internals14.Timeline.SetTimelineContext.Provider, {
|
|
3226
3236
|
value: setTimelineContextValue,
|
|
3227
3237
|
children: /* @__PURE__ */ jsx14(PlayerEmitterProvider, {
|
|
3228
3238
|
currentPlaybackRate,
|
|
@@ -3280,7 +3290,7 @@ import {
|
|
|
3280
3290
|
useRef as useRef13,
|
|
3281
3291
|
useState as useState14
|
|
3282
3292
|
} from "react";
|
|
3283
|
-
import { Internals as
|
|
3293
|
+
import { Internals as Internals16, random as random2 } from "remotion";
|
|
3284
3294
|
|
|
3285
3295
|
// src/ThumbnailUI.tsx
|
|
3286
3296
|
import React13, {
|
|
@@ -3291,7 +3301,7 @@ import React13, {
|
|
|
3291
3301
|
useMemo as useMemo16,
|
|
3292
3302
|
useRef as useRef12
|
|
3293
3303
|
} from "react";
|
|
3294
|
-
import { Internals as
|
|
3304
|
+
import { Internals as Internals15 } from "remotion";
|
|
3295
3305
|
|
|
3296
3306
|
// src/use-thumbnail.ts
|
|
3297
3307
|
import { useContext as useContext7, useMemo as useMemo15 } from "react";
|
|
@@ -3324,8 +3334,8 @@ var ThumbnailUI = ({
|
|
|
3324
3334
|
overflowVisible,
|
|
3325
3335
|
overrideInternalClassName
|
|
3326
3336
|
}, ref) => {
|
|
3327
|
-
const config =
|
|
3328
|
-
const video =
|
|
3337
|
+
const config = Internals15.useUnsafeVideoConfig();
|
|
3338
|
+
const video = Internals15.useVideo();
|
|
3329
3339
|
const container = useRef12(null);
|
|
3330
3340
|
const canvasSize = useElementSize(container, {
|
|
3331
3341
|
triggerOnWindowResize: false,
|
|
@@ -3401,7 +3411,7 @@ var ThumbnailUI = ({
|
|
|
3401
3411
|
children: VideoComponent ? /* @__PURE__ */ jsx15(ErrorBoundary, {
|
|
3402
3412
|
onError,
|
|
3403
3413
|
errorFallback,
|
|
3404
|
-
children: /* @__PURE__ */ jsx15(
|
|
3414
|
+
children: /* @__PURE__ */ jsx15(Internals15.CurrentScaleContext.Provider, {
|
|
3405
3415
|
value: currentScaleContext,
|
|
3406
3416
|
children: /* @__PURE__ */ jsx15(VideoComponent, {
|
|
3407
3417
|
...video?.props ?? {},
|
|
@@ -3446,6 +3456,7 @@ var ThumbnailFn = ({
|
|
|
3446
3456
|
renderLoading,
|
|
3447
3457
|
overflowVisible = false,
|
|
3448
3458
|
overrideInternalClassName,
|
|
3459
|
+
logLevel = "info",
|
|
3449
3460
|
...componentProps
|
|
3450
3461
|
}, ref) => {
|
|
3451
3462
|
if (typeof window !== "undefined") {
|
|
@@ -3474,12 +3485,12 @@ var ThumbnailFn = ({
|
|
|
3474
3485
|
return value;
|
|
3475
3486
|
}, [frameToDisplay, thumbnailId]);
|
|
3476
3487
|
useImperativeHandle4(ref, () => rootRef.current, []);
|
|
3477
|
-
const Component =
|
|
3488
|
+
const Component = Internals16.useLazyComponent(componentProps);
|
|
3478
3489
|
const [emitter] = useState14(() => new ThumbnailEmitter);
|
|
3479
3490
|
const passedInputProps = useMemo17(() => {
|
|
3480
3491
|
return inputProps ?? {};
|
|
3481
3492
|
}, [inputProps]);
|
|
3482
|
-
return /* @__PURE__ */ jsx16(
|
|
3493
|
+
return /* @__PURE__ */ jsx16(Internals16.IsPlayerContextProvider, {
|
|
3483
3494
|
children: /* @__PURE__ */ jsx16(SharedPlayerContexts, {
|
|
3484
3495
|
timelineContext: timelineState,
|
|
3485
3496
|
component: Component,
|
|
@@ -3489,6 +3500,7 @@ var ThumbnailFn = ({
|
|
|
3489
3500
|
fps,
|
|
3490
3501
|
numberOfSharedAudioTags: 0,
|
|
3491
3502
|
initiallyMuted: true,
|
|
3503
|
+
logLevel,
|
|
3492
3504
|
children: /* @__PURE__ */ jsx16(ThumbnailEmitterContext.Provider, {
|
|
3493
3505
|
value: emitter,
|
|
3494
3506
|
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.250",
|
|
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.250"
|
|
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.14.0",
|
|
46
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
46
|
+
"@remotion/eslint-config-internal": "4.0.250"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"remotion",
|