<div id="player"></div>
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player, videoRandom;
function onYouTubeIframeAPIReady() {
videoRandom = Math.floor((Math.random() * 16) + 1);
player = new YT.Player('player', {
//width: '0%',
//height: '0',
width: '100%',
height: '256',
playerVars: {
listType:'playlist',
list:'RDQMgEzdN5RuCXE',
index: videoRandom,
//autoplay: 1,
//controls: 0,
//autohide: 0,
//showinfo: 0,
},
events: {
'onReady': function (event) {
event.target.playVideo();
event.target.setLoop(true);
event.target.mute();
setTimeout(function() {
event.target.setShuffle({'shufflePlaylist' : true});
}, 1000);
}
}
});
}
</script>