let addedPath;
let itemCounter = 1;




////////////////////////
//multi video player
function mltVideo() {

    addedPath = document.querySelector('.mltVideo')

    var i = 0; // global

    const videoCount = addedPath.children.length;
    let element = document.querySelector('.mltVideo');

    function videoPlay(videoNum) {
        element.setAttribute("src", addedPath.children[videoNum].src);
        element.autoplay = true;
        element.load();
        element.play();
    }


    element.addEventListener('ended', myHandler, false);


    videoPlay(0); // play the video

    function myHandler() {
        i++;
        if (i == videoCount) {
            i = 0;
            videoPlay(i);
        } else {
            videoPlay(i);
        }
    }


}

mltVideo()
