Last active
December 20, 2015 22:09
-
-
Save tim-peterson/6203155 to your computer and use it in GitHub Desktop.
video.playlist.js loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//first version | |
// for continuous play | |
if(typeof options.continuous=='undefined' || options.continuous==true){ | |
//console.log('options.continuous==true'); | |
player.on("ended", function(){ | |
//console.log('on ended'); | |
index++; | |
if(index>=trackCount){ | |
//console.log('go to beginning'); | |
index=0; | |
} | |
else;// console.log('trigger click next track'); | |
tracks[index].click(); | |
});// on ended | |
} | |
//to loop track 1, one time | |
// for continuous play | |
if(typeof options.continuous=='undefined' || options.continuous==true){ | |
//console.log('options.continuous==true'); | |
var count=0;//create 2nd counter to loop 1st track | |
player.on("ended", function(){ | |
//console.log('on ended'); | |
count++; | |
if(index==0 && count==1) tracks[index].click(); //count==1 if only want to loop 1st track once | |
index++; | |
if(index>=trackCount){ | |
//console.log('go to beginning'); | |
index=0; | |
} | |
else;// console.log('trigger click next track'); | |
tracks[index].click(); | |
});// on ended | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment