@@ -177,7 +177,6 @@ export const SelfHostedVideo = ({
177177 const [ isPlayable , setIsPlayable ] = useState ( false ) ;
178178 const [ isMuted , setIsMuted ] = useState ( true ) ;
179179 const [ hasAudio , setHasAudio ] = useState ( true ) ;
180- const [ preloadPartialData , setPreloadPartialData ] = useState ( false ) ;
181180 const [ showPosterImage , setShowPosterImage ] = useState < boolean > ( false ) ;
182181 const [ currentTime , setCurrentTime ] = useState ( 0 ) ;
183182 const [ playerState , setPlayerState ] =
@@ -512,15 +511,6 @@ export const SelfHostedVideo = ({
512511 }
513512 } , [ isAutoplayAllowed , isInView , hasBeenInView ] ) ;
514513
515- /**
516- * We almost always want to preload some of the video data. If a user has prefers-reduced-motion
517- * enabled, then the video will only be partially preloaded (metadata + small amount of video)
518- * when it comes into view.
519- */
520- useEffect ( ( ) => {
521- setPreloadPartialData ( isAutoplayAllowed === false || ! ! isInView ) ;
522- } , [ isAutoplayAllowed , isInView ] ) ;
523-
524514 if ( adapted ) {
525515 return FallbackImageComponent ;
526516 }
@@ -689,6 +679,12 @@ export const SelfHostedVideo = ({
689679 ? getOptimisedPosterImage ( posterImage )
690680 : undefined ;
691681
682+ /**
683+ * We almost always want to preload some of the video data. If the video doesn't autoplay (e.g. user has prefers-reduced-motion
684+ * enabled), then the video will only be partially preloaded (metadata + small amount of video) when it comes into view.
685+ */
686+ const preloadPartialData = isAutoplayAllowed === false || ! ! isInView ;
687+
692688 return (
693689 < div
694690 css = { videoContainerStyles (
0 commit comments