Menu

Embed a Product Video Without Hurting Core Web Vitals
📰

Embed a Product Video Without Hurting Core Web Vitals

DEV Community: html·DemoVexa·9 days ago
#h7N0ckmp
#devto2#devto#dev#iframe#player
Long article (1195 words) — no AI summary yet.
Reading 0:00
15s threshold

You can embed a product video without hurting Core Web Vitals if you do three things: reserve its space so nothing shifts, load the player only when someone clicks, and treat the poster image like any other hero image. The video file itself is rarely the problem. The player script and the missing dimensions usually are.

Here is the setup I'd use, and how to check it.

Contents

Which Core Web Vitals does a video embed affect?

How do you stop the embed from shifting the layout?

How do you load a YouTube player only on click?

What about a video you host yourself?

How do you check that it worked?

Key takeaways

FAQ

Which Core Web Vitals does a video embed affect?

All three, in different ways. Layout shift (CLS) happens when the player box has no size until it loads. Largest Contentful Paint (LCP) suffers when the poster or player is the biggest thing above the fold and arrives late.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.