Iframe playlist next video on ended event not working


(Choth Tit) #1

$(function() {
$("#playlist li").on(“click”, function() {
$("#videoarea").attr({
“src”: $(this).attr(“movieurl”),
“poster”: “”,
“autoplay”: “autoplay”
})
})
$("#videoarea").attr({
“src”: $("#playlist li").eq(0).attr(“movieurl”),
“poster”: $("#playlist li").eq(0).attr(“moviesposter”)
})

var videos = [
"https://drive.google.com/file/d/0BxcIPSJ_soSBbUZnZUUyTlNwU3c/preview?autoplay=1",
"https://drive.google.com/file/d/0BxcIPSJ_soSBeVNJdTA4LXU2SGs/preview?autoplay=1","http://www.ioncannon.net/examples/vp8-webm/big_buck_bunny_480p.web",

];
function playArray(index,ele,array,listener){
ele.removeEventListener(listener||0);
ele.src = array[index];
ele.load();
ele.play();
index++;
if(index>=array.length){
index=0;
}
listener = ele.addEventListener(‘ended’,function(){
playArray(index,ele,array,listener);
},false);
}
playArray(0,document.getElementById(“videoarea”),videos);
})indent preformatted text by 4 spaces