I'm creating a webpage and I have a mp4 video there:
<video class="video--app" id="myVideo" autoplay="" muted="" preload="auto">
<source src="./img/video.mp4" type="video/mp4">
</video>
I also wrote a part of JS code:
setTimeout(function(){
document.getElementById("myVideo").play();
}, 1500);
and that works almost ok, the video starts playing after 1,5 second. But I would like to change it and start playing video when it first appears on the screen - basically when user scrolls to it. Can you give me any hint how should I modify my JS code to achieve that? Thanks!