Load next video when current ends
function loadNextVideo() {
myVideo.src = sources[currentVideo % sources.length];
myVideo.load();
currentVideo++;
}
function loadAndplayNextVideo() {
loadNextVideo();
myVideo.play();
}
function init() {
myVideo = document.querySelector("#myVideo");
myVideo.addEventListener('ended', loadAndplayNextVideo, false);
}