Auto Playing Next Video After First Video End

$("video ID/CLASS/TAG source:first").addClass("active");

var VAR = document.getElementById/Name/TagName("video ID/CLASS/TAG");

VAR.addEventListener('ended', function(e) {
 // get the active source and the next video source.
 // I set it so if there's no next, it loops to the first one
 var activesource = document.querySelector("video ID/CLASS/TAG source.active");
 var nextsource = document.querySelector("video ID/CLASS/TAG source.active + source") || document.querySelector("video ID/CLASS/TAG source:first-child");

 // deactivate current source, and activate next one
 activesource.className = "";
 nextsource.className = "active";

 // update the video source and play
 VAR.src = nextsource.src;
 VAR.play();

});