fix list.remove
This commit is contained in:
+2
-2
@@ -107,7 +107,7 @@ class List {
|
||||
list[index].remove();
|
||||
|
||||
this.audios.splice(index, 1);
|
||||
this.lrc.parsed.splice(index, 1);
|
||||
this.player.lrc && this.player.lrc.remove(index);
|
||||
|
||||
if (index === this.index) {
|
||||
if (this.audios[index]) {
|
||||
@@ -178,7 +178,7 @@ class List {
|
||||
this.player.container.classList.remove('aplayer-withlist');
|
||||
this.player.pause();
|
||||
this.audios = [];
|
||||
this.lrc.parsed = [];
|
||||
this.player.lrc && this.player.lrc.clear();
|
||||
this.player.audio.src = '';
|
||||
this.player.template.listOl.innerHTML = '';
|
||||
this.player.template.pic.style.backgroundImage = '';
|
||||
|
||||
@@ -131,6 +131,15 @@ class Lrc {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
remove (index) {
|
||||
this.parsed.splice(index, 1);
|
||||
}
|
||||
|
||||
clear () {
|
||||
this.parsed = [];
|
||||
this.container.innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
export default Lrc;
|
||||
+2
-2
@@ -159,7 +159,7 @@ class APlayer {
|
||||
// audio download error: an error occurs
|
||||
let skipTime;
|
||||
this.on('error', () => {
|
||||
if (this.list.audios.length) {
|
||||
if (this.list.audios.length > 1) {
|
||||
this.notice('An audio error has occurred, player will skip forward in 2 seconds.');
|
||||
skipTime = setTimeout(() => {
|
||||
this.skipForward();
|
||||
@@ -168,7 +168,7 @@ class APlayer {
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
else {
|
||||
else if (this.list.audios.length === 1) {
|
||||
this.notice('An audio error has occurred.');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user