현재 크롬을 제외한 대부분의 브라우저에서 지원 X
const [isWifi, setIsWifi] = useState<null | boolean>(false);
useEffect(() => {
const connection = navigator.connection ||
navigator.mozConnection ||
navigator.webkitConnection || { type: null };
setIsWifi(connection.type === 'wifi');
}, []);
...
return (
<video
loop
muted
controls
playsInline={true}
preload="auto"
autoPlay={isWifi == null ? false : isWifi}
poster={moviePoster.src}
css={[tw`max-w-[920px] w-full`]}
tw="mx-auto"
>
<source
src=""
type="video/mp4"
/>
</video>
)
https://wicg.github.io/netinfo/
https://developer.mozilla.org/ko/docs/Web/API/Navigator/connection
https://caniuse.com/?search=navigator.connection