@remotion/player 4.0.456 → 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 +7 -13
- package/dist/esm/index.mjs +47 -41
- package/package.json +3 -3
|
@@ -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) {
|
|
@@ -95,7 +88,9 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
95
88
|
(_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext);
|
|
96
89
|
return;
|
|
97
90
|
}
|
|
98
|
-
(
|
|
91
|
+
if (!muted) {
|
|
92
|
+
(_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.resume) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
|
|
93
|
+
}
|
|
99
94
|
const time = performance.now() - startedTime;
|
|
100
95
|
const actualLastFrame = outFrame !== null && outFrame !== void 0 ? outFrame : config.durationInFrames - 1;
|
|
101
96
|
const actualFirstFrame = inFrame !== null && inFrame !== void 0 ? inFrame : 0;
|
|
@@ -127,7 +122,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
127
122
|
var _a, _b;
|
|
128
123
|
var _c;
|
|
129
124
|
const getIsResumingAudioContext = (_c = (_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.getIsResumingAudioContext) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext)) !== null && _c !== void 0 ? _c : null;
|
|
130
|
-
if (getIsResumingAudioContext !== null) {
|
|
125
|
+
if (getIsResumingAudioContext !== null && !muted) {
|
|
131
126
|
getIsResumingAudioContext.then(() => {
|
|
132
127
|
if (!(sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.audioContext)) {
|
|
133
128
|
return;
|
|
@@ -143,7 +138,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
143
138
|
audioContext: sharedAudioContext.audioContext,
|
|
144
139
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
145
140
|
absoluteTimeInSeconds: getCurrentFrame() / config.fps,
|
|
146
|
-
globalPlaybackRate:
|
|
141
|
+
globalPlaybackRate: playbackRate,
|
|
147
142
|
logLevel,
|
|
148
143
|
});
|
|
149
144
|
startedTime = performance.now();
|
|
@@ -203,7 +198,6 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
203
198
|
context,
|
|
204
199
|
isPlaying,
|
|
205
200
|
sharedAudioContext,
|
|
206
|
-
timelineContext.playbackRate,
|
|
207
201
|
logLevel,
|
|
208
202
|
muted,
|
|
209
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;
|
|
@@ -1016,7 +1009,9 @@ var usePlayback = ({
|
|
|
1016
1009
|
sharedAudioContext?.suspend?.();
|
|
1017
1010
|
return;
|
|
1018
1011
|
}
|
|
1019
|
-
|
|
1012
|
+
if (!muted) {
|
|
1013
|
+
sharedAudioContext?.resume?.();
|
|
1014
|
+
}
|
|
1020
1015
|
const time = performance.now() - startedTime;
|
|
1021
1016
|
const actualLastFrame = outFrame ?? config.durationInFrames - 1;
|
|
1022
1017
|
const actualFirstFrame = inFrame ?? 0;
|
|
@@ -1045,7 +1040,7 @@ var usePlayback = ({
|
|
|
1045
1040
|
};
|
|
1046
1041
|
const queueNextFrame = () => {
|
|
1047
1042
|
const getIsResumingAudioContext = sharedAudioContext?.getIsResumingAudioContext?.() ?? null;
|
|
1048
|
-
if (getIsResumingAudioContext !== null) {
|
|
1043
|
+
if (getIsResumingAudioContext !== null && !muted) {
|
|
1049
1044
|
getIsResumingAudioContext.then(() => {
|
|
1050
1045
|
if (!sharedAudioContext?.audioContext) {
|
|
1051
1046
|
return;
|
|
@@ -1057,7 +1052,7 @@ var usePlayback = ({
|
|
|
1057
1052
|
audioContext: sharedAudioContext.audioContext,
|
|
1058
1053
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
1059
1054
|
absoluteTimeInSeconds: getCurrentFrame() / config.fps,
|
|
1060
|
-
globalPlaybackRate:
|
|
1055
|
+
globalPlaybackRate: playbackRate,
|
|
1061
1056
|
logLevel
|
|
1062
1057
|
});
|
|
1063
1058
|
startedTime = performance.now();
|
|
@@ -1114,7 +1109,6 @@ var usePlayback = ({
|
|
|
1114
1109
|
context,
|
|
1115
1110
|
isPlaying,
|
|
1116
1111
|
sharedAudioContext,
|
|
1117
|
-
timelineContext.playbackRate,
|
|
1118
1112
|
logLevel,
|
|
1119
1113
|
muted
|
|
1120
1114
|
]);
|
|
@@ -1729,7 +1723,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
|
|
|
1729
1723
|
}, rate);
|
|
1730
1724
|
};
|
|
1731
1725
|
var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
1732
|
-
const { setPlaybackRate, playbackRate } = Internals9.
|
|
1726
|
+
const { setPlaybackRate, playbackRate } = Internals9.usePlaybackRate();
|
|
1733
1727
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = useState8(playbackRate);
|
|
1734
1728
|
useEffect9(() => {
|
|
1735
1729
|
const listener = (e) => {
|
|
@@ -1831,7 +1825,7 @@ var button = {
|
|
|
1831
1825
|
};
|
|
1832
1826
|
var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
1833
1827
|
const { ref, isComponentVisible, setIsComponentVisible } = useComponentVisible(false);
|
|
1834
|
-
const { playbackRate } = Internals9.
|
|
1828
|
+
const { playbackRate } = Internals9.usePlaybackRate();
|
|
1835
1829
|
const onClick = useCallback6((e) => {
|
|
1836
1830
|
e.stopPropagation();
|
|
1837
1831
|
e.preventDefault();
|
|
@@ -2995,6 +2989,7 @@ var PLAYER_COMP_ID = "player-comp";
|
|
|
2995
2989
|
var SharedPlayerContexts = ({
|
|
2996
2990
|
children,
|
|
2997
2991
|
timelineContext,
|
|
2992
|
+
playbackRateContext,
|
|
2998
2993
|
fps,
|
|
2999
2994
|
compositionHeight,
|
|
3000
2995
|
compositionWidth,
|
|
@@ -3095,23 +3090,26 @@ var SharedPlayerContexts = ({
|
|
|
3095
3090
|
children: /* @__PURE__ */ jsx13(Internals14.CanUseRemotionHooksProvider, {
|
|
3096
3091
|
children: /* @__PURE__ */ jsx13(Internals14.AbsoluteTimeContext.Provider, {
|
|
3097
3092
|
value: timelineContext,
|
|
3098
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3099
|
-
value:
|
|
3100
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3101
|
-
value:
|
|
3102
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3107
|
-
value:
|
|
3108
|
-
children: /* @__PURE__ */ jsx13(Internals14.
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
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
|
+
})
|
|
3115
3113
|
})
|
|
3116
3114
|
})
|
|
3117
3115
|
})
|
|
@@ -3398,14 +3396,16 @@ var PlayerFn = ({
|
|
|
3398
3396
|
frame,
|
|
3399
3397
|
playing,
|
|
3400
3398
|
rootId,
|
|
3401
|
-
playbackRate: currentPlaybackRate,
|
|
3402
3399
|
imperativePlaying,
|
|
3403
|
-
setPlaybackRate: (rate) => {
|
|
3404
|
-
setCurrentPlaybackRate(rate);
|
|
3405
|
-
},
|
|
3406
3400
|
audioAndVideoTags
|
|
3407
3401
|
};
|
|
3408
|
-
}, [frame,
|
|
3402
|
+
}, [frame, playing, rootId]);
|
|
3403
|
+
const playbackRateContextValue = useMemo14(() => {
|
|
3404
|
+
return {
|
|
3405
|
+
playbackRate: currentPlaybackRate,
|
|
3406
|
+
setPlaybackRate: setCurrentPlaybackRate
|
|
3407
|
+
};
|
|
3408
|
+
}, [currentPlaybackRate]);
|
|
3409
3409
|
const setTimelineContextValue = useMemo14(() => {
|
|
3410
3410
|
return {
|
|
3411
3411
|
setFrame,
|
|
@@ -3426,6 +3426,7 @@ var PlayerFn = ({
|
|
|
3426
3426
|
return /* @__PURE__ */ jsx14(Internals16.IsPlayerContextProvider, {
|
|
3427
3427
|
children: /* @__PURE__ */ jsx14(SharedPlayerContexts, {
|
|
3428
3428
|
timelineContext: timelineContextValue,
|
|
3429
|
+
playbackRateContext: playbackRateContextValue,
|
|
3429
3430
|
component,
|
|
3430
3431
|
compositionHeight,
|
|
3431
3432
|
compositionWidth,
|
|
@@ -3687,14 +3688,18 @@ var ThumbnailFn = ({
|
|
|
3687
3688
|
imperativePlaying: {
|
|
3688
3689
|
current: false
|
|
3689
3690
|
},
|
|
3690
|
-
playbackRate: 1,
|
|
3691
|
-
setPlaybackRate: () => {
|
|
3692
|
-
throw new Error("thumbnail");
|
|
3693
|
-
},
|
|
3694
3691
|
audioAndVideoTags: { current: [] }
|
|
3695
3692
|
};
|
|
3696
3693
|
return value;
|
|
3697
3694
|
}, [frameToDisplay, thumbnailId]);
|
|
3695
|
+
const playbackRateContext = useMemo17(() => {
|
|
3696
|
+
return {
|
|
3697
|
+
playbackRate: 1,
|
|
3698
|
+
setPlaybackRate: () => {
|
|
3699
|
+
throw new Error("thumbnail");
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
}, []);
|
|
3698
3703
|
useImperativeHandle4(ref, () => rootRef.current, []);
|
|
3699
3704
|
const Component = Internals18.useLazyComponent({
|
|
3700
3705
|
compProps: componentProps,
|
|
@@ -3708,6 +3713,7 @@ var ThumbnailFn = ({
|
|
|
3708
3713
|
return /* @__PURE__ */ jsx16(Internals18.IsPlayerContextProvider, {
|
|
3709
3714
|
children: /* @__PURE__ */ jsx16(SharedPlayerContexts, {
|
|
3710
3715
|
timelineContext: timelineState,
|
|
3716
|
+
playbackRateContext,
|
|
3711
3717
|
component: Component,
|
|
3712
3718
|
compositionHeight,
|
|
3713
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
|
},
|