Fix AUTOPLAY
it should fix the autoplay mode. autoplay should never ignore a track in a queue and should be triggered when the queue is empty.
This commit is contained in:
parent
94ffd93cde
commit
f7813170de
1 changed files with 7 additions and 9 deletions
|
@ -189,16 +189,14 @@ class Queue<T = unknown> {
|
||||||
if (!this.tracks.length && this.repeatMode === QueueRepeatMode.OFF) {
|
if (!this.tracks.length && this.repeatMode === QueueRepeatMode.OFF) {
|
||||||
if (this.options.leaveOnEnd) this.destroy();
|
if (this.options.leaveOnEnd) this.destroy();
|
||||||
this.player.emit("queueEnd", this);
|
this.player.emit("queueEnd", this);
|
||||||
|
} else if (!this.tracks.length && this.repeatMode === QueueRepeatMode.AUTOPLAY) {
|
||||||
|
this._handleAutoplay(Util.last(this.previousTracks));
|
||||||
} else {
|
} else {
|
||||||
if (this.repeatMode !== QueueRepeatMode.AUTOPLAY) {
|
if (this.repeatMode === QueueRepeatMode.TRACK) return void this.play(Util.last(this.previousTracks), { immediate: true });
|
||||||
if (this.repeatMode === QueueRepeatMode.TRACK) return void this.play(Util.last(this.previousTracks), { immediate: true });
|
if (this.repeatMode === QueueRepeatMode.QUEUE) this.tracks.push(Util.last(this.previousTracks));
|
||||||
if (this.repeatMode === QueueRepeatMode.QUEUE) this.tracks.push(Util.last(this.previousTracks));
|
const nextTrack = this.tracks.shift();
|
||||||
const nextTrack = this.tracks.shift();
|
this.play(nextTrack, { immediate: true });
|
||||||
this.play(nextTrack, { immediate: true });
|
return;
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
this._handleAutoplay(Util.last(this.previousTracks));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue