Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
- <div id="player1"></div>
- <div id="player2"></div>
- <div id="player3"></div>
- <div id="player4"></div>
- <div id="player5"></div>
- <div id="player6"></div>
- <div id="player7"></div>
- <div id="player8"></div>
- <div id="player9"></div>
- <div id="player10"></div>
- <div id="player11"></div>
- <div id="player12"></div>
- <script>
- // 2. This code loads the IFrame Player API code asynchronously.
- var tag = document.createElement('script');
- tag.src = "http://www.youtube.com/iframe_api";
- var firstScriptTag = document.getElementsByTagName('script')[0];
- firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
- // 3. This function creates an <iframe> (and YouTube player)
- // after the API code downloads.
- window.thumbNailPlayers = new Array();
- //adds a "thumbnail" of a youtube video (which is actually just a paused video.)
- function AddChromelessPlayerThumbnail(videoID,width,height,startPos,endPos,domID){
- var retv = new YT.Player(domID, {
- height: height,
- width: width,
- videoId: videoID,
- events: {
- 'onReady': onPlayerReadyMuteAndPause,
- 'onStateChange': onPlayerStateChange
- },
- playerVars: {
- controls: 0,
- showinfo: 0 ,
- modestbranding: 1,
- rel:0,
- autohide:1,
- iv_load_policy:3,
- //start:60
- // if I try adding wmode: opaque as a playerVar here, it breaks
- },
- });
- return retv;
- }
- function onYouTubeIframeAPIReady() {
- for(var i=0;i<10;i++){
- var temp =
- window.thumbNailPlayers.push(AddChromelessPlayerThumbnail("EBTO9_imXSc",200,200,20,22,"player"+i))
- }
- }
- // 4. The API will call this function when the video player is ready.
- function onPlayerReady(event) {
- //event.target.playVideo();
- }
- function onPlayerReadyMuteAndPause(event){
- //debugger;
- event.target.playVideo();
- event.target.mute();
- event.target.seekTo(60);
- setTimeout(function(){event.target.pauseVideo();},100)
- //
- //event.target.pauseVideo();
- }
- // 5. The API calls this function when the player's state changes.
- // The function indicates that when playing a video (state=1),
- // the player should play for six seconds and then stop.
- var done = false;
- function onPlayerStateChange(event) {
- if (event.data == YT.PlayerState.PLAYING) {
- setTimeout(pauseVideo, 100);
- done = true;
- }
- }
- function pauseVideo() {
- player.pauseVideo();
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment