Guest User

Untitled

a guest
Sep 23rd, 2013
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
  5. <div id="player1"></div>
  6. <div id="player2"></div>
  7. <div id="player3"></div>
  8. <div id="player4"></div>
  9. <div id="player5"></div>
  10. <div id="player6"></div>
  11. <div id="player7"></div>
  12. <div id="player8"></div>
  13. <div id="player9"></div>
  14. <div id="player10"></div>
  15. <div id="player11"></div>
  16. <div id="player12"></div>
  17.  
  18.  
  19. <script>
  20. // 2. This code loads the IFrame Player API code asynchronously.
  21. var tag = document.createElement('script');
  22.  
  23. tag.src = "http://www.youtube.com/iframe_api";
  24. var firstScriptTag = document.getElementsByTagName('script')[0];
  25. firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  26.  
  27. // 3. This function creates an <iframe> (and YouTube player)
  28. // after the API code downloads.
  29. window.thumbNailPlayers = new Array();
  30.  
  31. //adds a "thumbnail" of a youtube video (which is actually just a paused video.)
  32. function AddChromelessPlayerThumbnail(videoID,width,height,startPos,endPos,domID){
  33. var retv = new YT.Player(domID, {
  34. height: height,
  35. width: width,
  36. videoId: videoID,
  37.  
  38. events: {
  39. 'onReady': onPlayerReadyMuteAndPause,
  40. 'onStateChange': onPlayerStateChange
  41. },
  42. playerVars: {
  43. controls: 0,
  44. showinfo: 0 ,
  45. modestbranding: 1,
  46. rel:0,
  47. autohide:1,
  48. iv_load_policy:3,
  49. //start:60
  50. // if I try adding wmode: opaque as a playerVar here, it breaks
  51. },
  52. });
  53. return retv;
  54. }
  55. function onYouTubeIframeAPIReady() {
  56. for(var i=0;i<10;i++){
  57. var temp =
  58. window.thumbNailPlayers.push(AddChromelessPlayerThumbnail("EBTO9_imXSc",200,200,20,22,"player"+i))
  59. }
  60. }
  61.  
  62. // 4. The API will call this function when the video player is ready.
  63. function onPlayerReady(event) {
  64.  
  65. //event.target.playVideo();
  66. }
  67. function onPlayerReadyMuteAndPause(event){
  68. //debugger;
  69. event.target.playVideo();
  70. event.target.mute();
  71. event.target.seekTo(60);
  72. setTimeout(function(){event.target.pauseVideo();},100)
  73. //
  74. //event.target.pauseVideo();
  75. }
  76.  
  77. // 5. The API calls this function when the player's state changes.
  78. // The function indicates that when playing a video (state=1),
  79. // the player should play for six seconds and then stop.
  80. var done = false;
  81. function onPlayerStateChange(event) {
  82. if (event.data == YT.PlayerState.PLAYING) {
  83. setTimeout(pauseVideo, 100);
  84. done = true;
  85. }
  86. }
  87. function pauseVideo() {
  88. player.pauseVideo();
  89. }
  90. </script>
  91. </body>
  92. </html>
Advertisement
Add Comment
Please, Sign In to add comment