in src/components/BannerVideo/index.tsx [16:48]
export default function BannerVideo(props: BannerVideoProps) {
const [isShowVideo, setIsShowVideo] = useState(false);
const videoURL = 'https://streampark.apache.org/quickstart.mp4';
const coverImage = useBaseUrl('/home/screenshot.png');
function handleClick() {
setIsShowVideo(!isShowVideo);
}
return (
<div
className={clsx('BannerVideo relative h-full', props.className)}
style={props.style}
>
{isShowVideo ? (
<video
src={videoURL}
className="h-full w-full object-fill"
autoPlay
/>
) : (
<img
src={coverImage}
alt="dashboard screenshot"
className="h-full w-full object-fill"
/>
)}
<VideoController isPlaying={isShowVideo} onClick={handleClick} />
</div>
);
}