@remotion/player 4.0.538 → 4.0.540

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Size } from './utils/use-element-size.js';
3
- export declare const Checkmark: () => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Checkmark: () => React.JSX.Element;
4
4
  export declare const playerButtonStyle: React.CSSProperties;
5
5
  export declare const PlaybackrateControl: React.FC<{
6
6
  readonly playbackRates: number[];
@@ -64,8 +64,11 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) =>
64
64
  const [keyboardSelectedRate, setKeyboardSelectedRate] = (0, react_1.useState)(playbackRate);
65
65
  (0, react_1.useEffect)(() => {
66
66
  const listener = (e) => {
67
- e.preventDefault();
67
+ if (e.ctrlKey || e.metaKey || e.altKey) {
68
+ return;
69
+ }
68
70
  if (e.key === 'ArrowUp') {
71
+ e.preventDefault();
69
72
  const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
70
73
  if (currentIndex === 0) {
71
74
  return;
@@ -78,6 +81,7 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) =>
78
81
  }
79
82
  }
80
83
  else if (e.key === 'ArrowDown') {
84
+ e.preventDefault();
81
85
  const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
82
86
  if (currentIndex === playbackRates.length - 1) {
83
87
  return;
@@ -90,9 +94,17 @@ const PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) =>
90
94
  }
91
95
  }
92
96
  else if (e.key === 'Enter') {
97
+ e.preventDefault();
93
98
  setPlaybackRate(keyboardSelectedRate);
94
99
  setIsComponentVisible(false);
95
100
  }
101
+ else if (e.key === 'Escape') {
102
+ e.preventDefault();
103
+ setIsComponentVisible(false);
104
+ }
105
+ else if (e.key === 'Tab') {
106
+ setIsComponentVisible(false);
107
+ }
96
108
  };
97
109
  window.addEventListener('keydown', listener);
98
110
  return () => {
@@ -1,5 +1,6 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import React from 'react';
3
+ import type { PreferredEffectBackend } from 'remotion';
3
4
  import type { AnyZodObject, CompProps, LogLevel } from 'remotion';
4
5
  import type { BrowserMediaControlsBehavior } from './browser-mediasession.js';
5
6
  import type { RenderMuteButton } from './MediaVolumeSlider.js';
@@ -65,6 +66,7 @@ export type PlayerProps<Schema extends AnyZodObject, Props extends Record<string
65
66
  readonly logLevel?: LogLevel;
66
67
  readonly noSuspense?: boolean;
67
68
  readonly acknowledgeRemotionLicense?: boolean;
69
+ readonly preferredEffectBackend?: PreferredEffectBackend;
68
70
  readonly audioLatencyHint?: AudioContextLatencyCategory;
69
71
  readonly sampleRate?: number;
70
72
  readonly volumePersistenceKey?: string;
@@ -73,7 +73,7 @@ const TimelineSequenceObserverComponent = ({ onTimelineSequenceChange }) => {
73
73
  };
74
74
  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 = no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES
75
75
  ? 0
76
- : 5, errorFallback = () => '⚠️', playbackRate = 1, preservePitch = false, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, showPosterWhenBufferingAndPaused, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, renderFullscreenButton, renderPlayPauseButton, renderVolumeSlider, renderCustomControls, alwaysShowControls = false, initiallyMuted = false, showPlaybackRateControl = false, posterFillMode = 'player-size', bufferStateDelayInMilliseconds, defaultPremountInSeconds = no_react_1.NoReactInternals.DEFAULT_PREMOUNT_IN_SECONDS, hideControlsWhenPointerDoesntMove = true, overflowVisible = false, renderMuteButton, browserMediaControlsBehavior: passedBrowserMediaControlsBehavior, overrideInternalClassName, logLevel = 'info', noSuspense, acknowledgeRemotionLicense, audioLatencyHint = 'playback', sampleRate = 48000, volumePersistenceKey, initialVolume, _experimentalKeepAudioContextAlive = false, ...componentProps }, ref) => {
76
+ : 5, errorFallback = () => '⚠️', playbackRate = 1, preservePitch = false, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, showPosterWhenBuffering, showPosterWhenBufferingAndPaused, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, renderFullscreenButton, renderPlayPauseButton, renderVolumeSlider, renderCustomControls, alwaysShowControls = false, initiallyMuted = false, showPlaybackRateControl = false, posterFillMode = 'player-size', bufferStateDelayInMilliseconds, defaultPremountInSeconds = no_react_1.NoReactInternals.DEFAULT_PREMOUNT_IN_SECONDS, hideControlsWhenPointerDoesntMove = true, overflowVisible = false, renderMuteButton, browserMediaControlsBehavior: passedBrowserMediaControlsBehavior, overrideInternalClassName, logLevel = 'info', noSuspense, acknowledgeRemotionLicense, audioLatencyHint = 'playback', preferredEffectBackend = 'auto', sampleRate = 48000, volumePersistenceKey, initialVolume, _experimentalKeepAudioContextAlive = false, ...componentProps }, ref) => {
77
77
  no_react_1.NoReactInternals.validateDefaultPremountInSeconds(defaultPremountInSeconds);
78
78
  if (typeof window !== 'undefined') {
79
79
  window.remotion_isPlayer = true;
@@ -258,7 +258,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
258
258
  mode: 'prevent-media-session',
259
259
  });
260
260
  }, [passedBrowserMediaControlsBehavior]);
261
- const player = ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineContextValue, playbackRateContext: playbackRateContextValue, preservePitch: preservePitch, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: numberOfSharedAudioTags, initiallyMuted: initiallyMuted, logLevel: logLevel, audioLatencyHint: audioLatencyHint, sampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, volumePersistenceKey: volumePersistenceKey, initialVolume: initialVolume, inputProps: actualInputProps, audioEnabled: true, 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'
261
+ const player = ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineContextValue, playbackRateContext: playbackRateContextValue, preservePitch: preservePitch, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: numberOfSharedAudioTags, initiallyMuted: initiallyMuted, logLevel: logLevel, audioLatencyHint: audioLatencyHint, preferredEffectBackend: preferredEffectBackend, sampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, volumePersistenceKey: volumePersistenceKey, initialVolume: initialVolume, inputProps: actualInputProps, audioEnabled: true, 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'
262
262
  ? clickToPlay
263
263
  : 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) }) }) }) }) }));
264
264
  return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.DefaultPremountContext.Provider, { value: defaultPremountInSeconds, children: onTimelineSequenceChange ? ((0, jsx_runtime_1.jsx)(remotion_1.Internals.SequenceRegistrationContext.Provider, { value: true, children: (0, jsx_runtime_1.jsxs)(remotion_1.Internals.SequenceManagerProvider, { children: [(0, jsx_runtime_1.jsx)(TimelineSequenceObserverComponent, { onTimelineSequenceChange: onTimelineSequenceChange }), player] }) })) : (player) }));
@@ -84,7 +84,8 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
84
84
  setHasPlayed(true);
85
85
  player.play(e);
86
86
  }, [player]);
87
- const { playerMuted, mediaVolume } = (0, react_1.useContext)(remotion_1.Internals.MediaVolumeContext);
87
+ const [playerMuted, setPlayerMuted] = remotion_1.Internals.usePlayerMutedState();
88
+ const [mediaVolume, setMediaVolume] = remotion_1.Internals.useMediaVolumeState();
88
89
  const canvasOverlay = (0, react_1.useContext)(canvas_overlay_context_js_1.CanvasOverlayContext);
89
90
  const canvasContentRef = (0, react_1.useRef)(null);
90
91
  (0, react_1.useEffect)(() => {
@@ -219,7 +220,6 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
219
220
  }
220
221
  player.emitter.dispatchScaleChange(scale);
221
222
  }, [player.emitter, scale]);
222
- const { setMediaVolume, setPlayerMuted } = (0, react_1.useContext)(remotion_1.Internals.SetMediaVolumeContext);
223
223
  const [showBufferIndicator, setShowBufferState] = (0, react_1.useState)(false);
224
224
  (0, react_1.useEffect)(() => {
225
225
  let timeout = null;
@@ -1,5 +1,6 @@
1
1
  import type { ComponentType, LazyExoticComponent } from 'react';
2
2
  import React from 'react';
3
+ import type { PreferredEffectBackend } from 'remotion';
3
4
  import type { LogLevel, PlaybackRateContextValue, TimelineContextValue } from 'remotion';
4
5
  export declare const PLAYER_COMP_ID = "player-comp";
5
6
  export declare const SharedPlayerContexts: React.FC<{
@@ -15,6 +16,7 @@ export declare const SharedPlayerContexts: React.FC<{
15
16
  readonly numberOfSharedAudioTags: number;
16
17
  readonly initiallyMuted: boolean;
17
18
  readonly logLevel: LogLevel;
19
+ readonly preferredEffectBackend: PreferredEffectBackend;
18
20
  readonly audioLatencyHint: AudioContextLatencyCategory;
19
21
  readonly sampleRate: number;
20
22
  readonly volumePersistenceKey?: string;
@@ -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, playbackRateContext, preservePitch, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, audioLatencyHint, sampleRate, volumePersistenceKey, initialVolume, inputProps, audioEnabled, _experimentalKeepAudioContextAlive, }) => {
9
+ const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext, preservePitch, fps, compositionHeight, compositionWidth, durationInFrames, component, numberOfSharedAudioTags, initiallyMuted, logLevel, audioLatencyHint, preferredEffectBackend, sampleRate, volumePersistenceKey, initialVolume, inputProps, audioEnabled, _experimentalKeepAudioContextAlive, }) => {
10
10
  const persistVolumeToStorage = initialVolume === undefined;
11
11
  const compositionManagerContext = (0, react_1.useMemo)(() => {
12
12
  const context = {
@@ -93,6 +93,6 @@ const SharedPlayerContexts = ({ children, timelineContext, playbackRateContext,
93
93
  isReadOnlyStudio: false,
94
94
  };
95
95
  }, []);
96
- return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionEnvironmentContext.Provider, { value: env, children: (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.AbsoluteTimeContext.Provider, { value: timelineContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PlaybackRateContext.Provider, { value: playbackRateContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PlaybackPitchContext.Provider, { value: preservePitch, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.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.VideoProvider, { 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.BufferingProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled: shouldCreateAudioContext, previewSampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
96
+ return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionEnvironmentContext.Provider, { value: env, children: (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.AbsoluteTimeContext.Provider, { value: timelineContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PlaybackRateContext.Provider, { value: playbackRateContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PlaybackPitchContext.Provider, { value: preservePitch, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.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.VideoProvider, { 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.BufferingProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioContextProvider, { audioLatencyHint: audioLatencyHint, audioEnabled: shouldCreateAudioContext, previewSampleRate: sampleRate, _experimentalKeepAudioContextAlive: _experimentalKeepAudioContextAlive, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioTagsContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.PreferredEffectBackendContext.Provider, { value: remotion_1.Internals.validatePreferredEffectBackend(preferredEffectBackend), children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
97
97
  };
98
98
  exports.SharedPlayerContexts = SharedPlayerContexts;
@@ -1,4 +1,5 @@
1
1
  import type { CSSProperties } from 'react';
2
+ import type { PreferredEffectBackend } from 'remotion';
2
3
  import type { AnyZodObject, CompProps, LogLevel } from 'remotion';
3
4
  import type { ThumbnailMethods } from './player-methods.js';
4
5
  import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
@@ -15,6 +16,7 @@ export type ThumbnailProps<Schema extends AnyZodObject, Props extends Record<str
15
16
  readonly renderLoading?: RenderLoading;
16
17
  readonly className?: string;
17
18
  readonly overrideInternalClassName?: string;
19
+ readonly preferredEffectBackend?: PreferredEffectBackend;
18
20
  readonly logLevel?: LogLevel;
19
21
  readonly noSuspense?: boolean;
20
22
  };
@@ -11,7 +11,7 @@ const emitter_context_js_1 = require("./emitter-context.js");
11
11
  const event_emitter_js_1 = require("./event-emitter.js");
12
12
  const SharedPlayerContext_js_1 = require("./SharedPlayerContext.js");
13
13
  const ThumbnailUI_js_1 = __importDefault(require("./ThumbnailUI.js"));
14
- const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback = () => '⚠️', renderLoading, overflowVisible = false, overrideInternalClassName, logLevel = 'info', noSuspense, ...componentProps }, ref) => {
14
+ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, compositionWidth, durationInFrames, fps, className, errorFallback = () => '⚠️', renderLoading, overflowVisible = false, overrideInternalClassName, logLevel = 'info', preferredEffectBackend = 'auto', noSuspense, ...componentProps }, ref) => {
15
15
  if (typeof window !== 'undefined') {
16
16
  // eslint-disable-next-line react-hooks/rules-of-hooks
17
17
  (0, react_1.useLayoutEffect)(() => {
@@ -70,7 +70,7 @@ const ThumbnailFn = ({ frameToDisplay, style, inputProps, compositionHeight, com
70
70
  const passedInputProps = (0, react_1.useMemo)(() => {
71
71
  return inputProps !== null && inputProps !== void 0 ? inputProps : {};
72
72
  }, [inputProps]);
73
- return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContext, children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineState, playbackRateContext: playbackRateContext, preservePitch: false, component: Component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: 0, initiallyMuted: true, logLevel: logLevel, audioLatencyHint: "playback", sampleRate: 48000, inputProps: passedInputProps, audioEnabled: false, _experimentalKeepAudioContextAlive: false, 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) }) }) }) }) }));
73
+ return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetTimelineContext.Provider, { value: setTimelineContext, children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineState, playbackRateContext: playbackRateContext, preservePitch: false, component: Component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, numberOfSharedAudioTags: 0, initiallyMuted: true, logLevel: logLevel, audioLatencyHint: "playback", preferredEffectBackend: preferredEffectBackend, sampleRate: 48000, inputProps: passedInputProps, audioEnabled: false, _experimentalKeepAudioContextAlive: false, 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) }) }) }) }) }));
74
74
  };
75
75
  const forward = react_1.forwardRef;
76
76
  /*
@@ -82,13 +82,13 @@ const useBrowserMediaSession = ({ browserMediaControlsBehavior, videoConfig, pla
82
82
  navigator.mediaSession.setActionHandler('seekbackward', () => {
83
83
  if (browserMediaControlsBehavior.mode === 'register-media-session' &&
84
84
  videoConfig) {
85
- seek(Math.max(0, Math.round((getCurrentFrame() - 10) * videoConfig.fps)));
85
+ seek(Math.max(0, Math.round(getCurrentFrame() - 10 * videoConfig.fps)));
86
86
  }
87
87
  });
88
88
  navigator.mediaSession.setActionHandler('seekforward', () => {
89
89
  if (browserMediaControlsBehavior.mode === 'register-media-session' &&
90
90
  videoConfig) {
91
- seek(Math.max(videoConfig.durationInFrames - 1, Math.round((getCurrentFrame() + 10) * videoConfig.fps)));
91
+ seek(Math.min(videoConfig.durationInFrames - 1, Math.round(getCurrentFrame() + 10 * videoConfig.fps)));
92
92
  }
93
93
  });
94
94
  navigator.mediaSession.setActionHandler('previoustrack', () => {
@@ -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 | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
18
+ render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
19
19
  }
@@ -111,8 +111,8 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
111
111
  };
112
112
  }, [fps, getCurrentFrame, logLevel, muted, playbackRate, sharedAudioContext]);
113
113
  (0, react_2.useEffect)(() => {
114
- var _a;
115
- var _b;
114
+ var _a, _b;
115
+ var _c;
116
116
  const wasMuted = previousMutedRef.current;
117
117
  previousMutedRef.current = muted;
118
118
  if (fps === null || durationInFrames === null || compositionId === null) {
@@ -124,6 +124,9 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
124
124
  (_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext);
125
125
  return;
126
126
  }
127
+ if (muted) {
128
+ (_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
129
+ }
127
130
  // Duration and range changes update the endpoint without losing elapsed
128
131
  // sub-frame time. A different composition or timebase needs a fresh clock.
129
132
  const previousClock = playbackClockRef.current;
@@ -170,7 +173,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
170
173
  let audioContextFailed = false;
171
174
  let reqAnimFrameCall = null;
172
175
  let playbackFrame = getCurrentFrame();
173
- let lastSeekRevision = (_b = seek === null || seek === void 0 ? void 0 : seek.revision.current) !== null && _b !== void 0 ? _b : null;
176
+ let lastSeekRevision = (_c = seek === null || seek === void 0 ? void 0 : seek.revision.current) !== null && _c !== void 0 ? _c : null;
174
177
  const cancelQueuedFrame = () => {
175
178
  if (reqAnimFrameCall !== null) {
176
179
  if (reqAnimFrameCall.type === 'raf') {
@@ -10,6 +10,8 @@ const usePlayerMethods = () => {
10
10
  const { setPlaying, frameRef, audioAndVideoTags, isPlaying: readIsPlaying, isBuffering, } = (0, react_1.useContext)(remotion_1.Internals.SetTimelineContext);
11
11
  const audioContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioContext);
12
12
  const audioTagsContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioTagsContext);
13
+ const { playerMuted, mediaVolume } = (0, react_1.useContext)(remotion_1.Internals.MediaVolumeContext);
14
+ const muted = playerMuted || mediaVolume === 0;
13
15
  const environment = (0, remotion_1.useRemotionEnvironment)();
14
16
  const video = remotion_1.Internals.useVideo();
15
17
  const videoId = (_a = video === null || video === void 0 ? void 0 : video.id) !== null && _a !== void 0 ? _a : null;
@@ -63,17 +65,19 @@ const usePlayerMethods = () => {
63
65
  if (getCurrentFrame() === lastFrameForPlayback) {
64
66
  seek(0);
65
67
  }
66
- if (isAutoPlayAttempt) {
67
- audioContext === null || audioContext === void 0 ? void 0 : audioContext.resumeAsAutoPlay();
68
- }
69
- else {
70
- audioContext === null || audioContext === void 0 ? void 0 : audioContext.resume();
71
- }
72
- /**
73
- * Play silent audio tags to warm them up for autoplay
74
- */
75
- if (audioTagsContext && audioTagsContext.numberOfAudioTags > 0 && e) {
76
- audioTagsContext.playAllAudios();
68
+ if (!muted) {
69
+ if (isAutoPlayAttempt) {
70
+ audioContext === null || audioContext === void 0 ? void 0 : audioContext.resumeAsAutoPlay();
71
+ }
72
+ else {
73
+ audioContext === null || audioContext === void 0 ? void 0 : audioContext.resume();
74
+ }
75
+ /**
76
+ * Play silent audio tags to warm them up for autoplay
77
+ */
78
+ if (audioTagsContext && audioTagsContext.numberOfAudioTags > 0 && e) {
79
+ audioTagsContext.playAllAudios();
80
+ }
77
81
  }
78
82
  /**
79
83
  * Play audios and videos directly here so they can benefit from
@@ -90,6 +94,7 @@ const usePlayerMethods = () => {
90
94
  config === null || config === void 0 ? void 0 : config.durationInFrames,
91
95
  emitter,
92
96
  getCurrentFrame,
97
+ muted,
93
98
  readIsPlaying,
94
99
  seek,
95
100
  setPlaying,
@@ -575,6 +575,8 @@ var usePlayerMethods = () => {
575
575
  } = useContext2(Internals3.SetTimelineContext);
576
576
  const audioContext = useContext2(Internals3.SharedAudioContext);
577
577
  const audioTagsContext = useContext2(Internals3.SharedAudioTagsContext);
578
+ const { playerMuted, mediaVolume } = useContext2(Internals3.MediaVolumeContext);
579
+ const muted = playerMuted || mediaVolume === 0;
578
580
  const environment = useRemotionEnvironment();
579
581
  const video = Internals3.useVideo();
580
582
  const videoId = video?.id ?? null;
@@ -618,13 +620,15 @@ var usePlayerMethods = () => {
618
620
  if (getCurrentFrame() === lastFrameForPlayback) {
619
621
  seek(0);
620
622
  }
621
- if (isAutoPlayAttempt) {
622
- audioContext?.resumeAsAutoPlay();
623
- } else {
624
- audioContext?.resume();
625
- }
626
- if (audioTagsContext && audioTagsContext.numberOfAudioTags > 0 && e) {
627
- audioTagsContext.playAllAudios();
623
+ if (!muted) {
624
+ if (isAutoPlayAttempt) {
625
+ audioContext?.resumeAsAutoPlay();
626
+ } else {
627
+ audioContext?.resume();
628
+ }
629
+ if (audioTagsContext && audioTagsContext.numberOfAudioTags > 0 && e) {
630
+ audioTagsContext.playAllAudios();
631
+ }
628
632
  }
629
633
  audioAndVideoTags.current.forEach((tag) => tag.play("player play() was called and playing audio from a click"));
630
634
  setPlaying(true);
@@ -637,6 +641,7 @@ var usePlayerMethods = () => {
637
641
  config?.durationInFrames,
638
642
  emitter,
639
643
  getCurrentFrame,
644
+ muted,
640
645
  readIsPlaying,
641
646
  seek,
642
647
  setPlaying
@@ -823,12 +828,12 @@ var useBrowserMediaSession = ({
823
828
  });
824
829
  navigator.mediaSession.setActionHandler("seekbackward", () => {
825
830
  if (browserMediaControlsBehavior.mode === "register-media-session" && videoConfig) {
826
- seek(Math.max(0, Math.round((getCurrentFrame() - 10) * videoConfig.fps)));
831
+ seek(Math.max(0, Math.round(getCurrentFrame() - 10 * videoConfig.fps)));
827
832
  }
828
833
  });
829
834
  navigator.mediaSession.setActionHandler("seekforward", () => {
830
835
  if (browserMediaControlsBehavior.mode === "register-media-session" && videoConfig) {
831
- seek(Math.max(videoConfig.durationInFrames - 1, Math.round((getCurrentFrame() + 10) * videoConfig.fps)));
836
+ seek(Math.min(videoConfig.durationInFrames - 1, Math.round(getCurrentFrame() + 10 * videoConfig.fps)));
832
837
  }
833
838
  });
834
839
  navigator.mediaSession.setActionHandler("previoustrack", () => {
@@ -1045,6 +1050,9 @@ var usePlayback = ({
1045
1050
  sharedAudioContext?.suspend?.();
1046
1051
  return;
1047
1052
  }
1053
+ if (muted) {
1054
+ sharedAudioContext?.suspend?.();
1055
+ }
1048
1056
  const previousClock = playbackClockRef.current;
1049
1057
  const shouldRestartClock = previousClock === null || previousClock.compositionId !== compositionId || previousClock.fps !== fps || previousClock.playbackRate !== playbackRate;
1050
1058
  const clock = shouldRestartClock ? {
@@ -1850,8 +1858,11 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1850
1858
  const [keyboardSelectedRate, setKeyboardSelectedRate] = useState7(playbackRate);
1851
1859
  useEffect9(() => {
1852
1860
  const listener = (e) => {
1853
- e.preventDefault();
1861
+ if (e.ctrlKey || e.metaKey || e.altKey) {
1862
+ return;
1863
+ }
1854
1864
  if (e.key === "ArrowUp") {
1865
+ e.preventDefault();
1855
1866
  const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
1856
1867
  if (currentIndex === 0) {
1857
1868
  return;
@@ -1862,6 +1873,7 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1862
1873
  setKeyboardSelectedRate(playbackRates[currentIndex - 1]);
1863
1874
  }
1864
1875
  } else if (e.key === "ArrowDown") {
1876
+ e.preventDefault();
1865
1877
  const currentIndex = playbackRates.findIndex((rate) => rate === keyboardSelectedRate);
1866
1878
  if (currentIndex === playbackRates.length - 1) {
1867
1879
  return;
@@ -1872,8 +1884,14 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1872
1884
  setKeyboardSelectedRate(playbackRates[currentIndex + 1]);
1873
1885
  }
1874
1886
  } else if (e.key === "Enter") {
1887
+ e.preventDefault();
1875
1888
  setPlaybackRate(keyboardSelectedRate);
1876
1889
  setIsComponentVisible(false);
1890
+ } else if (e.key === "Escape") {
1891
+ e.preventDefault();
1892
+ setIsComponentVisible(false);
1893
+ } else if (e.key === "Tab") {
1894
+ setIsComponentVisible(false);
1877
1895
  }
1878
1896
  };
1879
1897
  window.addEventListener("keydown", listener);
@@ -2667,7 +2685,8 @@ var PlayerUI = ({
2667
2685
  setHasPlayed(true);
2668
2686
  player.play(e);
2669
2687
  }, [player]);
2670
- const { playerMuted, mediaVolume } = useContext4(Internals11.MediaVolumeContext);
2688
+ const [playerMuted, setPlayerMuted] = Internals11.usePlayerMutedState();
2689
+ const [mediaVolume, setMediaVolume] = Internals11.useMediaVolumeState();
2671
2690
  const canvasOverlay = useContext4(CanvasOverlayContext);
2672
2691
  const canvasContentRef = useRef10(null);
2673
2692
  useEffect12(() => {
@@ -2787,7 +2806,6 @@ var PlayerUI = ({
2787
2806
  }
2788
2807
  player.emitter.dispatchScaleChange(scale);
2789
2808
  }, [player.emitter, scale]);
2790
- const { setMediaVolume, setPlayerMuted } = useContext4(Internals11.SetMediaVolumeContext);
2791
2809
  const [showBufferIndicator, setShowBufferState] = useState10(false);
2792
2810
  useEffect12(() => {
2793
2811
  let timeout = null;
@@ -3150,6 +3168,7 @@ var SharedPlayerContexts = ({
3150
3168
  initiallyMuted,
3151
3169
  logLevel,
3152
3170
  audioLatencyHint,
3171
+ preferredEffectBackend,
3153
3172
  sampleRate,
3154
3173
  volumePersistenceKey,
3155
3174
  initialVolume,
@@ -3270,7 +3289,10 @@ var SharedPlayerContexts = ({
3270
3289
  _experimentalKeepAudioContextAlive,
3271
3290
  children: /* @__PURE__ */ jsx13(Internals13.SharedAudioTagsContextProvider, {
3272
3291
  numberOfAudioTags: numberOfSharedAudioTags,
3273
- children
3292
+ children: /* @__PURE__ */ jsx13(Internals13.PreferredEffectBackendContext.Provider, {
3293
+ value: Internals13.validatePreferredEffectBackend(preferredEffectBackend),
3294
+ children
3295
+ })
3274
3296
  })
3275
3297
  })
3276
3298
  })
@@ -3472,6 +3494,7 @@ var PlayerFn = ({
3472
3494
  noSuspense,
3473
3495
  acknowledgeRemotionLicense,
3474
3496
  audioLatencyHint = "playback",
3497
+ preferredEffectBackend = "auto",
3475
3498
  sampleRate = 48000,
3476
3499
  volumePersistenceKey,
3477
3500
  initialVolume,
@@ -3657,6 +3680,7 @@ var PlayerFn = ({
3657
3680
  initiallyMuted,
3658
3681
  logLevel,
3659
3682
  audioLatencyHint,
3683
+ preferredEffectBackend,
3660
3684
  sampleRate,
3661
3685
  _experimentalKeepAudioContextAlive,
3662
3686
  volumePersistenceKey,
@@ -3903,6 +3927,7 @@ var ThumbnailFn = ({
3903
3927
  overflowVisible = false,
3904
3928
  overrideInternalClassName,
3905
3929
  logLevel = "info",
3930
+ preferredEffectBackend = "auto",
3906
3931
  noSuspense,
3907
3932
  ...componentProps
3908
3933
  }, ref) => {
@@ -3985,6 +4010,7 @@ var ThumbnailFn = ({
3985
4010
  initiallyMuted: true,
3986
4011
  logLevel,
3987
4012
  audioLatencyHint: "playback",
4013
+ preferredEffectBackend,
3988
4014
  sampleRate: 48000,
3989
4015
  inputProps: passedInputProps,
3990
4016
  audioEnabled: false,
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.538",
6
+ "version": "4.0.540",
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",
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "license": "SEE LICENSE IN LICENSE.md",
37
37
  "dependencies": {
38
- "remotion": "4.0.538"
38
+ "remotion": "4.0.540"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=16.8.0",
@@ -45,11 +45,11 @@
45
45
  "@testing-library/react": "16.1.0",
46
46
  "@happy-dom/global-registrator": "14.5.1",
47
47
  "csstype": "3.2.3",
48
- "react": "19.2.3",
49
- "react-dom": "19.2.3",
48
+ "react": "19.3.1",
49
+ "react-dom": "19.3.1",
50
50
  "webpack": "5.105.0",
51
- "zod": "4.5.4",
52
- "@remotion/eslint-config-internal": "4.0.538",
51
+ "zod": "4.6.7",
52
+ "@remotion/eslint-config-internal": "4.0.540",
53
53
  "eslint": "9.19.0",
54
54
  "typescript": "7.1.0-beta"
55
55
  },