[Bug]: /api/v1/play plays song even with dismissed queue
Preflight Checklist
- [X] I use the latest version of YouTube Music (Application).
- [X] I have searched the issue tracker 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.
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
- Dismiss queue (or DELETE /api/v1/queue)
- /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
- API Server
- Audio Compressor
- Exponential Volume
- Discord RPC
- Disable Autoplay
- In-App Menu
- Lyrics Genius
- Navigation
- 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
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).