Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Handling for AutoPlay not functioning #1411

Open
TheLastCD opened this issue Dec 6, 2024 · 7 comments
Open

Event Handling for AutoPlay not functioning #1411

TheLastCD opened this issue Dec 6, 2024 · 7 comments
Labels

Comments

@TheLastCD
Copy link

TheLastCD commented Dec 6, 2024

Description

Autoplay doesn't seem to be triggering an event for an event handler to pickup

Version

Version:L librespot 0.6.0-dev 82076e8 (Built on 2024-12-02, Build ID: WMNNBRja, Profile: release)

How to reproduce

Steps to reproduce the behavior in librespot e.g.

  1. Launch librespot with '-v'
  2. Connect to librespot through spotify
  3. Navigate to settings/Playback within the Spotify (i'm using android)
  4. turn on AutoPlay,
  5. monitoring logs we get the following trace [2024-12-06T12:34:58Z TRACE librespot_connect::spirc] Received attribute mutation for autoplay but key was not found!
  6. we should be seeing something like the following when enabled:
    [2024-12-06T12:35:42Z DEBUG librespot::player_event_handler] Running C:\...\git\librespot-eventHandler-C++\out.exe with environment variables: { "TRACK_ID": "7f9YaN8bcVLFlTMexwSlzb", "PLAYER_EVENT": "preloading", }

Log

Not Many Logs but here's a snippet from a track playing then toggling autoplay a few times:

 [2024-12-06T12:36:12Z DEBUG librespot::player_event_handler] Running C:\...\git\librespot-eventHandler-C++\out.exe with environment variables:
    {
        "ALBUM": "All Change",
        "URI": "spotify:track:7f9YaN8bcVLFlTMexwSlzb",
        "DURATION_MS": "265066",
        "ITEM_TYPE": "Track",
        "NAME": "History",
        "ALBUM_ARTISTS": "Cast",
        "COVERS": "https://i.scdn.co/image/ab67616d0000b27398d2b5f9e0c3d00e6bc423da\nhttps://i.scdn.co/image/ab67616d00001e0298d2b5f9e0c3d00e6bc423da\nhttps://i.scdn.co/image/ab67616d0000485198d2b5f9e0c3d00e6bc423da",
        "LANGUAGE": "en",
        "TRACK_ID": "7f9YaN8bcVLFlTMexwSlzb",
        "DISC_NUMBER": "1",
        "ARTISTS": "Cast",
        "IS_EXPLICIT": "false",
        "PLAYER_EVENT": "track_changed",
        "POPULARITY": "24",
        "NUMBER": "11",
    }
Playback started: History by Cast
[2024-12-06T12:36:12Z DEBUG librespot::player_event_handler] Running C:\...\librespot-eventHandler-C++\out.exe with environment variables:
    {
        "TRACK_ID": "7f9YaN8bcVLFlTMexwSlzb",
        "PLAYER_EVENT": "playing",
        "POSITION_MS": "0",
    }

[2024-12-06T12:36:12Z TRACE librespot_audio::fetch::receive] Throughput now estimated as: 1347 kbps
[2024-12-06T12:36:12Z TRACE librespot_audio::fetch::receive] Throughput now estimated as: 881 kbps[2024-12-06T12:36:12Z TRACE librespot_audio::fetch::receive] Throughput now estimated as: 1279 kbps
[2024-12-06T12:36:12Z TRACE librespot_audio::fetch::receive] Throughput now estimated as: 2558 kbps
[2024-12-06T12:36:12Z TRACE librespot_audio::fetch::receive] Time to first byte now estimated as: 
23 ms
[2024-12-06T12:36:12Z TRACE librespot_audio::fetch::receive] Throughput now estimated as: 3030 kbps
[2024-12-06T12:36:12Z TRACE librespot_audio::fetch::receive] Time to first byte now estimated as: 
18 ms
[2024-12-06T12:36:13Z TRACE librespot_audio::fetch::receive] Throughput now estimated as: 3708 kbps
[2024-12-06T12:36:13Z DEBUG librespot_audio::fetch] Downloading file 36a01bb0620aeb72c2aae526eab60370df174338 complete
[2024-12-06T12:36:29Z TRACE librespot_core::session] Received Ping
[2024-12-06T12:36:29Z TRACE librespot_core::session] keep-alive state: PendingPong, timeout in 60.0
[2024-12-06T12:36:29Z DEBUG librespot_core::session] Session strong=4 weak=7
[2024-12-06T12:37:03Z TRACE librespot_connect::spirc] Received attribute mutation for autoplay but key was not found!
[2024-12-06T12:37:05Z TRACE librespot_connect::spirc] Received attribute mutation for autoplay but key was not found!
[2024-12-06T12:37:06Z TRACE librespot_connect::spirc] Received attribute mutation for autoplay but key was not found!
[2024-12-06T12:37:07Z TRACE librespot_connect::spirc] Received attribute mutation for autoplay but key was not found!

Host (what you are running librespot on):

  • OS: Windows 10

Edit: missed description, version number and fixed formatting

@TheLastCD TheLastCD added the bug label Dec 6, 2024
@kingosticks
Copy link
Contributor

Can you please try with #1356

@photovoltex
Copy link
Member

photovoltex commented Dec 6, 2024

It is actually a separate issue, so using the dealer impl doesn't fix the problem. I did run into it myself and wanted to open an issue, but didn't got to it, yet.

Anyways, the issue seems to be that on windows the autoplay flag isn't send. Neither via the product information (initially), nor via the mutation. Meaning autoplay isn't activated when running on windows currently.

I think if we would acquire the infos via the ucs (i think it was called user customization service) we might be able to fix that, but that needs to be tested tho.

See here for some documentation that was previously done: #734 (comment)

@kingosticks
Copy link
Contributor

Great ok. I've not looked through your monster PR properly yet (that might end up being after it's merged by the sounds of it) so wasn't sure what was touched outside of dealer, I'd just lumped anything spirc related as possibly in flux!

@photovoltex
Copy link
Member

I did really try hard to only integrate the dealer xD, Yes I added new functionally, but that just because the dealer supports more^^

@photovoltex
Copy link
Member

Great ok. I've not looked through your monster PR properly yet (that might end up being after it's merged by the sounds of it) so wasn't sure what was touched outside of dealer, I'd just lumped anything spirc related as possibly in flux!

Btw. @kingosticks if you want to look over the PR or review it, we could probably still wait merging it.


Anyhow in regards to the ucs endpoint. It seems on linux ucs isn't used (probably because autoplay is still sent via the product information) and I currently don't have access to windows or android snooping to get the information needed (the linked comment provided an incorrect endpoint). So using ucs might be a platform dependent thing in the end.

@roderickvd
Copy link
Member

What you want guys - no pressure. I'm on a family weekend anyway.

@photovoltex Thanks for your e-mail - did you yet see my response? Also no haste, just checking.

@photovoltex
Copy link
Member

@roderickvd yeah, I'm just slow to respond when I have to think more about my responses, will probably answer over the course of the weekend tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants