[Bug]: /api/v1/play plays song even with dismissed queue #2825

Open
opened 2025-01-04 14:27:01 +00:00 by FluffyPunk · 1 comment
FluffyPunk commented 2025-01-04 14:27:01 +00:00 (Migrated from github.com)

Preflight Checklist

  • I use the latest version of YouTube Music (Application).
  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.
  • I understand that th-ch/youtube-music has NO affiliation with Google or YouTube

YouTube Music (Application) Version

3.7.1

Checklists

What operating system are you using?

Windows

Operating System Version

Windows 11 24H2

What CPU architecture are you using?

x64

Last Known Working YouTube Music (Application) version

No response

Reproduction steps

API server should be enabled

  1. Dismiss queue (or DELETE /api/v1/queue)
  2. /api/v1/play

Expected Behavior

I think it should be unavailable to launch song since there's no songs in queue.

Actual Behavior

Sending request launches last played song after dismissing queue. It is showed by sending /api/v1/song

{
  "title": "cheatreal",
  "artist": "t+pazolite",
  "views": 438926,
  "uploadDate": "2022-11-30T02:07:10-08:00",
  "imageSrc": "https://lh3.googleusercontent.com/fngVaWP1iFl8OpmQyerxW17bJjzfrUH4w45ZHVEf3tKpwqhnVEXdcx3zp49OX3pftKoaCw2qJURxYxFWsA=w544-h544-l90-rj",
  "isPaused": true,
  "songDuration": 295,
  "elapsedSeconds": 0,
  "url": "https://music.youtube.com/watch?v=MzDpeX3eJRQ",
  "album": "Answer from X Girlz",
  "videoId": "MzDpeX3eJRQ",
  "playlistId": "RDAMPLOLAK5uy_kdLCctiPE2quAcjleq3tpLmqpgwiyAGDI",
  "mediaType": "AUDIO"
}

But at same moment queue is empty

{
  "items": [],
  "autoPlaying": false
}

Enabled plugins

  1. API Server
  2. Audio Compressor
  3. Exponential Volume
  4. Discord RPC
  5. Disable Autoplay
  6. In-App Menu
  7. Lyrics Genius
  8. Navigation
  9. Precise Volume

Additional Information

I see 2 ways of fixing this - simple and kinda complicated.

Simple is one is just checking queue for items - if there is no items[] in queue, so return error on /api/v1/play that there is no songs

Other way is checking if videoId in current song info (/api/v1/song) is presented in queue, but I'm not sure about queue structure since it looks kinda spaghetti raw JSON

### Preflight Checklist - [X] I use the latest version of YouTube Music (Application). - [X] I have searched the [issue tracker](https://github.com/th-ch/youtube-music/issues) for a bug report that matches the one I want to file, without success. - [X] I understand that **th-ch/youtube-music has NO affiliation with Google or YouTube** ### YouTube Music (Application) Version 3.7.1 ### Checklists - [ ] I use the portable version of the YouTube Music Application. - [ ] I can reproduce this issue in the [official version of (WEB) YTM](https://music.youtube.com). ### What operating system are you using? Windows ### Operating System Version Windows 11 24H2 ### What CPU architecture are you using? x64 ### Last Known Working YouTube Music (Application) version _No response_ ### Reproduction steps API server should be enabled 1. Dismiss queue (or DELETE /api/v1/queue) 2. /api/v1/play ### Expected Behavior I think it should be unavailable to launch song since there's no songs in queue. ### Actual Behavior Sending request launches last played song after dismissing queue. It is showed by sending /api/v1/song ``` { "title": "cheatreal", "artist": "t+pazolite", "views": 438926, "uploadDate": "2022-11-30T02:07:10-08:00", "imageSrc": "https://lh3.googleusercontent.com/fngVaWP1iFl8OpmQyerxW17bJjzfrUH4w45ZHVEf3tKpwqhnVEXdcx3zp49OX3pftKoaCw2qJURxYxFWsA=w544-h544-l90-rj", "isPaused": true, "songDuration": 295, "elapsedSeconds": 0, "url": "https://music.youtube.com/watch?v=MzDpeX3eJRQ", "album": "Answer from X Girlz", "videoId": "MzDpeX3eJRQ", "playlistId": "RDAMPLOLAK5uy_kdLCctiPE2quAcjleq3tpLmqpgwiyAGDI", "mediaType": "AUDIO" } ``` But at same moment queue is empty ``` { "items": [], "autoPlaying": false } ``` ### Enabled plugins 1. API Server 2. Audio Compressor 3. Exponential Volume 4. Discord RPC 5. Disable Autoplay 6. In-App Menu 7. Lyrics Genius 8. Navigation 9. Precise Volume ### Additional Information I see 2 ways of fixing this - simple and kinda complicated. Simple is one is just checking queue for items - if there is no `items[]` in queue, so return error on /api/v1/play that there is no songs Other way is checking if `videoId` in current song info (`/api/v1/song`) is presented in queue, but I'm not sure about queue structure since it looks kinda spaghetti raw JSON
franz-dc commented 2025-01-05 17:56:18 +00:00 (Migrated from github.com)

When you dismiss the queue, YouTube Music (web) retains the current playing song and just resets the playback at 0s, which is kinda weird personally.

If we make a workaround just for the API server, the data from the API would differ from the source of truth (YouTube Music itself).

When you dismiss the queue, YouTube Music (web) retains the current playing song and just resets the playback at `0s`, which is kinda weird personally. If we make a workaround just for the API server, the data from the API would differ from the source of truth (YouTube Music itself).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: YTMD/youtube-music#2825
No description provided.