Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/players/background-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { MediaProps } from './media/index.js';

const BackgroundPlayer = forwardRef<HTMLVideoElement, Omit<MediaProps, 'ref'> & PlayerProps>(
(allProps, forwardedRef) => {
let { style, className, children, asset, poster, blurDataURL, onPlaying, onLoadStart, ...rest } = allProps;
let { style, className, children, asset, poster, posterFetchPriority="auto", blurDataURL, onPlaying, onLoadStart, ...rest } = allProps;

const slottedPoster = Children.toArray(children).find((child) => {
return typeof child === 'object' && 'type' in child && (child.props as any).slot === 'poster';
Expand Down Expand Up @@ -137,6 +137,7 @@ const BackgroundPlayer = forwardRef<HTMLVideoElement, Omit<MediaProps, 'ref'> &
hidden={posterHidden}
decoding="async"
aria-hidden="true"
fetchPriority={posterFetchPriority}
/>
)}
<div className="next-video-bg-text">{children}</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/players/default-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const DefaultPlayer = forwardRef<HTMLVideoElement, Omit<MediaProps, 'ref'> & Pla
asset,
controls = true,
poster,
posterFetchPriority = 'auto',
blurDataURL,
theme: Theme = Sutro,
...rest
Expand Down Expand Up @@ -96,6 +97,7 @@ const DefaultPlayer = forwardRef<HTMLVideoElement, Omit<MediaProps, 'ref'> & Pla
style={imgStyleProps}
decoding="async"
aria-hidden="true"
fetchPriority={posterFetchPriority}
/>
);
poster = '';
Expand Down
5 changes: 5 additions & 0 deletions src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ export type PlayerProps = {
*/
poster?: StaticImageData | string;

/**
* The poster image fetch priority for the video.
*/
posterFetchPriority?: 'high' | 'low' | 'auto';

/**
* Set a manual data URL to be used as a placeholder image before the poster image successfully loads.
* For imported videos this will be automatically generated.
Expand Down