FAST VIDEOHero loops, YouTube embedsA hero video or a few YouTube embeds can make a page feel alive. They can also be the heaviest things on it, mostly before anyone presses play. The fix is deciding what loads first, what waits for a click and what visitors see meanwhile.
Why does a YouTube embed slow the page down?
Because the standard embed loads YouTube's player with the page, whether or not anyone watches. web.dev notes that many popular embeds include over 100 KB of JavaScript, sometimes up to 2 MB, and puts the saving from lazy loading a YouTube embed at about 500 KB on the initial page load.
loading="lazy" on the iframe holds it back until it nears the viewport, which helps embeds further down, although web.dev warns browser lazy-loading can be inconsistent.
What is a video facade?
A facade is a poster image with a play button that looks like the player; the real player loads only on click. web.dev calls this the import on interaction pattern: show the facade when the page loads, preconnect to the provider when the pointer moves over it, and swap in the real embed on click.
web.dev recommends lite-youtube-embed, used as a <lite-youtube> tag, or you can build your own. The one on this site uses a poster that is also a plain link to the video on YouTube, so it works even if the script fails.
Chrome's documentation warns that autoplay may not work consistently for lazily loaded videos, so test the first tap on a phone. web.dev also advises facades only for secondary content, so critical content still gets indexed.
Does youtube-nocookie.com make an embed private?
More private, not invisible. YouTube's help says privacy-enhanced mode keeps views of an embedded video from personalising the viewer's YouTube experience or ads outside your site, and any ads on the video are non-personalised. To turn it on, change the embed domain to www.youtube-nocookie.com.
The help page doesn't promise that nothing is stored, and a visitor who clicks out may be tracked under the destination's policies. The domain also doesn't change when the player loads, so pair it with a facade.
How do you add a hero video loop that stays fast?
Host a short, silent, compressed file yourself in a <video> element. The attributes do most of the work:
muted, or no audio track: MDN says autoplay blocking doesn't apply to inaudible video, and Chrome always allows muted autoplay.playsinline: web.dev says it is necessary for autoplay on iOS.- WebM, then MP4: browsers take the first source they can play, so list your preferred format first.
poster: without one, MDN notes, nothing displays until the first frame is available.preload: autoplay overrides it, so it matters for click-to-play videos, where web.dev callspreload="none"the best way to avoid early downloads.
web.dev's reduced-motion guidance includes not autoplaying videos, so we start the loop only when the visitor hasn't asked for less motion; anyone who has sees the poster. Our animation guide covers that setting. WCAG 2.2.2 Pause, Stop, Hide (Level A) also asks for a way to pause motion that starts automatically, lasts over five seconds and sits beside other content, so loops get a pause button.
<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">
<video id="hero" muted loop playsinline poster="/hero.webp" width="1280" height="720">
<source src="/hero.webm" type="video/webm">
<source src="/hero.mp4" type="video/mp4">
</video>
<script>
if (matchMedia('(prefers-reduced-motion: no-preference)').matches) {
document.getElementById('hero').play();
}
</script>Will a hero video hurt Largest Contentful Paint?
It can, if the video is the largest thing on the first screen. web.dev lists <video> among the elements LCP considers, timed by the poster's load or the first frame, whichever comes first. If both are slow, so is your LCP.
When the video is the LCP candidate, web.dev recommends preloading the poster with fetchpriority="high", since the poster attribute can't take a fetch priority, and not lazy-loading the video. That is the example's first line.
Keep the headline as real HTML text, not burned into the footage, so it shows on the first paint. Chromium also skips full-viewport elements as likely background, so a full-screen video may not count and the LCP falls to the next largest element, such as that headline.
Do website videos need captions?
Yes, if they have speech or meaningful sound. WCAG 1.2.2 Captions (Prerecorded), at Level A, requires captions for prerecorded audio in video, and W3C's Understanding page says captions identify who is speaking and include meaningful sound effects. Criterion 1.2.3, also Level A, asks for audio description or a full text alternative of what the video shows.
On YouTube, upload captions or edit the automatic ones, which YouTube's help says are machine-generated and should always be reviewed. Self-hosted video takes a <track kind="captions"> element with a WebVTT file. MDN also recommends a transcript, for people who need more time.
Where to start
- Swap each YouTube iframe for a facade on youtube-nocookie.com.
- Give hero loops
muted,playsinline, a poster, WebM and MP4 sources, a reduced-motion check and a pause button. - Keep the headline as live text that shows before the video starts.
- Caption every video with speech, and review automatic captions.
Test in PageSpeed Insights before and after. A website review covers video alongside your other speed issues, and our SEO, speed and AI search service makes the fixes.
FAQ
Frequently asked questions
Should our homepage YouTube video autoplay?
We advise against it. YouTube's help says autoplayed embeds don't increment video views, and its developer docs say autoplay starts playback data collection and sharing as the page loads. Browsers also usually block autoplay with sound until the visitor has interacted with the site. A poster with a clear play button is lighter and leaves the choice with the visitor.
Can we stop YouTube showing other channels' videos after ours?
Not completely. YouTube's player parameter docs say related videos can no longer be turned off. With rel=0, the related videos come from the same channel as the video that just played, so from your channel if the video is yours. If you need full control over what appears when the video ends, host it yourself in a <video> element.
Can we remove the YouTube logo from an embedded video?
Not with a player setting. The modestbranding parameter is deprecated and has no effect. YouTube's developer docs say the player now decides its branding from the player size, other parameters such as controls, and further signals. The docs also require embedded players to be at least 200 by 200 pixels. For a player with only your branding, self-host the video.
How do we turn captions on by default in a YouTube embed?
Add cc_load_policy=1 to the embed URL. YouTube's docs say this shows captions by default, even if the viewer has turned captions off. Add cc_lang_pref with a language code, such as fr, to choose the caption language. The video still needs a caption track, so upload or review its captions in YouTube Studio first.
Why does our embedded YouTube video show error 153?
Most likely because the request to YouTube arrives without an HTTP Referer. YouTube's help says its terms require embedders to send one, and playback is blocked with error 153 when it is missing. Check that your site or facade script doesn't set a Referrer-Policy that suppresses it; YouTube's developer docs recommend strict-origin-when-cross-origin, which is already the default in many browsers.
Should we host our videos on YouTube or on our own server?
It depends on the video. We self-host short, silent hero loops, because a <video> element needs no third-party player. For longer videos with speech we usually use YouTube behind a facade, which keeps the page light until someone presses play and gives you YouTube's caption tools. Either way, the poster, captions and headline rules stay the same.

