@remotion/player 4.0.457 → 4.0.458
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/PlaybackrateControl.js +2 -2
- package/dist/cjs/Player.js +8 -6
- package/dist/cjs/SharedPlayerContext.d.ts +2 -1
- package/dist/cjs/SharedPlayerContext.js +2 -2
- package/dist/cjs/Thumbnail.js +8 -4
- package/dist/cjs/use-playback.js +3 -11
- package/dist/esm/index.mjs +43 -39
- package/package.json +3 -3
- package/dist/cjs/volume-persistance.d.ts +0 -2
- package/dist/cjs/volume-persistance.js +0 -34
|
@@ -61,7 +61,7 @@ const PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate
|
|
|
61
61
|
jsx_runtime_1.jsx("div", { style: checkmarkContainer, children: rate === selectedRate ? jsx_runtime_1.jsx(exports.Checkmark, {}) : null }), formatPlaybackRate(rate), "x"] }, rate));
|
|
62
62
|
};
|
|
63
63
|
const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
64
|
-
const { setPlaybackRate, playbackRate } = remotion_1.Internals.
|
|
64
|
+
const { setPlaybackRate, playbackRate } = remotion_1.Internals.usePlaybackRate();
|
|
65
65
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = (0, react_1.useState)(playbackRate);
|
|
66
66
|
(0, react_1.useEffect)(() => {
|
|
67
67
|
const listener = (e) => {
|
|
@@ -159,7 +159,7 @@ const button = {
|
|
|
159
159
|
};
|
|
160
160
|
const PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
161
161
|
const { ref, isComponentVisible, setIsComponentVisible } = (0, use_component_visible_js_1.default)(false);
|
|
162
|
-
const { playbackRate } = remotion_1.Internals.
|
|
162
|
+
const { playbackRate } = remotion_1.Internals.usePlaybackRate();
|
|
163
163
|
const onClick = (0, react_1.useCallback)((e) => {
|
|
164
164
|
e.stopPropagation();
|
|
165
165
|
e.preventDefault();
|
package/dist/cjs/Player.js
CHANGED
|
@@ -138,14 +138,16 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
138
138
|
frame,
|
|
139
139
|
playing,
|
|
140
140
|
rootId,
|
|
141
|
-
playbackRate: currentPlaybackRate,
|
|
142
141
|
imperativePlaying,
|
|
143
|
-
setPlaybackRate: (rate) => {
|
|
144
|
-
setCurrentPlaybackRate(rate);
|
|
145
|
-
},
|
|
146
142
|
audioAndVideoTags,
|
|
147
143
|
};
|
|
148
|
-
}, [frame,
|
|
144
|
+
}, [frame, playing, rootId]);
|
|
145
|
+
const playbackRateContextValue = (0, react_1.useMemo)(() => {
|
|
146
|
+
return {
|
|
147
|
+
playbackRate: currentPlaybackRate,
|
|
148
|
+
setPlaybackRate: setCurrentPlaybackRate,
|
|
149
|
+
};
|
|
150
|
+
}, [currentPlaybackRate]);
|
|
149
151
|
const setTimelineContextValue = (0, react_1.useMemo)(() => {
|
|
150
152
|
return {
|
|
151
153
|
setFrame,
|
|
@@ -165,7 +167,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
165
167
|
mode: 'prevent-media-session',
|
|
166
168
|
});
|
|
167
169
|
}, [passedBrowserMediaControlsBehavior]);
|
|
168
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.IsPlayerContextProvider, { children: 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, volumePersistenceKey: volumePersistenceKey, initialVolume: initialVolume, inputProps: actualInputProps, audioEnabled: true, children: jsx_runtime_1.jsx(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContextValue, 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'
|
|
170
|
+
return (jsx_runtime_1.jsx(remotion_1.Internals.IsPlayerContextProvider, { 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, volumePersistenceKey: volumePersistenceKey, initialVolume: initialVolume, inputProps: actualInputProps, audioEnabled: true, children: jsx_runtime_1.jsx(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContextValue, 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'
|
|
169
171
|
? clickToPlay
|
|
170
172
|
: 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) }) }) }) }) }));
|
|
171
173
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { LogLevel, TimelineContextValue } from 'remotion';
|
|
3
|
+
import type { LogLevel, PlaybackRateContextValue, 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;
|
|
7
7
|
readonly timelineContext: TimelineContextValue;
|
|
8
|
+
readonly playbackRateContext: PlaybackRateContextValue;
|
|
8
9
|
readonly fps: number;
|
|
9
10
|
readonly compositionWidth: number;
|
|
10
11
|
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, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, audioLatencyHint, volumePersistenceKey, initialVolume, inputProps, audioEnabled, }) => {
|
|
9
|
+
const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, audioLatencyHint, volumePersistenceKey, initialVolume, inputProps, audioEnabled, }) => {
|
|
10
10
|
const persistVolumeToStorage = initialVolume === undefined;
|
|
11
11
|
const compositionManagerContext = (0, react_1.useMemo)(() => {
|
|
12
12
|
const context = {
|
|
@@ -88,6 +88,6 @@ const SharedPlayerContexts = ({ children, timelineContext, fps, compositionHeigh
|
|
|
88
88
|
isReadOnlyStudio: false,
|
|
89
89
|
};
|
|
90
90
|
}, []);
|
|
91
|
-
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.TimelineContext.Provider, { value: timelineContext, children: jsx_runtime_1.jsx(remotion_1.Internals.CompositionManager.Provider, { value: compositionManagerContext, 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: audioEnabled, children: jsx_runtime_1.jsx(remotion_1.Internals.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: children }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
91
|
+
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.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: audioEnabled, children: jsx_runtime_1.jsx(remotion_1.Internals.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
92
92
|
};
|
|
93
93
|
exports.SharedPlayerContexts = SharedPlayerContexts;
|
package/dist/cjs/Thumbnail.js
CHANGED
|
@@ -30,14 +30,18 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
30
30
|
imperativePlaying: {
|
|
31
31
|
current: false,
|
|
32
32
|
},
|
|
33
|
+
audioAndVideoTags: { current: [] },
|
|
34
|
+
};
|
|
35
|
+
return value;
|
|
36
|
+
}, [frameToDisplay, thumbnailId]);
|
|
37
|
+
const playbackRateContext = (0, react_1.useMemo)(() => {
|
|
38
|
+
return {
|
|
33
39
|
playbackRate: 1,
|
|
34
40
|
setPlaybackRate: () => {
|
|
35
41
|
throw new Error('thumbnail');
|
|
36
42
|
},
|
|
37
|
-
audioAndVideoTags: { current: [] },
|
|
38
43
|
};
|
|
39
|
-
|
|
40
|
-
}, [frameToDisplay, thumbnailId]);
|
|
44
|
+
}, []);
|
|
41
45
|
(0, react_1.useImperativeHandle)(ref, () => rootRef.current, []);
|
|
42
46
|
const Component = remotion_1.Internals.useLazyComponent({
|
|
43
47
|
compProps: componentProps,
|
|
@@ -48,7 +52,7 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
|
|
|
48
52
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
49
53
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
50
54
|
}, [inputProps]);
|
|
51
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.IsPlayerContextProvider, { children: 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", inputProps: passedInputProps, audioEnabled: 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) }) }) }) }));
|
|
55
|
+
return (jsx_runtime_1.jsx(remotion_1.Internals.IsPlayerContextProvider, { 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", inputProps: passedInputProps, audioEnabled: 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) }) }) }) }));
|
|
52
56
|
};
|
|
53
57
|
const forward = react_1.forwardRef;
|
|
54
58
|
/*
|
package/dist/cjs/use-playback.js
CHANGED
|
@@ -17,7 +17,6 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
17
17
|
const setFrame = remotion_1.Internals.Timeline.useTimelineSetFrame();
|
|
18
18
|
const sharedAudioContext = (0, react_2.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
19
19
|
const logLevel = remotion_1.Internals.useLogLevel();
|
|
20
|
-
const timelineContext = remotion_1.Internals.useTimelineContext();
|
|
21
20
|
// requestAnimationFrame() does not work if the tab is not active.
|
|
22
21
|
// This means that audio will keep playing even if it has ended.
|
|
23
22
|
// In that case, we use setTimeout() instead.
|
|
@@ -46,19 +45,13 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
46
45
|
audioContext: sharedAudioContext.audioContext,
|
|
47
46
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
48
47
|
absoluteTimeInSeconds: frame / config.fps,
|
|
49
|
-
globalPlaybackRate:
|
|
48
|
+
globalPlaybackRate: playbackRate,
|
|
50
49
|
logLevel,
|
|
51
50
|
});
|
|
52
51
|
if (changed) {
|
|
53
52
|
sharedAudioContext.audioSyncAnchorEmitter.dispatch('changed');
|
|
54
53
|
}
|
|
55
|
-
}, [
|
|
56
|
-
config,
|
|
57
|
-
frame,
|
|
58
|
-
logLevel,
|
|
59
|
-
sharedAudioContext,
|
|
60
|
-
timelineContext.playbackRate,
|
|
61
|
-
]);
|
|
54
|
+
}, [config, frame, logLevel, playbackRate, sharedAudioContext]);
|
|
62
55
|
(0, react_2.useEffect)(() => {
|
|
63
56
|
var _a;
|
|
64
57
|
if (!config) {
|
|
@@ -145,7 +138,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
145
138
|
audioContext: sharedAudioContext.audioContext,
|
|
146
139
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
147
140
|
absoluteTimeInSeconds: getCurrentFrame() / config.fps,
|
|
148
|
-
globalPlaybackRate:
|
|
141
|
+
globalPlaybackRate: playbackRate,
|
|
149
142
|
logLevel,
|
|
150
143
|
});
|
|
151
144
|
startedTime = performance.now();
|
|
@@ -205,7 +198,6 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
205
198
|
context,
|
|
206
199
|
isPlaying,
|
|
207
200
|
sharedAudioContext,
|
|
208
|
-
timelineContext.playbackRate,
|
|
209
201
|
logLevel,
|
|
210
202
|
muted,
|
|
211
203
|
]);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -944,7 +944,6 @@ var usePlayback = ({
|
|
|
944
944
|
const setFrame = Internals7.Timeline.useTimelineSetFrame();
|
|
945
945
|
const sharedAudioContext = useContext4(Internals7.SharedAudioContext);
|
|
946
946
|
const logLevel = Internals7.useLogLevel();
|
|
947
|
-
const timelineContext = Internals7.useTimelineContext();
|
|
948
947
|
const isBackgroundedRef = useIsBackgrounded();
|
|
949
948
|
const lastTimeUpdateTimestamp = useRef5(0);
|
|
950
949
|
const context = useContext4(Internals7.BufferingContextReact);
|
|
@@ -970,19 +969,13 @@ var usePlayback = ({
|
|
|
970
969
|
audioContext: sharedAudioContext.audioContext,
|
|
971
970
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
972
971
|
absoluteTimeInSeconds: frame / config.fps,
|
|
973
|
-
globalPlaybackRate:
|
|
972
|
+
globalPlaybackRate: playbackRate,
|
|
974
973
|
logLevel
|
|
975
974
|
});
|
|
976
975
|
if (changed) {
|
|
977
976
|
sharedAudioContext.audioSyncAnchorEmitter.dispatch("changed");
|
|
978
977
|
}
|
|
979
|
-
}, [
|
|
980
|
-
config,
|
|
981
|
-
frame,
|
|
982
|
-
logLevel,
|
|
983
|
-
sharedAudioContext,
|
|
984
|
-
timelineContext.playbackRate
|
|
985
|
-
]);
|
|
978
|
+
}, [config, frame, logLevel, playbackRate, sharedAudioContext]);
|
|
986
979
|
useEffect5(() => {
|
|
987
980
|
if (!config) {
|
|
988
981
|
return;
|
|
@@ -1059,7 +1052,7 @@ var usePlayback = ({
|
|
|
1059
1052
|
audioContext: sharedAudioContext.audioContext,
|
|
1060
1053
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
1061
1054
|
absoluteTimeInSeconds: getCurrentFrame() / config.fps,
|
|
1062
|
-
globalPlaybackRate:
|
|
1055
|
+
globalPlaybackRate: playbackRate,
|
|
1063
1056
|
logLevel
|
|
1064
1057
|
});
|
|
1065
1058
|
startedTime = performance.now();
|
|
@@ -1116,7 +1109,6 @@ var usePlayback = ({
|
|
|
1116
1109
|
context,
|
|
1117
1110
|
isPlaying,
|
|
1118
1111
|
sharedAudioContext,
|
|
1119
|
-
timelineContext.playbackRate,
|
|
1120
1112
|
logLevel,
|
|
1121
1113
|
muted
|
|
1122
1114
|
]);
|
|
@@ -1731,7 +1723,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
|
|
|
1731
1723
|
}, rate);
|
|
1732
1724
|
};
|
|
1733
1725
|
var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
1734
|
-
const { setPlaybackRate, playbackRate } = Internals9.
|
|
1726
|
+
const { setPlaybackRate, playbackRate } = Internals9.usePlaybackRate();
|
|
1735
1727
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = useState8(playbackRate);
|
|
1736
1728
|
useEffect9(() => {
|
|
1737
1729
|
const listener = (e) => {
|
|
@@ -1833,7 +1825,7 @@ var button = {
|
|
|
1833
1825
|
};
|
|
1834
1826
|
var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
1835
1827
|
const { ref, isComponentVisible, setIsComponentVisible } = useComponentVisible(false);
|
|
1836
|
-
const { playbackRate } = Internals9.
|
|
1828
|
+
const { playbackRate } = Internals9.usePlaybackRate();
|
|
1837
1829
|
const onClick = useCallback6((e) => {
|
|
1838
1830
|
e.stopPropagation();
|
|
1839
1831
|
e.preventDefault();
|
|
@@ -2997,6 +2989,7 @@ var PLAYER_COMP_ID = "player-comp";
|
|
|
2997
2989
|
var SharedPlayerContexts = ({
|
|
2998
2990
|
children,
|
|
2999
2991
|
timelineContext,
|
|
2992
|
+
playbackRateContext,
|
|
3000
2993
|
fps,
|
|
3001
2994
|
compositionHeight,
|
|
3002
2995
|
compositionWidth,
|
|
@@ -3097,23 +3090,26 @@ var SharedPlayerContexts = ({
|
|
|
3097
3090
|
children: /* @__PURE__ */ jsx13(Internals14.CanUseRemotionHooksProvider, {
|
|
3098
3091
|
children: /* @__PURE__ */ jsx13(Internals14.AbsoluteTimeContext.Provider, {
|
|
3099
3092
|
value: timelineContext,
|
|
3100
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3101
|
-
value:
|
|
3102
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3103
|
-
value:
|
|
3104
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3109
|
-
value:
|
|
3110
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
children
|
|
3093
|
+
children: /* @__PURE__ */ jsx13(Internals14.PlaybackRateContext.Provider, {
|
|
3094
|
+
value: playbackRateContext,
|
|
3095
|
+
children: /* @__PURE__ */ jsx13(Internals14.TimelineContext.Provider, {
|
|
3096
|
+
value: timelineContext,
|
|
3097
|
+
children: /* @__PURE__ */ jsx13(Internals14.CompositionManager.Provider, {
|
|
3098
|
+
value: compositionManagerContext,
|
|
3099
|
+
children: /* @__PURE__ */ jsx13(Internals14.PrefetchProvider, {
|
|
3100
|
+
children: /* @__PURE__ */ jsx13(Internals14.DurationsContextProvider, {
|
|
3101
|
+
children: /* @__PURE__ */ jsx13(Internals14.MediaVolumeContext.Provider, {
|
|
3102
|
+
value: mediaVolumeContextValue,
|
|
3103
|
+
children: /* @__PURE__ */ jsx13(Internals14.SetMediaVolumeContext.Provider, {
|
|
3104
|
+
value: setMediaVolumeContextValue,
|
|
3105
|
+
children: /* @__PURE__ */ jsx13(Internals14.BufferingProvider, {
|
|
3106
|
+
children: /* @__PURE__ */ jsx13(Internals14.SharedAudioContextProvider, {
|
|
3107
|
+
audioLatencyHint,
|
|
3108
|
+
audioEnabled,
|
|
3109
|
+
children: /* @__PURE__ */ jsx13(Internals14.SharedAudioTagsContextProvider, {
|
|
3110
|
+
numberOfAudioTags: numberOfSharedAudioTags,
|
|
3111
|
+
children
|
|
3112
|
+
})
|
|
3117
3113
|
})
|
|
3118
3114
|
})
|
|
3119
3115
|
})
|
|
@@ -3400,14 +3396,16 @@ var PlayerFn = ({
|
|
|
3400
3396
|
frame,
|
|
3401
3397
|
playing,
|
|
3402
3398
|
rootId,
|
|
3403
|
-
playbackRate: currentPlaybackRate,
|
|
3404
3399
|
imperativePlaying,
|
|
3405
|
-
setPlaybackRate: (rate) => {
|
|
3406
|
-
setCurrentPlaybackRate(rate);
|
|
3407
|
-
},
|
|
3408
3400
|
audioAndVideoTags
|
|
3409
3401
|
};
|
|
3410
|
-
}, [frame,
|
|
3402
|
+
}, [frame, playing, rootId]);
|
|
3403
|
+
const playbackRateContextValue = useMemo14(() => {
|
|
3404
|
+
return {
|
|
3405
|
+
playbackRate: currentPlaybackRate,
|
|
3406
|
+
setPlaybackRate: setCurrentPlaybackRate
|
|
3407
|
+
};
|
|
3408
|
+
}, [currentPlaybackRate]);
|
|
3411
3409
|
const setTimelineContextValue = useMemo14(() => {
|
|
3412
3410
|
return {
|
|
3413
3411
|
setFrame,
|
|
@@ -3428,6 +3426,7 @@ var PlayerFn = ({
|
|
|
3428
3426
|
return /* @__PURE__ */ jsx14(Internals16.IsPlayerContextProvider, {
|
|
3429
3427
|
children: /* @__PURE__ */ jsx14(SharedPlayerContexts, {
|
|
3430
3428
|
timelineContext: timelineContextValue,
|
|
3429
|
+
playbackRateContext: playbackRateContextValue,
|
|
3431
3430
|
component,
|
|
3432
3431
|
compositionHeight,
|
|
3433
3432
|
compositionWidth,
|
|
@@ -3689,14 +3688,18 @@ var ThumbnailFn = ({
|
|
|
3689
3688
|
imperativePlaying: {
|
|
3690
3689
|
current: false
|
|
3691
3690
|
},
|
|
3692
|
-
playbackRate: 1,
|
|
3693
|
-
setPlaybackRate: () => {
|
|
3694
|
-
throw new Error("thumbnail");
|
|
3695
|
-
},
|
|
3696
3691
|
audioAndVideoTags: { current: [] }
|
|
3697
3692
|
};
|
|
3698
3693
|
return value;
|
|
3699
3694
|
}, [frameToDisplay, thumbnailId]);
|
|
3695
|
+
const playbackRateContext = useMemo17(() => {
|
|
3696
|
+
return {
|
|
3697
|
+
playbackRate: 1,
|
|
3698
|
+
setPlaybackRate: () => {
|
|
3699
|
+
throw new Error("thumbnail");
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
}, []);
|
|
3700
3703
|
useImperativeHandle4(ref, () => rootRef.current, []);
|
|
3701
3704
|
const Component = Internals18.useLazyComponent({
|
|
3702
3705
|
compProps: componentProps,
|
|
@@ -3710,6 +3713,7 @@ var ThumbnailFn = ({
|
|
|
3710
3713
|
return /* @__PURE__ */ jsx16(Internals18.IsPlayerContextProvider, {
|
|
3711
3714
|
children: /* @__PURE__ */ jsx16(SharedPlayerContexts, {
|
|
3712
3715
|
timelineContext: timelineState,
|
|
3716
|
+
playbackRateContext,
|
|
3713
3717
|
component: Component,
|
|
3714
3718
|
compositionHeight,
|
|
3715
3719
|
compositionWidth,
|
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.458",
|
|
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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"remotion": "4.0.
|
|
39
|
+
"remotion": "4.0.458"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=16.8.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react-dom": "19.2.3",
|
|
51
51
|
"webpack": "5.105.0",
|
|
52
52
|
"zod": "4.3.6",
|
|
53
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
53
|
+
"@remotion/eslint-config-internal": "4.0.458",
|
|
54
54
|
"eslint": "9.19.0",
|
|
55
55
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
56
56
|
},
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPreferredVolume = exports.persistVolume = void 0;
|
|
4
|
-
const remotion_1 = require("remotion");
|
|
5
|
-
const DEFAULT_VOLUME_PERSISTANCE_KEY = 'remotion.volumePreference';
|
|
6
|
-
const persistVolume = (volume, logLevel, volumePersistenceKey) => {
|
|
7
|
-
if (typeof window === 'undefined') {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
window.localStorage.setItem(volumePersistenceKey !== null && volumePersistenceKey !== void 0 ? volumePersistenceKey : DEFAULT_VOLUME_PERSISTANCE_KEY, String(volume));
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
// User can disallow localStorage access
|
|
15
|
-
// https://github.com/remotion-dev/remotion/issues/3540
|
|
16
|
-
remotion_1.Internals.Log.error({ logLevel, tag: null }, 'Could not persist volume', e);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.persistVolume = persistVolume;
|
|
20
|
-
const getPreferredVolume = (volumePersistenceKey) => {
|
|
21
|
-
if (typeof window === 'undefined') {
|
|
22
|
-
return 1;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const val = window.localStorage.getItem(volumePersistenceKey !== null && volumePersistenceKey !== void 0 ? volumePersistenceKey : DEFAULT_VOLUME_PERSISTANCE_KEY);
|
|
26
|
-
return val ? Number(val) : 1;
|
|
27
|
-
}
|
|
28
|
-
catch (_a) {
|
|
29
|
-
// User can disallow localStorage access
|
|
30
|
-
// https://github.com/remotion-dev/remotion/issues/3540
|
|
31
|
-
return 1;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.getPreferredVolume = getPreferredVolume;
|