Skip to content

Commit

Permalink
fix(Queue): fix jump
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Aug 23, 2021
1 parent 731e309 commit 2344265
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Structures/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,14 @@ class Queue<T = unknown> {
*/
jump(track: Track | number): void {
if (this.#watchDestroyed()) return;
// remove the track if exists
const foundTrack = this.remove(track);
if (!foundTrack) throw new PlayerError("Track not found", ErrorStatusCode.TRACK_NOT_FOUND);
this.tracks.splice(0, 0, foundTrack);
// since we removed the existing track from the queue,
// we now have to place that to position 1
// because we want to jump to that track
// this will skip current track and play the next one which will be the foundTrack
this.tracks.splice(1, 0, foundTrack);

This comment has been minimized.

Copy link
@Syslab64

Syslab64 Sep 14, 2021

This broke jump again.
The current song is not included in the queue, so index 0 is the song that is played next not index 1.

This comment has been minimized.

Copy link
@Samiul30

Samiul30 Sep 14, 2021

Contributor

This broke jump again.
The current song is not included in the queue, so index 0 is the song that is played next not index 1.

Everything is fine . So don't make issue on it

This comment has been minimized.

Copy link
@fobdev

fobdev Nov 5, 2021

This just reverted the fix to the broke state again, and does not work as described in the comments.


return void this.skip();
}
Expand Down

0 comments on commit 2344265

Please sign in to comment.