0
votes

I know that embed code can autoplay but youtube will not calculate these views. However I search for javascript that automatically play the video after the visitor stay for XX seconds in site. i.e: I want to Auto Play Youtube Embedded Video without editing the embedding code. Can that be?

1

1 Answers

-1
votes

You can simply add a setTimeout function which track the time after the page is loaded and play the video after it :

 var time = 3000 //the time in milliseconds 

 document.querySelector('body').onload = function(){

    setTimeout(function(){

        //The code that will run the video

    },time);

 }