import {usePlayerStore} from '@common/player/hooks/use-player-store'; import clsx from 'clsx'; import {HTMLAttributes, ReactElement} from 'react'; interface Props extends HTMLAttributes { hideDuringPlayback?: boolean; fallback?: ReactElement; } export function PlayerPoster({ className, hideDuringPlayback = true, fallback, ...domProps }: Props) { const posterUrl = usePlayerStore(s => s.posterUrl); const shouldHidePoster = usePlayerStore( s => hideDuringPlayback && s.playbackStarted && s.providerName !== 'htmlAudio', ); if (!posterUrl && !fallback) return null; return (
{posterUrl ? ( ) : ( fallback )}
); }