Skip to content
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

Poster images for videos outside viewport should be lazy-loaded #1591

Closed
westonruter opened this issue Oct 15, 2024 · 2 comments · Fixed by #1596
Closed

Poster images for videos outside viewport should be lazy-loaded #1591

westonruter opened this issue Oct 15, 2024 · 2 comments · Fixed by #1596
Assignees
Labels
[Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@westonruter
Copy link
Member

When a VIDEO with a poster is outside the viewport, the poster image will be downloaded with a medium priority even though the element is not visible:

Image

This being the case, the poster should ideally be lazy-loaded when the video nears the viewport using IntersectionObserver.

Related:

@westonruter westonruter added [Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature labels Oct 15, 2024
@github-project-automation github-project-automation bot moved this to Not Started/Backlog 📆 in WP Performance 2024 Oct 15, 2024
@westonruter westonruter changed the title Poster image for videos outside viewport should be lazy-loaded Poster images for videos outside viewport should be lazy-loaded Oct 15, 2024
@westonruter
Copy link
Member Author

westonruter commented Oct 15, 2024

As noted in #10 (comment), the video element's initial dimensions are set to match the poster image's intrinsic dimensions when no width and height are specified. However, if we are setting the width and height based on gathered client-side metrics, lazily-supplying the poster shouldn't cause any layout shift.

@swissspidy
Copy link
Member

This would be a big win. Even with preload=none, the browser always downloads the poster image right now, even if it's way outside the viewport.

@swissspidy swissspidy self-assigned this Oct 16, 2024
@swissspidy swissspidy moved this from Not Started/Backlog 📆 to Code Review 👀 in WP Performance 2024 Oct 16, 2024
@westonruter westonruter added this to the image-prioritizer n.e.x.t milestone Oct 18, 2024
@github-project-automation github-project-automation bot moved this from Code Review 👀 to Done 😃 in WP Performance 2024 Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature
Projects
Status: Done 😃
Development

Successfully merging a pull request may close this issue.

2 participants