[GH-ISSUE #1435] PlayerEvent::ShuffleChanged and PlayerEvent::RepeatChanged not sent #647

Closed
opened 2026-02-27 19:31:45 +03:00 by kerem · 9 comments
Owner

Originally created by @eladyn on GitHub (Jan 4, 2025).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1435

Description

When pressing the shuffle or repeat button, the state is properly updated but not propagated through the PlayerEvent channel.

Version

dev 7003e98c1b

How to reproduce

  1. Launch librespot --onevent env
  2. In the client click on shuffle or on repeat.
  3. Notice that no player events are being sent

Log

[2025-01-04T15:21:52Z INFO  librespot] librespot 0.6.0-dev 7003e98 (Built on 2025-01-04, Build ID: 8iRkyqq5, Profile: debug)
[2025-01-04T15:21:52Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2025-01-04T15:21:52Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2025-01-04T15:21:52Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
[2025-01-04T15:21:52Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
[2025-01-04T15:22:05Z INFO  librespot_core::session] Connecting to AP "..."
[2025-01-04T15:22:05Z INFO  librespot_core::session] Authenticated as '...' !
[2025-01-04T15:22:05Z INFO  librespot_core::session] Country: "..."
[2025-01-04T15:22:05Z INFO  librespot_core::spclient] Resolved "..." as spclient access point
[2025-01-04T15:22:05Z INFO  librespot_connect::spirc] active device is <...> with session <>
play_request_id_changed
loading
[2025-01-04T15:22:06Z INFO  librespot_playback::player] Loading <People Help the People> with Spotify URI <spotify:track:0YywjDvFudcaHG74NuWISy>
[2025-01-04T15:22:06Z WARN  librespot_core::dealer] No subscriber for msg.uri: social-connect/v2/broadcast_status_update
[2025-01-04T15:22:06Z INFO  librespot_connect::spirc] session update: <Ok(NEW_SESSION)> for self, current session_id 3e5bbc6bd5354ac6bdd7e74c5dbe444f, new session_id dd62750b9479353ae46624eb8a356bf0
[2025-01-04T15:22:06Z ERROR librespot_connect::spirc] could not parse session_update: Invalid state { Unknown enum variant name: `WIFI_BROADCAST_CHANGED` at 1:11 }
[2025-01-04T15:22:06Z INFO  librespot_playback::player] <People Help the People> (256236 ms) loaded
track_changed
paused
playing
volume_changed
volume_changed
volume_changed
volume_changed
volume_changed
volume_changed
[2025-01-04T15:22:15Z INFO  librespot_connect::spirc] delayed volume update for all devices: volume is now 65535
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
[2025-01-04T15:22:21Z WARN  librespot_connect::state::context] merging metadata collection.artist.is_banned false
play_request_id_changed
loading
[2025-01-04T15:22:21Z INFO  librespot_playback::player] Loading <1901> with Spotify URI <spotify:track:3CqOsjVamOisF8E0e9nPUo>
[2025-01-04T15:22:21Z INFO  librespot_playback::player] <1901> (311226 ms) loaded
track_changed
playing
[2025-01-04T15:22:22Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
seeked
[2025-01-04T15:22:35Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:22:41Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:22:45Z ERROR librespot_connect::spirc] failed to handle request: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:22:51Z ERROR librespot_connect::spirc] failed to handle request: Resource has been exhausted { Response status code: 429 Too Many Requests }
preload_next
[2025-01-04T15:26:02Z INFO  librespot_playback::player] Loading <Skinny Love> with Spotify URI <spotify:track:4RL77hMWUq35NYnPLXBpih>
[2025-01-04T15:26:02Z INFO  librespot_playback::player] <Skinny Love> (201080 ms) loaded
preloading
end_of_track
play_request_id_changed
track_changed
playing
[2025-01-04T15:26:33Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }
[2025-01-04T15:26:33Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests }

This is not a debug log, but I changed shuffle and repeat several times during this run, and that should trigger the onevent hook:

github.com/librespot-org/librespot@7003e98c1b/src/player_event_handler.rs (L225-L228)

Host (what you are running librespot on):

  • OS: Linux
  • Platform: x86_64

Additional context

I'm not sure whether the various other errors in the log are intended currently, otherwise I could of course open bug reports for them as well. (In particular the Too Many Requests seems interesting, but also the unknown enum variant WIFI_BROADCAST_CHANGED.

Originally created by @eladyn on GitHub (Jan 4, 2025). Original GitHub issue: https://github.com/librespot-org/librespot/issues/1435 ### Description When pressing the shuffle or repeat button, the state is properly updated but not propagated through the `PlayerEvent` channel. ### Version `dev` 7003e98c1b671755bd7b6c2f6ef1668c0223da52 ### How to reproduce 1. Launch `librespot --onevent env` 2. In the client click on shuffle or on repeat. 3. Notice that no player events are being sent ### Log ``` [2025-01-04T15:21:52Z INFO librespot] librespot 0.6.0-dev 7003e98 (Built on 2025-01-04, Build ID: 8iRkyqq5, Profile: debug) [2025-01-04T15:21:52Z INFO librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0) [2025-01-04T15:21:52Z INFO librespot_playback::convert] Converting with ditherer: tpdf [2025-01-04T15:21:52Z INFO librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA [2025-01-04T15:21:52Z INFO librespot_playback::audio_backend::rodio] Using audio device: default [2025-01-04T15:22:05Z INFO librespot_core::session] Connecting to AP "..." [2025-01-04T15:22:05Z INFO librespot_core::session] Authenticated as '...' ! [2025-01-04T15:22:05Z INFO librespot_core::session] Country: "..." [2025-01-04T15:22:05Z INFO librespot_core::spclient] Resolved "..." as spclient access point [2025-01-04T15:22:05Z INFO librespot_connect::spirc] active device is <...> with session <> play_request_id_changed loading [2025-01-04T15:22:06Z INFO librespot_playback::player] Loading <People Help the People> with Spotify URI <spotify:track:0YywjDvFudcaHG74NuWISy> [2025-01-04T15:22:06Z WARN librespot_core::dealer] No subscriber for msg.uri: social-connect/v2/broadcast_status_update [2025-01-04T15:22:06Z INFO librespot_connect::spirc] session update: <Ok(NEW_SESSION)> for self, current session_id 3e5bbc6bd5354ac6bdd7e74c5dbe444f, new session_id dd62750b9479353ae46624eb8a356bf0 [2025-01-04T15:22:06Z ERROR librespot_connect::spirc] could not parse session_update: Invalid state { Unknown enum variant name: `WIFI_BROADCAST_CHANGED` at 1:11 } [2025-01-04T15:22:06Z INFO librespot_playback::player] <People Help the People> (256236 ms) loaded track_changed paused playing volume_changed volume_changed volume_changed volume_changed volume_changed volume_changed [2025-01-04T15:22:15Z INFO librespot_connect::spirc] delayed volume update for all devices: volume is now 65535 [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false [2025-01-04T15:22:21Z WARN librespot_connect::state::context] merging metadata collection.artist.is_banned false play_request_id_changed loading [2025-01-04T15:22:21Z INFO librespot_playback::player] Loading <1901> with Spotify URI <spotify:track:3CqOsjVamOisF8E0e9nPUo> [2025-01-04T15:22:21Z INFO librespot_playback::player] <1901> (311226 ms) loaded track_changed playing [2025-01-04T15:22:22Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests } seeked [2025-01-04T15:22:35Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests } [2025-01-04T15:22:41Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests } [2025-01-04T15:22:45Z ERROR librespot_connect::spirc] failed to handle request: Resource has been exhausted { Response status code: 429 Too Many Requests } [2025-01-04T15:22:51Z ERROR librespot_connect::spirc] failed to handle request: Resource has been exhausted { Response status code: 429 Too Many Requests } preload_next [2025-01-04T15:26:02Z INFO librespot_playback::player] Loading <Skinny Love> with Spotify URI <spotify:track:4RL77hMWUq35NYnPLXBpih> [2025-01-04T15:26:02Z INFO librespot_playback::player] <Skinny Love> (201080 ms) loaded preloading end_of_track play_request_id_changed track_changed playing [2025-01-04T15:26:33Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests } [2025-01-04T15:26:33Z ERROR librespot_connect::spirc] could not dispatch connect state update: Resource has been exhausted { Response status code: 429 Too Many Requests } ``` This is not a debug log, but I changed shuffle and repeat several times during this run, and that should trigger the onevent hook: https://github.com/librespot-org/librespot/blob/7003e98c1b671755bd7b6c2f6ef1668c0223da52/src/player_event_handler.rs#L225-L228 ### Host (what you are running `librespot` on): - OS: Linux - Platform: x86_64 ### Additional context I'm not sure whether the various other errors in the log are intended currently, otherwise I could of course open bug reports for them as well. (In particular the `Too Many Requests` seems interesting, but also the unknown enum variant `WIFI_BROADCAST_CHANGED`.
kerem 2026-02-27 19:31:45 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@photovoltex commented on GitHub (Jan 4, 2025):

Huh, good find. Seems like that part was overlooked. Just to clarify the behavior, it only doesn't notify when we (librespot) are in control, right?

The other errors:

The WIFI_BROADCAST_CHANGED is an known error that doesn't break anything. But we should probably handle or fix it. Didn't bother yet as it doesn't break anything.

Too Many Requests is a failure that happens when to many request updates are send. That should be sorta fixed/improved with this PR https://github.com/librespot-org/librespot/pull/1414

<!-- gh-comment-id:2571399951 --> @photovoltex commented on GitHub (Jan 4, 2025): Huh, good find. Seems like that part was overlooked. Just to clarify the behavior, it only doesn't notify when we (librespot) are in control, right? **The other errors:** The `WIFI_BROADCAST_CHANGED` is an known error that doesn't break anything. But we should probably handle or fix it. Didn't bother yet as it doesn't break anything. `Too Many Requests` is a failure that happens when to many request updates are send. That should be sorta fixed/improved with this PR https://github.com/librespot-org/librespot/pull/1414
Author
Owner

@eladyn commented on GitHub (Jan 4, 2025):

Thanks for the reply!

I was looking through the code a bit and I think, the updates are only ever sent on activation of the session? So it wouldn't matter whether we cause or another client causes the update.

<!-- gh-comment-id:2571406550 --> @eladyn commented on GitHub (Jan 4, 2025): Thanks for the reply! I was looking through the code a bit and I think, the updates are only ever sent on activation of the session? So it wouldn't matter whether we cause or another client causes the update.
Author
Owner

@photovoltex commented on GitHub (Jan 4, 2025):

Yeah seems like it. The previous calls where probably removed during the dealer rework and because they do not influence the overall connect handling it did run under the radar.

<!-- gh-comment-id:2571420534 --> @photovoltex commented on GitHub (Jan 4, 2025): Yeah seems like it. The previous calls where probably removed during the dealer rework and because they do not influence the overall connect handling it did run under the radar.
Author
Owner

@eladyn commented on GitHub (Jan 4, 2025):

Makes sense. I could probably get around to creating a PR re-adding them by the end of next week or something, but if you or someone else is motivated, I would not mind either.

<!-- gh-comment-id:2571434432 --> @eladyn commented on GitHub (Jan 4, 2025): Makes sense. I could probably get around to creating a PR re-adding them by the end of next week or something, but if you or someone else is motivated, I would not mind either.
Author
Owner

@photovoltex commented on GitHub (Jan 4, 2025):

Sounds good. You can check here (https://github.com/librespot-org/librespot/network) if anyone created a branch that sounds like the fix (I probably won't till some time passed).

<!-- gh-comment-id:2571437353 --> @photovoltex commented on GitHub (Jan 4, 2025): Sounds good. You can check here (https://github.com/librespot-org/librespot/network) if anyone created a branch that sounds like the fix (I probably won't till some time passed).
Author
Owner

@maraid commented on GitHub (Jan 16, 2025):

The WIFI_BROADCAST_CHANGED is an known error that doesn't break anything. But we should probably handle or fix it. Didn't bother yet as it doesn't break anything.

Hey! I just wanted to let you know my minor finding.
It does seem to break at least the sending of "session_connected" player events. You mentioned in https://github.com/librespot-org/librespot/issues/1419#issuecomment-2546675656 that it might be caused by an out-of-date model, but it does work on master which indicates me that it the issue might lie elsewhere. Unfortunately I'm not really a rust person, so fixing it myself might prove difficult.

<!-- gh-comment-id:2594629331 --> @maraid commented on GitHub (Jan 16, 2025): > The `WIFI_BROADCAST_CHANGED` is an known error that doesn't break anything. But we should probably handle or fix it. Didn't bother yet as it doesn't break anything. Hey! I just wanted to let you know my minor finding. It does seem to break at least the sending of "session_connected" player events. You mentioned in https://github.com/librespot-org/librespot/issues/1419#issuecomment-2546675656 that it might be caused by an out-of-date model, but it does work on master which indicates me that it the issue might lie elsewhere. Unfortunately I'm not really a rust person, so fixing it myself might prove difficult.
Author
Owner

@photovoltex commented on GitHub (Jan 16, 2025):

It works on master or the latest release version (aka 0.6) because it isn't send there as they still use mecury to receive the connect session infos. With 0.6-dev, aka the dev branch we finally got around to implementing the dealer (#1356) which gives use more infos about the connect session and additonally more commands to handle. We also recently updated the protobuf extract to an up to date state, but sadly they didn't fix the problem in regards to the missing enum variant yet.

Anyhow this isn't the main issue at hand. So if you have any concerns about the warning/errors or want to fix them we should open a separate issue/PR for them :)

<!-- gh-comment-id:2594853110 --> @photovoltex commented on GitHub (Jan 16, 2025): It works on `master` or the latest release version (aka 0.6) because it isn't send there as they still use mecury to receive the connect session infos. With `0.6-dev`, aka the `dev` branch we finally got around to implementing the dealer (#1356) which gives use more infos about the connect session and additonally more commands to handle. We also recently updated the protobuf extract to an up to date state, but sadly they didn't fix the problem in regards to the missing enum variant yet. Anyhow this isn't the main issue at hand. So if you have any concerns about the warning/errors or want to fix them we should open a separate issue/PR for them :)
Author
Owner

@radoslawg commented on GitHub (Jan 20, 2025):

I have noticed setting a repeat playlist in the client does not work, and some random songs are played after the playlist is finished. I cannot fully follow the discussion, but would this issue be responsible for that? Strangely shuffling seems to work (using raspotify 0.46.1 with librespot 0.6.0 383a6f6 (Built on 2025-01-17, Build ID: jkYzFN5D, Profile: release) )

<!-- gh-comment-id:2602879102 --> @radoslawg commented on GitHub (Jan 20, 2025): I have noticed setting a repeat playlist in the client does not work, and some random songs are played after the playlist is finished. I cannot fully follow the discussion, but would this issue be responsible for that? Strangely shuffling seems to work (using `raspotify 0.46.1` with `librespot 0.6.0 383a6f6 (Built on 2025-01-17, Build ID: jkYzFN5D, Profile: release)` )
Author
Owner

@photovoltex commented on GitHub (Jan 20, 2025):

This issue is related to the dev version. During the replaced of mercury with the dealer it seems we removed to much and by that this issue was created.

What you are referring to, might be already fixed on the dev branch But you should probably create a separate issue anyways on the matter, so that we can investigate the issue and check if it is resolved with the current version :)

<!-- gh-comment-id:2602947010 --> @photovoltex commented on GitHub (Jan 20, 2025): This issue is related to the `dev` version. During the replaced of mercury with the dealer it seems we removed to much and by that this issue was created. What you are referring to, might be already fixed on the `dev` branch But you should probably create a separate issue anyways on the matter, so that we can investigate the issue and check if it is resolved with the current version :)
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
starred/librespot#647
No description provided.