My landing page uses a fullbleed (110vh/vw) video background that sites behind all the content on the website. This all works as intended but I’d like to improve the preformance of the First Contentful Paint when running a Lighthouse Test if possible.
Obviously a large video background is never going to be ideal and the scores aren’t too bad all things considered. But for context, the goal is for this to be an impactful landing page.
But it got me thinking, could the cover image display to improve the performance/score. Then the video is loaded/displayed when ready or a second later after the FCP?
The video does need to autoplay so that rules out preload="none"
.
What would be the best way to handle this? Am I missing something or would it need to be Javascript?
html {
background: black;
}
html,
body {
box-sizing: border-box;
color: white;
min-height: 100vh;
margin: 0;
padding: 32px;
width: 100%;
}
.video-bg {
height: 100vh;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
width: 100vw;
z-index: -1;
}
.video-bg video {
height: 100vh;
object-fit: cover;
opacity: .48;
width: 100vw;
}
.main {
margin: 0 auto;
max-width: 1200px;
}
<div class="video-bg">
<video autoplay loop muted playsinline poster="video/video-bg-poster.avif">
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4" width="1920" height="1080">
</video>
</div>
<div class="main">
<h2>Page Content</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</p>
<p>Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem
ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
</div>