Answers for "javascript detect if youtube iframe video playing"

0

html5 iframe youtube loop

<iframe class="embed-responsive-item"id="ytplayer" type="text/html" width="640" height="360" src="https://www.youtube.com/embed/M7lc1UVf-VE?&autoplay=1&loop=1&rel=0&showinfo=0&color=white&iv_load_policy=3&playlist=M7lc1UVf-VE"
      frameborder="0" allowfullscreen></iframe>
Posted by: Guest on October-29-2020
0

javascript detect when youtube video ends

/*you will need to use the youtube iframe api*/
/*https://developers.google.com/youtube/iframe_api_reference */
var player = new YT.Player("video_holder_id",{
            width: '640',
            height: '390',
            videoId: "eXvLdB4zwsY",
            events: {
                'onReady': function(event){
                    console.log("video is ready");
                    event.target.playVideo();
                },
                'onStateChange': function(event){
                     if (event.data == YT.PlayerState.ENDED) {
                       //video has ended
                    }   
                }
    }
});
Posted by: Guest on November-03-2021

Code answers related to "javascript detect if youtube iframe video playing"

Browse Popular Code Answers by Language