diff --git a/src/components/Histories.tsx b/src/components/Histories.tsx index a20a1c0..20bec09 100644 --- a/src/components/Histories.tsx +++ b/src/components/Histories.tsx @@ -45,6 +45,14 @@ function Histories() { trackMouse: true, }); + useEffect(() => { + if (!videoRefs[0].current?.src) return; + const width = videoRefs[0].current.clientWidth; + const height = videoRefs[0].current.clientHeight; + setVideoWidth(width); + setVideoHeigth(height); + }, [videoRefs[0]]); + function handleEnded() { if (selectedVideoIndex === VIDEOS.length - 1) { setSelectedVideoIndex(0); @@ -180,12 +188,12 @@ function Histories() { playsInline className="aspect-[9/16] object-cover w-full h-full min-w-screen" onEnded={handleEnded} - onLoadedData={() => - setTimeout(() => { - setVideoWidth(videoRefs[0].current!.clientWidth); - setVideoHeigth(videoRefs[0].current!.clientHeight); - }, 200) - } + // onLoadedData={() => + // setTimeout(() => { + // setVideoWidth(videoRefs[0].current!.clientWidth); + // setVideoHeigth(videoRefs[0].current!.clientHeight); + // }, 200) + // } />