amp-story-player is currently loading all iframes in an eager way. After the first amp-story-player element is intersected, all the following players and their iframes are loaded at once.
There could be performance benefits by using Chromium-based browsers' native support for lazy loading iframes. The loading="lazy" attribute could be set on each iframe via the buildIframeFor_ method in amp-story-player-impl.js like this:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
Description
amp-story-player is currently loading all iframes in an eager way. After the first amp-story-player element is intersected, all the following players and their iframes are loaded at once.
There could be performance benefits by using Chromium-based browsers' native support for lazy loading iframes. The
loading="lazy"
attribute could be set on each iframe via thebuildIframeFor_
method inamp-story-player-impl.js
like this:Understanding that maybe not everybody wants their iframes to have lazy loading, could this be implemented as an optional parameter?
Alternatives Considered
No feasible alternatives that I can think of
Additional Context
No response