-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add support for video element lazy-loading via the loading attribute #11980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
|
cc @whatwg/media |
|
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.
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
…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 <[email protected]> Co-authored-by: Brad Frost <[email protected]> Co-authored-by: Credo Duarte <[email protected]>
|
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 |
|
@scottjehl I tried to push changes to this branch but was denied. Can you enable "Allow edits from maintainers"? |
|
@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 looked great, thanks. Merged here! |
|
Is there a reason why lazy loading affects video element only, but not HTMLAudioElement? |
|
It’s a good question. I agree that audio too should gain this behavior but we thought that there’s enough nuance with video alone that it was worth addressing audio afterwards, and at that point, several steps could presumably move to htmlmediaelement to work for both. I’m interested in helping on that followup if so.
|
|
Wouldn't it be easier (and would also keep things more consistent) if this was dealing with media element from the beginning? |
Specify support for the loading attribute for the video element using similar conventions to img and iframe, where the attribute already has precedent. Loading has possible values of eager and lazy. When the video element's 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.
Resolves #10376
(See WHATWG Working Mode: Changes for more details.)
/acknowledgements.html ( diff )
/indices.html ( diff )
/media.html ( diff )
/urls-and-fetching.html ( diff )