const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { loadVideo(entry.target); observer.unobserve(entry.target); } }); }); document.querySelectorAll('.video-container .placeholder').forEach(el => { observer.observe(el); });