Media Optimization for the Web

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

This is the browser home of the topic. The backend produces optimized variants, see Media Optimization for the backend, and native apps consume them with the libraries in Media Optimization in apps. This sub-section is the other half of the backend: how a web page asks for the right variant, shows something useful while it loads, and plays video that adapts to the connection. It is current as of 2026-10-07, and each page names the versions it was checked against.

Deliberately out of scope. This section is about what the browser does with media that already exists in the right variants. The following topics appear in most web performance and responsive design books but live elsewhere on this site, or are intentionally not covered:

  • Producing the variants (encoding, formats, upload pipelines, thumbnails) — see Media Optimization for the backend and upload pipelines.

  • Layout, fluid grids and CSS media queries — see HTML and CSS; only the image attributes and aspect-ratio that prevent layout shift are repeated here.

  • General loading performance and Core Web Vitals tuning (fonts, scripts, caching headers) — see HTML and CSS: Performance and Loading.

  • Accessibility of media (alt text, captions, reduced motion) — see Accessibility.

  • Live and real-time video (WebRTC, WebSockets) — see WebRTC and WebSockets; this section covers on-demand playback only.

  • DRM and licence servers — the players support Widevine, PlayReady and FairPlay, but key delivery is not covered.

  • Native and cross-platform apps — see Media Optimization in apps.

  • Managed image and video services — see AWS, Google Cloud and Azure.

flowchart LR API["API response: variants, width, height, blurhash"] --> H["HTML: picture, srcset, sizes, width, height"] API --> P["Placeholder: BlurHash decoded to 32 px"] H --> L["Lazy loading, fetchpriority for the LCP image"] P --> L L --> D["Decoded image replaces the placeholder"] API --> V["Video: poster plus HLS or DASH manifest"] V --> PL["Player: hls.js, Shaka Player, native HLS"]

What’s covered

Page What it covers

Native HTML Images and Lazy Loading

img with srcset, sizes, width and height, decoding, picture with AVIF and WebP, loading lazy, fetchpriority, and the video element.

BlurHash in the Browser

Decoding into a canvas or data URL, react-blurhash, unlazy, punch, ThumbHash and server-side placeholders.

Next.js Image

sizes and fill, placeholder blur with a BlurHash, custom loaders for image CDNs, formats and remotePatterns, and preload replacing priority.

React Image Libraries

react-lazyload, react-image, react-lazy-load-image-component, an IntersectionObserver hook, and a recommendation table with status.

Angular NgOptimizedImage

ngSrc, priority, placeholder, built-in loaders, a custom loader and BlurHash with the blurhash package.

Video Playback and Streaming

The video element, native HLS, hls.js, dash.js, Shaka Player, Video.js, Media Source Extensions and ManagedMediaSource.

Cheat Sheet (PDF)

A one-page summary of attributes, loaders, placeholder code and players.

Bibliography

Every source below is the official site, repository or documentation page of the library, service or standard it supports. Links were checked from an authoring environment with restricted outbound access. Entries marked (unverified) could not be opened from there (the site refused or blocked the request), so open them and confirm the content, version and status before you rely on them. Entries without the mark were opened successfully, or, for package pages, confirmed through the package registry.

BlurHash and placeholders

Next.js and image CDNs

React

Video players and streaming