Update player.js
don't recreate everything just to repeat the song, just change the current time and hit play
This commit is contained in:
parent
dae0538aa0
commit
12f708767e
22
player.js
22
player.js
|
@ -138,17 +138,19 @@ function init(){
|
||||||
"repeat":false
|
"repeat":false
|
||||||
};
|
};
|
||||||
audio.addEventListener("ended",function(){
|
audio.addEventListener("ended",function(){
|
||||||
|
if(repeat.checked){
|
||||||
|
audio.currentTime=0;
|
||||||
|
return audio.play();
|
||||||
|
}
|
||||||
var next=track;
|
var next=track;
|
||||||
if(!repeat.checked){
|
if(shuffle.checked){
|
||||||
if(shuffle.checked){
|
next=randInt(0,music.length-1);
|
||||||
next=randInt(0,music.length-1);
|
}
|
||||||
}
|
else if(track+1 < music.length){
|
||||||
else if(track+1 < music.length){
|
next++;
|
||||||
next++;
|
}
|
||||||
}
|
else{
|
||||||
else{
|
next=0;
|
||||||
next=0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sendEvt(music[next],'click');
|
sendEvt(music[next],'click');
|
||||||
},false);
|
},false);
|
||||||
|
|
Loading…
Reference in a new issue