🎥 Make videos programmatically with React
posterFillMode
Jonny Burger3c1cbb5c8463
diff --git a/packages/docs/docs/player/api.md b/packages/docs/docs/player/api.mdindex caa1c4bc79..f6527c90df 100644--- a/packages/docs/docs/player/api.md+++ b/packages/docs/docs/player/api.md@@ -395,6 +395,13 @@ You may pass an array with the available playback rates for selection, however,Default `false`.+### `posterFillMode`<AvailableFrom v="4.0.78" />++Either `player-size` (default) or `composition-size`:++- `player-size`: The poster will be rendered in the size of the player. This is useful if you want to render for example a Play button with constant size.+- `composition-size`: The poster will be rendered in the size of the composition and scaled to the size of the Player. This is useful if you want to render a freeze frame of the video as a poster.+## `PlayerRef`You may attach a ref to the player and control it in an imperative manner.diff --git a/packages/player/src/Player.tsx b/packages/player/src/Player.tsxindex b62cd30b6a..109f63d080 100644--- a/packages/player/src/Player.tsx+++ b/packages/player/src/Player.tsx@@ -24,7 +24,7 @@ import type {RenderFullscreenButton,RenderPlayPauseButton,} from './PlayerControls.js';-import type {RenderLoading, RenderPoster} from './PlayerUI.js';+import type {PosterFillMode, RenderLoading, RenderPoster} from './PlayerUI.js';import PlayerUI from './PlayerUI.js';import {PLAYER_COMP_ID, SharedPlayerContexts} from './SharedPlayerContext.js';import type {PropsIfHasProps} from './utils/props-if-has-props.js';@@ -74,6 +74,7 @@ export type PlayerProps<Schema extends AnyZodObject, Props> = {schema?: Schema;initiallyMuted?: boolean;showPlaybackRateControl?: boolean | number[];+ posterFillMode?: PosterFillMode;} & CompProps<Props> &PropsIfHasProps<Schema, Props>;@@ -122,6 +123,7 @@ const PlayerFn = <Schema extends AnyZodObject, Props>(alwaysShowControls = false,initiallyMuted = false,showPlaybackRateControl = false,+ posterFillMode = 'player-size',...componentProps}: PlayerProps<Schema, Props>,ref: MutableRefObject<PlayerRef>,@@ -344,7 +346,7 @@ const PlayerFn = <Schema extends AnyZodObject, Props>(<PlayerEventEmitterContext.Provider value={emitter}><PlayerUIref={rootRef}- posterFillMode="composition-size"+ posterFillMode={posterFillMode}renderLoading={renderLoading}autoPlay={Boolean(autoPlay)}loop={Boolean(loop)}