<center>
<script src="https://www.youtube.com/iframe_api" type="text/javascript"></script>
<div style="height: 0; overflow: hidden; padding-bottom: 56.26%; position: relative; width: 100%;">
<div class="separator" style="clear: both; height: 100%; left: 0; position: absolute; text-align: center; top: 0; width: 100%;">
</div>
<div id="player">
</div>
</div>
<script src="https://www.youtube.com/iframe_api" type="text/javascript"></script>
<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;
function onYouTubeIframeAPIReady() {
var videoID = RList();
player = new YT.Player('player', {
height: '100%',
width: '100%',
videoId: videoID,
playerVars: { 'autoplay': 1},
events: {'onReady': onPlayerReady}
});
echoList(videoID);
}
function onPlayerReady(event) {
event.target.setVolume(100);
event.target.playVideo();
var Ptime = event.target.getDuration();
RELOAD_PAGE(Ptime);
echoTime(Ptime);
document.getElementById( "PlayTitle" ).innerText = player.getVideoData().title;
}
function echoTime(t) {
var showTime = document.getElementById('PlayTime');
showTime.innerHTML = t;
}
function echoList(l) {
var showList = document.getElementById('PlayList');
showList.innerHTML = l;
var showTitle = document.getElementById('PlayTitle');
showTitle.innerHTML = "<?php $content = file_get_contents('http://youtube.com/get_video_info?video_id='." + l + "); parse_str($content, $ytarr); echo $ytarr['title']; ?>";
}
function RList() {
var YT_List = ['Y7rR-hzLwJ4','x-aTxKZAc9A','WHPKxFwibsQ','yd5FQeQvYvQ','_SCdj9d8SUQ'];
var index = Math.floor(Math.random() * YT_List.length);
return YT_List[index];
}
function RELOAD_PAGE(i){
var tt = (i+1)*1000;
setTimeout(function () {
location.reload();
}, tt);
}
</script>
<div>
<h3>
제목 : <span id="PlayTitle"></span></h3>
</div>
<div>
<span id="PlayTime"></span>초 후 다른 음악이 재생됩니다.</div>
<div>
동영상 ID : <span id="PlayList"></span></div>
</center>
<br />