VionetoVioneto
Back to the magazine

VIONETO MAGAZINE Playback & technology

Check whether a video sets Largest Contentful Paint

Find out whether a video, its poster or another visible element sets Largest Contentful Paint. Two local Chrome cases show what to look for.

A large video area on a web page is highlighted next to a clock.
Largest Contentful Paint records when the largest eligible visible content is presented during page load.Image: Vioneto · original illustration

A support page places a large video above the written instructions. If the page feels slow on arrival, first check which element the browser reports for LCP. Largest Contentful Paint tracks when the largest eligible content in the visible area is presented during navigation. A prominent video can be that element.

Capture the candidate during page load

  1. Open the page in a visible tab at the viewport size you want to test. Record a fresh navigation in the browser’s performance tools and let it load without clicking or scrolling.
  2. Inspect the LCP entry, its element and the resource URL. For a native HTML video, Chrome can use either the poster or the first presented frame, according to which eligible event comes first.
  3. Keep the viewport, cache state and selected element with the timing. A page can report several candidates as larger content appears.

When testing a native HTML video in a local page, you can also log candidates with PerformanceObserver. The startTime field is the performance entry’s timestamp.

new PerformanceObserver(list => { for (const e of list.getEntries()) { console.log(e.element?.tagName, e.url, e.startTime, e.size) } }).observe({ type: "largest-contentful-paint", buffered: true })

Compare two setups in the same position

A local Chrome test used the same video area in two pages. With a poster and preload="none", the entry named VIDEO and the poster file. With muted autoplay and no poster, it named VIDEO and the MP4 file. This test observed candidate selection under those conditions.

If the poster is the candidate, start by checking the delivered image size and when its request starts. If the trace points to the video file, look at its request and first visual output. If a heading or another image is the candidate, investigate that element. For a hosted iframe player, the observer in the parent page does not include elements within the frame. Account for that scope when you interpret the numbers.

Reserve player space and prevent layout shifts

When delaying a video load helps the page

Topics

Sources and further reading

  1. https://web.dev/articles/lcp
  2. https://www.w3.org/TR/largest-contentful-paint/