import { useEffect, useRef } from 'react' import Hls from 'hls.js' import { injectGlobal } from '@emotion/css' import { isIOS, isSafari } from '@/web/utils/common' import { motion } from 'framer-motion' injectGlobal` .plyr__video-wrapper, .plyr--video { background-color: transparent !important; } ` const VideoCover = ({ videoCover }: { videoCover?: string }) => { const ref = useRef(null) const hls = useRef(new Hls()) useEffect(() => { if (videoCover && Hls.isSupported()) { const video = document.querySelector('#video-cover') as HTMLVideoElement hls.current.loadSource(videoCover) hls.current.attachMedia(video) } }, [videoCover]) return ( {isSafari ? ( ) : (
)}
) } export default VideoCover