Androz2091 / discord-player

🎧 Complete framework to simplify the implementation of music commands using discord.js v14
https://discord-player.js.org/
MIT License
589 stars 192 forks source link

Rewrite tracks queue #1855

Closed twlite closed 8 months ago

twlite commented 10 months ago

Rewrite tracks queue to accept both Tracks and Playlists object. Track selector will have to be refactored to resolve tracks appropriately. It will also fix #1821 in this way:

  1. when playlist is found, extractor resolves a partial playlist (flag partial: true is set) immediately
  2. discord-player queues up that partial playlist like any other playlist
  3. audio player starts consuming tracks of that playlist one by one
  4. while step 3 is happening, discord-player then runs a background task to fetch remaining tracks of that playlist

To the end user, everything happens instantly (user will not have to wait for like 10 seconds to load a playlist with around 500 tracks) while we are taking care of the things in background.

This approach comes with a breaking change though. To get around this issue, I propose another api to read tracks in the queue to not break the ecosystem in the future:

// this should return array of tracks
const tracks = queue.getTracks();

another interesting problem we have to face is removeTrack, moveTrack, jump, insert, etc...

Feel free to suggest your ideas on this.