Open j2is opened 2 years ago
This is the temporary fix I'm using 😢
videoRef.current.querySelector('video').setAttribute('playsinline', '')
const MuxVideo = (props) => {
const { className, video } = props
const styles = useStyles()
const videoRef = useRef()
useEffect(() => {
if (videoRef.current) {
videoRef.current.querySelector('video').setAttribute('playsinline', '')
}
}, [])
if (!video?.video) return null
return (
<div className={cn(className || null, styles.videoContainer)} ref={videoRef}>
<SanityMuxPlayer
assetDocument={video.video}
className={styles.video}
autoload
autoplay
muted
loop
width='100%'
showControls={false}
poster
/>
</div>
)
}
Add a playsinline prop for autoplay on iOS