Google Chrome’s new native video and audio lazy loading could make the web faster

Wait 5 sec.

Google Chrome and other Chromium-based browsers, including Edge and Vivaldi, could soon get native support for video and audio lazy loading. This change has been proposed by Helmut Januschka, an independent developer known for his past contributions to Chromium.The lazy loading feature has been around for years in Chrome, but until now, native support was limited to elements like images and iframes, not video and audio. That changes soon, as Chromium-based browsers will natively support lazy loading for video and audio, and this could make the web faster, especially if you browse web pages with a lot of media.For those unaware, when you lazy-load an image or video on a website, and visit it in Chrome or any browser, it does not fetch or fully initialize the media the moment the browser renders the page. Videos or images are only loaded when they are visible near you, either when you scroll to the region where a video is embedded.Without lazy loading, Chrome may load media much earlier, which means the website would be much slower, as the browser first needs to download everything on the page. With loading=”lazy”, Chrome does not load or download the video until you actually reach the region where it’s embedded. If you don’t scroll that far, the media may never be loaded.Most sites already lazy load videos or audio using JavaScript, which works well, but it’s not the best practice for performance, as it does not integrate well with browser’s native preload scanner and built-in loading heuristics.“Without native support, developers must implement custom JavaScript solutions using Intersection Observer to detect when media elements enter the viewport and then dynamically set the src attribute,” wrote developer Helmut Januschka in a post on Chrome status. “This approach is error-prone, adds complexity, and cannot integrate with the browser’s preload scanner.”As first spotted by Windows Latest, Helmut Januschka’s solution is to add full-fledged native lazy loading for video and audio to Chromium, similar to how it’s already integrated for images and iframes.When this feature rolls out in Chrome stable, developers can begin using an HTML attribute instead: loading=”lazy” directly on or .This means the video and audio will natively lazy load as opposed to relying on JavaScript, which can be a bottleneck or not play well with Chrome’s preload scanner.“Native lazy loading allows the browser to optimize resource loading with network-aware thresholds, properly handle the interaction with autoplay and preload attributes, and avoid blocking window.onload for offscreen media,” Januschka noted.“This matches the existing lazy loading behavior for and elements, improving page load performance and reducing data usage,” Januschka explained in his proposal.Windows Latest found that Chromium first implemented native lazy loading for and in January, then the change landed in February, and it finally moved to the shipping process at the end of March.Now, there’s a new CL that enables the feature by default for stable builds, and suggests that the feature is close to broader release in Chrome 148.The post Google Chrome’s new native video and audio lazy loading could make the web faster appeared first on Windows Latest