Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Youtube video loop playlist -->
- <script type="text/javascript">// 2. This code loads the IFrame Player API code asynchronously.
- var tag = document.createElement('script');
- tag.src = "https://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.
- var player;
- function onYouTubeIframeAPIReady() {
- player = new YT.Player('player', {
- height: '330',
- width: '528',
- events: {
- 'onReady': onPlayerReady
- },
- playerVars:
- {
- listType:'playlist',
- list: 'PLmKo5LJ01oLFFReQ56wjwBJDN0HBbvENa',
- rel: 0
- }
- });
- }
- // 4. The API will call this function when the video player is ready.
- function onPlayerReady(event) {
- /* debugger */;
- num = Math.floor(Math.random() * 11);
- setTimeout(() => {
- player.mute();
- player.playVideoAt(num);
- }, 1000)
- }</script>
- <div id="player"> </div>
Add Comment
Please, Sign In to add comment