var videoIDs = ['GlPf_WngrrA','sNuQpkR4vuo'];var player, currentVideoId = 0;function onYouTubeIframeAPIReady() {player = new YT.Player('player', {height: '349',width: '620',events: {'onReady': onPlayerReady,'onStateChange': onPlayerStateChange}});} function onPlayerReady(event) {event.target.loadVideoById(videoIDs[currentVideoId]);}function onPlayerStateChange(event) {if (event.data == YT.PlayerState.ENDED) {currentVideoId++;if (currentVideoId < videoIDs.length) { player.loadVideoById(videoIDs[currentVideoId]);}}}