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() {
|
function play() {
|
||||||
player.loadVideoById(tracks[current_link]);
|
player.loadVideoById(tracks[current_link]);
|
||||||
player.playVideo();
|
player.playVideo();
|
||||||
document.getElementById(current_link).classList.add('bg-success');
|
|
||||||
document.getElementById(current_link).classList.remove('bg-secondary');
|
|
||||||
}
|
}
|
||||||
function next() {
|
function next() {
|
||||||
if (current_link < (tracks.length -1)) {
|
setCurrent(current_link + 1);
|
||||||
current_link += 1;
|
|
||||||
play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function prev() {
|
function prev() {
|
||||||
if (current_link > 0) {
|
setCurrent(current_link - 1);
|
||||||
current_link -= 1;
|
|
||||||
play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCurrent(c) {
|
function setCurrent(c) {
|
||||||
if(c > 0 && c < tracks.length) {
|
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.remove('bg-success');
|
||||||
document.getElementById(current_link).classList.add('bg-secondary');
|
document.getElementById(current_link).classList.add('bg-secondary');
|
||||||
|
}
|
||||||
current_link = c;
|
current_link = c;
|
||||||
play();
|
play();
|
||||||
|
document.getElementById(current_link).classList.add('bg-success');
|
||||||
|
document.getElementById(current_link).classList.remove('bg-secondary');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue