Hi,

I am trying to find a way to launch a HTML5 video player automatically as its container div (#video_post1) changes position along the y axis.
Basically it is inside a slider which slides the articles along the mentioned y axis.

I had no problem making it autoplay, but it starts playing in the background before it becomes visible, so it has to be triggered when it starts to roll in.

my autoplay code:


Code:
  <script>
       
      function callback () {
    document.querySelector('video').play();
        }

       window.addEventListener("load", callback, false);
     
    </script>    
  </head>

  
  
<body>
  <div id="video_post1">
<video poster preload="true" controls with="500" height="200">
  
  <source src="http://www.edmondvarga.com/demo/videos/video.mp4" type="video/mp4">
  

</video>
  </div>
    
    </body>
    </html>
Please help.
Best Regards