Skip to content

Conversation

@scottjehl
Copy link

@scottjehl scottjehl commented Dec 2, 2025

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.

Addresses #10376

(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
Copy link
Member

annevk commented Dec 4, 2025

cc @whatwg/media


<li><p>If <var>resumptionSteps</var> is null, then return.</p></li>

<li><p>Set the <code>video</code>'s <span>lazy load resumption steps</span> to null.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

Where is video's lazy load resumption steps set to a non-null value? Is a call to "start intersection-observing a lazy loading element" needed somewhere to make it all work?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for this. I'll be following up shortly with a commit that'll define these steps in a few areas relevant to video (fetching, autoplay, poster, preload).

Copy link
Author

Choose a reason for hiding this comment

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

@foolip Thanks again. In the latest commit to this PR, I've attempted to fill in missing steps when loading state is lazy when evaluating poster, autoplay eligibility, video resource fetching, and the steps to resume when loading state changes to eager. Happy to iterate further with any guidance you might have.

@foolip
Copy link
Member

foolip commented Dec 9, 2025

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.
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 needs implementer interest Moving the issue forward requires implementers to express interest needs tests Moving the issue forward requires someone to write tests topic: media

Development

Successfully merging this pull request may close these issues.

3 participants