Skip to content

Add support for video and audio element lazy-loading via the loading attribute - #11980

Merged
zcorpan merged 21 commits into
whatwg:mainfrom
Squarespace:video-loading-attribute
Mar 23, 2026
Merged

Add support for video and audio element lazy-loading via the loading attribute#11980
zcorpan merged 21 commits into
whatwg:mainfrom
Squarespace:video-loading-attribute

Conversation

@scottjehl

@scottjehl scottjehl commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

Specify support for the loading attribute for the video element and audio element using similar conventions to img and iframe, where the attribute already has precedent. Loading has possible values of eager and lazy. When a media element's loading attribute value is lazy, loading of any video or poster image data, as well as autoplay playback, will defer until layout is known and the video is in the viewport.

Note Jan 22, 2026: Broadening PR to include Audio Element support.

Fixes #10376
Fixes #6636

(See WHATWG Working Mode: Changes for more details.)


/acknowledgements.html ( diff )
/indices.html ( diff )
/media.html ( diff )
/urls-and-fetching.html ( diff )

Specify support for the loading attribute for video using similar conventions
to img and iframe, where the attribute has precedent. It has possible values
of eager and lazy. When the loading attribute value is lazy, loading of any
video or poster image data, as well as autoplay playback, must defer until
layout is known and the video is in the viewport. This commit contains examples
for how the loading attribute should take precedence over the preload, poster,
and autoplay attributes. These were informed by experiments with local patch
implementations to several user agents.
@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: media needs tests Moving the issue forward requires someone to write tests labels Dec 4, 2025
@annevk

annevk commented Dec 4, 2025

Copy link
Copy Markdown
Member

cc @whatwg/media

Comment thread source Outdated
@foolip

foolip commented Dec 9, 2025

Copy link
Copy Markdown
Member

This direction makes sense to me, but I'm not personally able to make a commitment to implement in Chromium.

@zcorpan I think you've mentioned this feature, perhaps you have feedback?

Add detail for video element lazy loading behavior when loading state is lazy.
This involves returning early to prevent poster and video data loading and
defining resumption steps to resume when loading state changes to eager. Also
includes notes about autoplay eligibility and precedence over the preload attribute.
Comment thread source Outdated
Adjust language of this statement about precedence of the loading
attribute over the preload attribute so that it reiterates a fact.
Remove mention as audio is not mentioned in this proposed attribute addition
scottjehl added a commit to Squarespace/wpt that referenced this pull request Jan 7, 2026
…g attribute

These tests support the proposal for the addition of a loading attribute
on the video element, designed to enable lazy-loading for video and poster
data. HTML Standard PR here whatwg/html#11980

Co-authored-by: Zach Lysobey <zlysobey@squarespace.com>
Co-authored-by: Brad Frost <bfrost@squarespace.com>
Co-authored-by: Credo Duarte <cduarte@squarespace.com>
@scottjehl

Copy link
Copy Markdown
Contributor Author

Added and linked up a PR with web platform tests web-platform-tests/wpt#57051

small note: it says my entity is unverified above, but I think it's registered correctly now and needs a check

Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
@zcorpan zcorpan removed needs implementer interest Moving the issue forward requires implementers to express interest needs tests Moving the issue forward requires someone to write tests labels Jan 14, 2026
@scottjehl
scottjehl requested a review from zcorpan January 14, 2026 17:41
@zcorpan

zcorpan commented Jan 15, 2026

Copy link
Copy Markdown
Member

@scottjehl I tried to push changes to this branch but was denied. Can you enable "Allow edits from maintainers"?

@scottjehl

Copy link
Copy Markdown
Contributor Author

@zcorpan I looked into how to do that and it sounds like the option may not be available for forks made by an organization, such as this one. Any other way we can help? Perhaps if the changes are in a public fork of yours I could pull them from there?

@zcorpan

zcorpan commented Jan 16, 2026

Copy link
Copy Markdown
Member

@scottjehl OK, pushed to https://github.com/zcorpan/html/tree/video-loading-attribute

@scottjehl

Copy link
Copy Markdown
Contributor Author

@zcorpan looked great, thanks. Merged here!

Comment thread source Outdated
@scottjehl

Copy link
Copy Markdown
Contributor Author

Made a PR with 2 tests to support the recent revisions to this proposal about load() method precedence over the loading attribute. web-platform-tests/wpt#58455

@scottjehl

Copy link
Copy Markdown
Contributor Author

Comment on the Webkit standards position ticket WebKit/standards-positions#586 (comment) from Igalia :

We (Igalia) support this and propose to mark as supported and close.

@cwilso cwilso added stage: 3 Committed and removed stage: 2 Iteration labels Mar 12, 2026
Comment thread source Outdated

@zcorpan zcorpan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % comment above.

@scottjehl

Copy link
Copy Markdown
Contributor Author

Thanks @zcorpan !

@scottjehl

Copy link
Copy Markdown
Contributor Author

Small update: MDN's content appears to be ready, pending this proposal moving to Stage 4. mdn/content#43434

Are there any steps I can help with on my end at this point? Thank you!

@zcorpan

zcorpan commented Mar 23, 2026

Copy link
Copy Markdown
Member

This now has support from Gecko, WebKit, and Chromium, as far as I can tell. All boxes are ticked. I think this is ready for stage 4, i.e., be merged.

@zcorpan
zcorpan merged commit 489e0b6 into whatwg:main Mar 23, 2026
2 checks passed
@zcorpan zcorpan added stage: 4 Standard and removed stage: 3 Committed labels Mar 23, 2026
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jun 24, 2026
…o elements. r=dom-core-reviewers,media-playback-reviewers,webidl,layout-reviewers,smaug,emilio,pehrsons,alwu

Add support for the `loading` attribute on <video> and <audio>
elements, mirroring the existing behavior for <img> and <iframe>. The
attribute accepts `eager` (default) and `lazy`. When `loading="lazy"`
is set, loading of the media resource and poster image, as well as
autoplay, is deferred via an intersection observer until the element is
near the viewport. Gated behind the media.lazy_loading.enabled pref.

Spec: https://html.spec.whatwg.org/multipage/media.html#attr-media-loading
Spec PR: whatwg/html#11980

Co-authored-by: Scott Jehl <sjehl@squarespace.com>

Differential Revision: https://phabricator.services.mozilla.com/D278547
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jun 29, 2026
…o elements. r=dom-core-reviewers,media-playback-reviewers,webidl,layout-reviewers,smaug,emilio,pehrsons,alwu,keithamus

Add support for the `loading` attribute on <video> and <audio>
elements, mirroring the existing behavior for <img> and <iframe>. The
attribute accepts `eager` (default) and `lazy`. When `loading="lazy"`
is set, loading of the media resource and poster image, as well as
autoplay, is deferred via an intersection observer until the element is
near the viewport. Gated behind the media.lazy_loading.enabled pref.

Spec: https://html.spec.whatwg.org/multipage/media.html#attr-media-loading
Spec PR: whatwg/html#11980

Co-authored-by: Scott Jehl <sjehl@squarespace.com>

Differential Revision: https://phabricator.services.mozilla.com/D278547
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jul 10, 2026
…o elements. r=dom-core-reviewers,media-playback-reviewers,webidl,layout-reviewers,smaug,emilio,pehrsons,alwu,keithamus

Add support for the `loading` attribute on <video> and <audio>
elements, mirroring the existing behavior for <img> and <iframe>. The
attribute accepts `eager` (default) and `lazy`. When `loading="lazy"`
is set, loading of the media resource and poster image, as well as
autoplay, is deferred via an intersection observer until the element is
near the viewport. Gated behind the media.lazy_loading.enabled pref.

Spec: https://html.spec.whatwg.org/multipage/media.html#attr-media-loading
Spec PR: whatwg/html#11980

Co-authored-by: Scott Jehl <sjehl@squarespace.com>

Differential Revision: https://phabricator.services.mozilla.com/D278547
PaulKinlan added a commit to PaulKinlan/gendn that referenced this pull request Aug 9, 2026
First page of the weekly MDN-upgrade backlog (133 old-shape pages). The
old page was static prose with a hand-written support table, no Baseline
banner, no live example, and plain-text citations. In-place upgrade,
identity and lede preserved:

- Baseline banner from webstatus.dev (loading-lazy-media, Baseline
  'limited': Chrome/Chrome Android 150, Edge 150, no Firefox/Safari).
- Formal Syntax section: keyword/state grammar from the merged HTML
  Standard (whatwg/html#11980 has landed since the page was written; all
  spec links re-pointed from the PR to media.html#attr-media-loading) plus
  the verbatim IDL line ([CEReactions] attribute DOMString loading; on
  HTMLMediaElement) and the limited-to-known-values reflection contract.
- Real per-version BCD compat table (html.elements.video.loading /
  audio.loading): Chrome 150 full, 148-149 partial (not for <source>,
  crbug 514611050), Edge/Chrome Android via mirror + webstatus dates,
  Firefox/Safari not-supported rows with tracking bugs + positions.
- Live showcase demo embedded (scroll-detector concept, HEAD-checked 200);
  all five live concept routes linked; stale '(when built)' text removed.
- Warn-block reframed honestly: documents the v147 dev-trial stage with
  the real flag (LazyLoadVideoAndAudio) and the shipped 148/150 timeline.
- Behavior/lifecycle, invalid-value defaults, security/privacy sections
  added; every citation now links its artifact directly.
- New reference-contract.json (implementation-sufficient, 2 items x 9
  dimensions) and _questions.json (guidanceConsulted: css-layout,
  accessibility, optimize-image-priority).

Verified: suite 19 pass / 0 fail / 5 blocked; responsive matrix desktop:ok
mobile:ok (screenshots read); validate-artifacts + test-reference-contract
+ check-routes PASS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TxJjQpAcTzXzR2XW5TVJQp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition/proposal New features or enhancements stage: 4 Standard topic: media

Development

Successfully merging this pull request may close these issues.

Video and Audio Element loading=lazy attribute support Lazy loading video element poster attribute

10 participants