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-ratiothat 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.
What’s covered
| Page | What it covers |
|---|---|
img with srcset, sizes, width and height, decoding, picture with AVIF and WebP, loading lazy, fetchpriority, and the video element. |
|
Decoding into a canvas or data URL, react-blurhash, unlazy, punch, ThumbHash and server-side placeholders. |
|
sizes and fill, placeholder blur with a BlurHash, custom loaders for image CDNs, formats and remotePatterns, and preload replacing priority. |
|
react-lazyload, react-image, react-lazy-load-image-component, an IntersectionObserver hook, and a recommendation table with status. |
|
ngSrc, priority, placeholder, built-in loaders, a custom loader and BlurHash with the blurhash package. |
|
The video element, native HLS, hls.js, dash.js, Shaka Player, Video.js, Media Source Extensions and ManagedMediaSource. |
|
A one-page summary of attributes, loaders, placeholder code and players. |
Related material on this site
-
HTML and CSS: Performance and Loading and Next.js: Images, Fonts and Scripts are the general references.
-
BlurHash: The Algorithm explains what the placeholder string contains.
-
Media Optimization in apps is the native and cross-platform counterpart.
-
Media Optimization for the backend is the server side that produces the variants this page requests.
-
Managed image and video services: AWS, Google Cloud and Azure.
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.
Native HTML, formats and performance
-
MDN ManagedMediaSource (unverified)
-
MDN putImageData (unverified)
-
MDN, fetchpriority attribute (unverified)
-
MDN, HTMLImageElement loading (unverified)
-
MDN, image file type and format guide (unverified)
-
MDN, Intersection Observer API (unverified)
-
MDN, responsive images (unverified)
-
Media Source Extensions (unverified)
-
web.dev, optimize Largest Contentful Paint (unverified)
-
web.dev, Cumulative Layout Shift (unverified)
-
MDN, the picture element (unverified)
-
MDN, PerformanceObserver (unverified)
-
MDN, getVideoPlaybackQuality (unverified)
BlurHash and placeholders
-
react-blurhash (unverified)
-
ThumbHash (unverified)
-
unlazy (unverified)
-
unlazy, placeholders guide (unverified)
Next.js and image CDNs
-
Cloudinary (unverified)
-
Image component reference (unverified)
-
imgix (unverified)
React
-
react-image (unverified)
-
react-lazy-load-image-component (unverified)
-
react-lazyload (unverified)
Angular
-
Angular image optimization guide (unverified)
-
NgOptimizedImage API reference (unverified)
Video players and streaming
-
dash.js (unverified)
-
dash.js, documentation (unverified)
-
hls.js (unverified)
-
hls.js, API documentation (unverified)
-
Shaka Player (unverified)
-
Shaka Player, basic usage tutorial (unverified)
-
Video.js (unverified)