<video> Largest Contentful Paint + Loading Issue
Unanswered
hu2299 posted this in #help-forum
hu2299OP
Hello,
So I have two issues with my video I display in my hero section which i cant seem to solve, would appreciate any advice:
- I get Largest Contentful Paint element 18,790 ms for my video element when i run a lighthouse analysis and not sure how to reduce the size, I've reduced the file size from 30mb to 7mb not sure what else to do to optimise.
- The video works fine when i initally load the website but when i change to another page via router.push() or <Link href={'/'} /> from my home page and then go back the video does not load and is just an empty div (This only happens on mobile)
Here is my code
So I have two issues with my video I display in my hero section which i cant seem to solve, would appreciate any advice:
- I get Largest Contentful Paint element 18,790 ms for my video element when i run a lighthouse analysis and not sure how to reduce the size, I've reduced the file size from 30mb to 7mb not sure what else to do to optimise.
- The video works fine when i initally load the website but when i change to another page via router.push() or <Link href={'/'} /> from my home page and then go back the video does not load and is just an empty div (This only happens on mobile)
Here is my code
<section style={{...}>
...
<video style={{zIndex: 1, position: 'absolute', borderRadius: 'var(--borderradius)', objectFit: 'cover', opacity: 0.8}} height='100%' width='100%' src='../vids/Tea.mp4' type="video/mp4" preload="auto" autoPlay={true} loop={true} controls={false} playsInline muted />
</section>2 Replies
Polar bear
You could add delay or compress the video for the Largest Contentful Paint.
Try setting the video page to 'use client'
Try setting the video page to 'use client'
hu2299OP
This didnt seem to have an effect on LCP or no rendering issues :/