Fix du passage à la piste suivante.
This commit is contained in:
parent
4cd6b830a9
commit
22af46bbf1
1 changed files with 9 additions and 13 deletions
|
@ -30,29 +30,25 @@ function onPlayerReady(event) {
|
|||
function play() {
|
||||
player.loadVideoById(tracks[current_link]);
|
||||
player.playVideo();
|
||||
document.getElementById(current_link).classList.add('bg-success');
|
||||
document.getElementById(current_link).classList.remove('bg-secondary');
|
||||
}
|
||||
function next() {
|
||||
if (current_link < (tracks.length -1)) {
|
||||
current_link += 1;
|
||||
play();
|
||||
}
|
||||
setCurrent(current_link + 1);
|
||||
}
|
||||
|
||||
function prev() {
|
||||
if (current_link > 0) {
|
||||
current_link -= 1;
|
||||
play();
|
||||
}
|
||||
setCurrent(current_link - 1);
|
||||
}
|
||||
|
||||
function setCurrent(c) {
|
||||
if(c > 0 && c < tracks.length) {
|
||||
document.getElementById(current_link).classList.remove('bg-success');
|
||||
document.getElementById(current_link).classList.add('bg-secondary');
|
||||
if(c >= 0 && c < tracks.length) {
|
||||
if(current_link >= 0 && current_link < tracks.length){
|
||||
document.getElementById(current_link).classList.remove('bg-success');
|
||||
document.getElementById(current_link).classList.add('bg-secondary');
|
||||
}
|
||||
current_link = c;
|
||||
play();
|
||||
document.getElementById(current_link).classList.add('bg-success');
|
||||
document.getElementById(current_link).classList.remove('bg-secondary');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue