Autoplay an HTML <video>
element when it is scrolled into view with intersection observer api
let videoPlay = document.querySelector('.video-play-1');
let observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if(entry.intersectionRatio > 0){
videoPlay.play();
}
});
}, {threshold: 1});
observer.observe(videoPlay) ;