start loading youtube just before it appears on the screen

This commit is contained in:
rimu 2024-09-07 12:41:51 +12:00
parent 760477f00c
commit 93e3b95362

View file

@ -46,6 +46,8 @@ function setupYouTubeLazyLoad() {
videoObserver.unobserve(videoWrapper); videoObserver.unobserve(videoWrapper);
} }
}); });
}, {
rootMargin: "0px 0px 300px 0px" // Preload when 300px away from the viewport
}); });
lazyVideos.forEach((video) => { lazyVideos.forEach((video) => {