Skip to content

Add loading attribute for audio and video#43434

Merged
pepelsbey merged 20 commits intomdn:mainfrom
tunetheweb:lazy-load-media-content
Mar 27, 2026
Merged

Add loading attribute for audio and video#43434
pepelsbey merged 20 commits intomdn:mainfrom
tunetheweb:lazy-load-media-content

Conversation

@tunetheweb
Copy link
Copy Markdown
Contributor

@tunetheweb tunetheweb commented Mar 13, 2026

Description

We're adding loading=lazy to <audio> and <video> attributes!

Coming to Chrome in 147 (behind a flag): https://chromestatus.com/feature/5200068565139456

FYI: @scottjehl @hjanuschka

Motivation

More details:

https://scottjehl.com/posts/lazy-media/ (with a demo of it working)
https://www.januschka.com/chromium-video-lazy-loading.html

Additional details

Test results and supporting details
Audio:
https://wpt.fyi/results/html/semantics/embedded-content/the-audio-element?label=experimental&label=master&aligned

Video:
https://wpt.fyi/results/html/semantics/embedded-content/the-video-element?label=experimental&label=master&aligned

https://chromestatus.com/feature/5200068565139456

Implementation bugs:

Related issues and pull requests

Makes progress on: mdn/mdn#809

@tunetheweb tunetheweb requested review from a team as code owners March 13, 2026 19:08
@tunetheweb tunetheweb requested review from hamishwillee and removed request for a team March 13, 2026 19:08
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs Content:Learn Learning area docs Content:Performance Web performance docs size/m [PR only] 51-500 LoC changed labels Mar 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

Thanks @tunetheweb . I'd prefer to wait until BCD data is accepted before we merge this. Otherwise it is not obvious that this feature is not actually avaiable on any browser.

Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

A few nits added but this looks good. Won't mark as approved until BCD goes in, because otherwise someone is likely to merge prematurely.

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
@tunetheweb
Copy link
Copy Markdown
Contributor Author

Thanks Hamish! Hopefully that Spec PR gets merged soon and the rest of these PRs can fall like dominoes 😁

Also happy to convert this PR to draft in the meantime if that’s easier for you all.

@hamishwillee
Copy link
Copy Markdown
Collaborator

Thanks Barry. Yeah, I'll press that convert to draft button now.

If you don't mind doing this in two phases you can probably get this in without waiting for the spec. Essentially BCD could go in without the spec and this would be "non-standard" - and then this PR could merge. Then when the spec goes in you'd update BCD and the docs would automatically update this to no longer be non-standard.

@hamishwillee hamishwillee marked this pull request as draft March 16, 2026 22:13
@tunetheweb
Copy link
Copy Markdown
Contributor Author

The spec PR is all but approved IIUC. To be honest I expected the review of both my PRs to take longer and that to be merged by the time this was finished! But you’re all too efficient! 😁

So will give it another few days. Of it drags on and the Chrome implementation lands then will reconsider as quite like having things documented when available. Then again if marked as “non-standard” then it might put some people off anyway!

@zcorpan
Copy link
Copy Markdown
Contributor

zcorpan commented Mar 23, 2026

The spec PR has now been merged.

@tunetheweb tunetheweb marked this pull request as ready for review March 23, 2026 16:05
Copy link
Copy Markdown
Member

@pepelsbey pepelsbey left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you 🙂

Just a small suggestion.

@tunetheweb tunetheweb marked this pull request as draft March 23, 2026 21:55
@tunetheweb
Copy link
Copy Markdown
Contributor Author

Thanks @pepelsbey ! @hamishwillee suggested above we want for the BCD PR to be merged first, which is probably a good idea. I probably should have left this in draft until that was done so put that back. Hopefully that one should be merged soon.

@pepelsbey
Copy link
Copy Markdown
Member

I changed the list of related PRs in the description to checklist. It usually helps to convey the message.

@scottjehl
Copy link
Copy Markdown
Contributor

This looks great. Still in draft? Is there a timeline on when it'll merge to MDN? Thanks.

@tunetheweb tunetheweb marked this pull request as ready for review March 27, 2026 18:11
@tunetheweb
Copy link
Copy Markdown
Contributor Author

BCD v7.3.9 was just released containing these changes. So think this is good to merge now!

If you could do the honours @hamishwillee or @pepelsbey ?

@pepelsbey pepelsbey merged commit 8db892b into mdn:main Mar 27, 2026
9 checks passed
@pepelsbey
Copy link
Copy Markdown
Member

Perfect! Thank you ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTML Hypertext Markup Language docs Content:Learn Learning area docs Content:Performance Web performance docs Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants