Thursday, 15 August 2013

jquery - Listen to youtube iframe events using javascript -


I have a list of many embedded YouTube videos, such as

  & lt; Div class = "thumbnail" & gt; & Lt; Iframe width = "560" height = "315" src = "https://www.youtube.com/embed/2sZAeXBP0NE" framebird = "0" acceptable lens & gt; & Lt; / Iframe & gt; & Lt; / Div & gt;  

The list of videos is large and is changing daily.

IM is exploring a way to capture the initial video event, so I can force the user to accept the TOS (using popup before watching the video) I am mostly with the Z index Tried to keep a division and put an onclick event there, but it is not working / stopping the user from watching the video.

So I've finished some things to mention the YouTube API

You should use a div as a placeholder for the video in this way

  & lt; Div id = "video3" class = "video3" & gt; & Lt; / Div & gt;  

And then you can declare the callback function which takes a fire once you click on the video.

ITubeIframeAPIReady () {video1 = New YT.Player ('video1', {height: '315', width: '560', video ID: 'YouTube ID', Event: {'Onestate Change': OnplatformTest Change}});

Note that all videos must be loaded inside theYouTubeIFrameReady and they all point to the same callback function or different people hope that it helps.


No comments:

Post a Comment