It plays when you hover only after you click somewhere on the screen.
<video id="myVideo" poster="images/slide1.jpg"> <source src="videos/video1.mp4"> <a href="videos/video1.mp4">Скачайте видео</a>. </video> <script> window.onload = function(){ vid = document.getElementById('myVideo'); vid.addEventListener('mouseenter', function() { vid.play(); }); vid.addEventListener('mouseleave', function() { vid.pause(); }); } </script> Error in the console: Uncaught (in promise) DOMException: