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

Inconsistency in `track.metadata` Object. #1896

Closed GabuTheDev closed 1 month ago

GabuTheDev commented 4 months ago

Describe the bug

The package exhibits an inconsistency with the track.metadata object. This object appears to be tied to the song's position in the playback queue.

When playing a single song, track.metadata.bridge is populated correctly with bridge data, allowing the bot to provide accurate song information. However, adding a song mid-playback results in track.metadata.bridge becoming null for the song currently being added (any position other than 0 in the queue). This prevents the bot from replying with the correct information (like song's title and artist).

Attempting to force metadata retrieval using track.requestMetadata() proved ineffective. Even with Youtube sources explicitly blocked during player initialization, this method still returned Youtube metadata.

To Reproduce Steps to reproduce the behavior:

  1. Add song to queue.
  2. Get metadata from the song via track.metadata.
  3. Observe track.metadata.bridge being present.
  4. Add another song to the queue while the first one is still playing.
  5. Get metadata from the song via track.metadata.
  6. Observe track.metadata.bridge being null.

Expected behavior

Ideally, track.metadata.bridge should consistently hold the correct bridge data irrespective of the song's position. Additionally, track.requestMetadata() should respect the main configuration and return data from the other accessible sources.

Screenshots

Not needed.

Please complete the following information:

Additional context

I'll list the returned jsons here. (but not fully since it's a lot of data and I don't want to make this comment longer than it is) track.metadata when song is added on queue position 0.

{
  "source": {
    "type": "track",
    "uri": "spotify:track:22k0n1bKm5OJOMXPIWkFow",
    ...
  },
  "bridge": {
    "artwork_url": "https://i1.sndcdn.com/artworks-JsUASmKYijzIq9rc-TQbgHw-large.jpg",
    "caption": null,
    "commentable": true,
    "permalink_url": "https://soundcloud.com/mark-mendy/number",
    ...
  }
}

track.metadata when song is added on any other queue position.

{
  "source": {
    "type": "track",
    "name": "Number",
    "uri": "spotify:track:22k0n1bKm5OJOMXPIWkFow",
    ...
  },
  bridge: null
}

object returned on track.requestMetadata() even though youtube is blocked.

{
  "source": {
    "type": "track",
    "name": "Number",
    "uri": "spotify:track:22k0n1bKm5OJOMXPIWkFow",
  }
  "bridge": {
    "nsfw": false,
    ...
    "thumbnail": {
      "id": "o1RsTl0VkEQ",
      ...
    },
    "channel": {
      "name": "Soave",
      "verified": false,
      "id": "UCrlYWVuq4WVGoVv85-9NSWw",
      "url": "https://www.youtube.com/@soaverecords",
      "icon": [Object],
      "subscribers": null
    },
    ...
  }
}