Reputation: 445
i got a question if in jquery exists some event which allow me to play video instantly after my website is loaded. For now i using mousemove event, which works fine for now, but if i want add another layer on my website over my video content, it should not work.
$(function(){
var video = document.querySelector('#video1');
if(video){
video.addEventListener('mousemove',function(){ video.play(); },false)
};
});
Upvotes: 0
Views: 2903
Reputation: 15213
Assuming you are using the <video>
element, you can just add the autoplay
attribute:
<video autoplay>
<source src=""/>
</video>
Upvotes: 0