Guest User

Untitled

a guest
Apr 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <!-- Youtube video loop playlist -->
  2. <script type="text/javascript">// 2. This code loads the IFrame Player API code asynchronously.
  3. var tag = document.createElement('script');
  4.  
  5. tag.src = "https://www.youtube.com/iframe_api";
  6. var firstScriptTag = document.getElementsByTagName('script')[0];
  7. firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  8.  
  9. // 3. This function creates an <iframe> (and YouTube player)
  10. // after the API code downloads.
  11. var player;
  12.  
  13. function onYouTubeIframeAPIReady() {
  14. player = new YT.Player('player', {
  15. height: '330',
  16. width: '528',
  17. events: {
  18. 'onReady': onPlayerReady
  19. },
  20. playerVars:
  21. {
  22. listType:'playlist',
  23. list: 'PLmKo5LJ01oLFFReQ56wjwBJDN0HBbvENa',
  24. rel: 0
  25. }
  26. });
  27. }
  28.  
  29. // 4. The API will call this function when the video player is ready.
  30. function onPlayerReady(event) {
  31. /* debugger */;
  32. num = Math.floor(Math.random() * 11);
  33.  
  34. setTimeout(() => {
  35. player.mute();
  36. player.playVideoAt(num);
  37. }, 1000)
  38. }</script>
  39. <div id="player">&nbsp;</div>
Add Comment
Please, Sign In to add comment