diff --git a/ui/shared/nft/NftMedia.tsx b/ui/shared/nft/NftMedia.tsx index a67bdf7231..cc572fce4e 100644 --- a/ui/shared/nft/NftMedia.tsx +++ b/ui/shared/nft/NftMedia.tsx @@ -72,7 +72,7 @@ const NftMedia = ({ imageUrl, animationUrl, className, isLoading, withFullscreen switch (type) { case 'video': - return ; + return ; case 'html': return ; case 'image': diff --git a/ui/shared/nft/NftVideo.tsx b/ui/shared/nft/NftVideo.tsx index 3ffc51c27b..6a3a710dfa 100644 --- a/ui/shared/nft/NftVideo.tsx +++ b/ui/shared/nft/NftVideo.tsx @@ -5,22 +5,37 @@ import { mediaStyleProps, videoPlayProps } from './utils'; interface Props { src: string; + poster?: string; autoPlay?: boolean; onLoad: () => void; onError: () => void; onClick?: () => void; } -const NftVideo = ({ src, autoPlay = true, onLoad, onError, onClick }: Props) => { +const NftVideo = ({ src, poster, autoPlay = true, onLoad, onError, onClick }: Props) => { + const ref = React.useRef(null); + + const handleMouseEnter = React.useCallback(() => { + !autoPlay && ref.current?.play(); + }, [ autoPlay ]); + + const handleMouseLeave = React.useCallback(() => { + !autoPlay && ref.current?.pause(); + }, [ autoPlay ]); + return ( );