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

Spotify Player only works when Spotify client is open and not on its own with streaming? #435

Closed
wallysaurus opened this issue Apr 28, 2024 · 13 comments · Fixed by #439
Closed
Labels
bug Something isn't working

Comments

@wallysaurus
Copy link

I'm just trying to use the terminal on its own without needing to have the spotify client open in the background. I'm not sure how I did this before, I had to reset my arch linux today.

I've followed the documentation very precisely. All I get is this: "No playback found."

@wallysaurus wallysaurus added the bug Something isn't working label Apr 28, 2024
@wallysaurus
Copy link
Author

side note, I installed spotify_player with cargo install spotify_player --no-default-features --features pulseaudio-backend,lyric-finder,streaming,notify,sixel --force

@mrfatboy
Copy link

I have the same problem. Also to add to this issue, if i do add a device first with the Spotify client, which it does then shows up in spotify_player, the device disappears after awhile if music is paused.

Is there a way to have spotify_player remember a device? My use case is building a stand alone player that is controllable via home automation. if spotify_player keeps forgetting the playable device I think I hit a dead end with this solution.

@wallysaurus
Copy link
Author

I have the same problem. Also to add to this issue, if i do add a device first with the Spotify client, which it does then shows up in spotify_player, the device disappears after awhile if music is paused.

Is there a way to have spotify_player remember a device? My use case is building a stand alone player that is controllable via home automation. if spotify_player keeps forgetting the playable device I think I hit a dead end with this solution.

There is a CLI command to manually connect via name/id. Might wanna check that out.

@aome510
Copy link
Owner

aome510 commented Apr 28, 2024

@wallysaurus. I don't really understand the issue you're facing. Can you elaborate and share any log/backtrace? Note that with streaming feature and a working audio backend, you don't need any other Spotify clients to run the app.

@wallysaurus
Copy link
Author

wallysaurus commented Apr 28, 2024

@wallysaurus. I don't really understand the issue you're facing. Can you elaborate and share any log/backtrace? Note that with streaming feature and a working audio backend, you don't need any other Spotify clients to run the app.

As shown in my installation command above, I installed both streaming and pulseaudio-backend, and properly authenticated my spotify account, yet when im inside the spotify_player gui, I am unable to play any songs due to "No playback found."
image

@wallysaurus
Copy link
Author

28T22:06:04.629236Z  INFO spotify_player::streaming: Application's connect configurations: ConnectConfig { name: "spotify-player", device_type: Speaker, initial_volume: Some(45875), has_volume_ctrl: true, autoplay: false }
2024-04-28T22:06:04.648762Z  INFO spotify_player::streaming: Initializing a new integrated player with device_id=9b8a19c1-fc76-4018-9200-0097118a32c4
2024-04-28T22:06:04.648977Z  INFO spotify_player::streaming: Starting an integrated Spotify player using librespot's spirc protocol
2024-04-28T22:06:05.674157Z  INFO spotify_player: No playback found on startup, trying to connect to an available device...
2024-04-28T22:06:05.674469Z  INFO spotify_player: Starting a client socket at 127.0.0.1:8080
2024-04-28T22:06:05.675099Z  INFO spotify_player::media_control: Initializing application's media control event watcher...
2024-04-28T22:06:05.793165Z  INFO client_request{request=GetCurrentUser}: spotify_player::client: Successfully handled the client request, took: 88ms
2024-04-28T22:06:05.927866Z  INFO client_request{request=GetUserFollowedArtists}: spotify_player::client: Successfully handled the client request, took: 222ms
2024-04-28T22:06:06.299895Z  INFO client_request{request=GetUserPlaylists}: spotify_player::client: Successfully handled the client request, took: 594ms
2024-04-28T22:06:06.776508Z  INFO client_request{request=GetUserSavedAlbums}: spotify_player::client: Successfully handled the client request, took: 1071ms
2024-04-28T22:06:06.783458Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Available devices: [Device { id: Some("9b8a19c1-fc76-4018-9200-0097118a32c4"), is_active: false, is_private_session: false, is_restricted: false, name: "spotify-player", _type: Speaker, volume_percent: Some(70) }]
2024-04-28T22:06:06.783543Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Trying to connect to device (id=9b8a19c1-fc76-4018-9200-0097118a32c4)
2024-04-28T22:06:06.963308Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Connection succeeded (device_id=9b8a19c1-fc76-4018-9200-0097118a32c4)!
2024-04-28T22:06:06.963372Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Successfully handled the client request, took: 1258ms
2024-04-28T22:06:08.678072Z  INFO spotify_player::client::handlers: Current context ID (None) is different from the expected ID (Some(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")))), update the context state
2024-04-28T22:06:08.678237Z  INFO client_request{request=GetContext(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")))}: spotify_player::client: Get album context: spotify:album:14FGilar8X2PCvelbjX4tZ
2024-04-28T22:06:08.856927Z  INFO client_request{request=GetContext(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")))}: spotify_player::client: Successfully handled the client request, took: 178ms
2024-04-28T22:06:09.659760Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:09.811670Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:09.993606Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:10.133107Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:10.245568Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:10.349294Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:10.418631Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:10.526570Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:10.584504Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:12.633400Z  INFO client_request{request=GetDevices}: spotify_player::client: Successfully handled the client request, took: 74ms
2024-04-28T22:06:13.532629Z  INFO client_request{request=Player(TransferPlayback("9b8a19c1-fc76-4018-9200-0097118a32c4", false))}: spotify_player::client: Transferred playback to device with id=9b8a19c1-fc76-4018-9200-0097118a32c4
2024-04-28T22:06:13.532653Z  INFO client_request{request=Player(TransferPlayback("9b8a19c1-fc76-4018-9200-0097118a32c4", false))}: spotify_player::client: Successfully handled the client request, took: 167ms
2024-04-28T22:06:14.365435Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:4laOJWnkJHMEvkR8LFohgQ"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:14.492392Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:14.609415Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:4laOJWnkJHMEvkR8LFohgQ"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:14.716811Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:14.805035Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:4laOJWnkJHMEvkR8LFohgQ"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:14.903422Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:14.985284Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:4laOJWnkJHMEvkR8LFohgQ"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:15.075234Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:15.499382Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:2nBwC0sBIO4xiZEsOCRb7N"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:15.641378Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:15.711309Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:2nBwC0sBIO4xiZEsOCRb7N"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:15.848559Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:16.133420Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:2nBwC0sBIO4xiZEsOCRb7N"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:16.248224Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-04-28T22:06:17.681664Z  INFO client_request{request=GetUserSavedTracks}: spotify_player::client: Successfully handled the client request, took: 11976ms
2024-04-28T22:07:46.308599Z  INFO client_request{request=GetDevices}: spotify_player::client: Successfully handled the client request, took: 75ms```

@wallysaurus
Copy link
Author

Also worth noting I have pipewire-pulse-1:1.0.5-1 installed rather than pulseaudio-17.0-3

@aome510
Copy link
Owner

aome510 commented Apr 28, 2024

Interesting, based on the log, this issue seems to happen because handling a StartPlayback requires some playback, which it shouldn't be. One thing that I don't understand is that after TransferPlayback is successfully handled, there should be some playback. That's why I never encountered such problem before.

aome510 added a commit that referenced this issue Apr 29, 2024
@aome510
Copy link
Owner

aome510 commented Apr 29, 2024

@wallysaurus should be fixed with #439, e.g StartPlayback should not return an error when the playback is not available. Can you try the latest master?

@wallysaurus
Copy link
Author

Doesn't seem like anything's changed on my end.
cargo install --git https://github.com/aome510/spotify-player --features lyric-finder,image,notify is what i ran to update it, let me know if i'm installing wrong.

@aome510
Copy link
Owner

aome510 commented Apr 30, 2024

Doesn't seem like anything's changed on my end. cargo install --git https://github.com/aome510/spotify-player --features lyric-finder,image,notify is what i ran to update it, let me know if i'm installing wrong.

Can you share the new log? The install command looks good to me

@wallysaurus
Copy link
Author

Doesn't seem like anything's changed on my end. cargo install --git https://github.com/aome510/spotify-player --features lyric-finder,image,notify is what i ran to update it, let me know if i'm installing wrong.

Can you share the new log? The install command looks good to me

2024-05-01T22:07:21.680953Z  INFO spotify_player::token: Getting new authentication token...
2024-05-01T22:07:21.735195Z  INFO spotify_player::token: Got new token: Token { access_token: "token here", expires_in: TimeDelta { secs: 3600, nanos: 0 }, expires_at: Some(2024-05-01T23:07:21.735192214Z), refresh_token: None, scopes: {} }
2024-05-01T22:07:21.735260Z  INFO spotify_player::streaming: Application's connect configurations: ConnectConfig { name: "spotify-player", device_type: Speaker, initial_volume: Some(45875), has_volume_ctrl: true, autoplay: false }
2024-05-01T22:07:21.740709Z  INFO spotify_player::streaming: Initializing a new integrated player with device_id=2df56590-cac7-4009-ad15-908a1f6189ef
2024-05-01T22:07:21.740841Z  INFO spotify_player::streaming: Starting an integrated Spotify player using librespot's spirc protocol
2024-05-01T22:07:22.051367Z  INFO spotify_player: No playback found on startup, trying to connect to an available device...
2024-05-01T22:07:22.051681Z  INFO spotify_player: Starting a client socket at 127.0.0.1:8080
2024-05-01T22:07:22.052289Z  INFO spotify_player::media_control: Initializing application's media control event watcher...
2024-05-01T22:07:22.178693Z  INFO client_request{request=GetCurrentUser}: spotify_player::client: Successfully handled the client request, took: 114ms
2024-05-01T22:07:22.237264Z  INFO client_request{request=GetUserFollowedArtists}: spotify_player::client: Successfully handled the client request, took: 173ms
2024-05-01T22:07:22.613162Z  INFO client_request{request=GetUserPlaylists}: spotify_player::client: Successfully handled the client request, took: 548ms
2024-05-01T22:07:23.145030Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Available devices: [Device { id: Some("cbf850a307aadaf4be921e0567de45f350857113"), is_active: false, is_private_session: false, is_restricted: false, name: "archlinux", _type: Computer, volume_percent: Some(100) }, Device { id: Some("2df56590-cac7-4009-ad15-908a1f6189ef"), is_active: false, is_private_session: false, is_restricted: false, name: "spotify-player", _type: Speaker, volume_percent: Some(70) }]
2024-05-01T22:07:23.145066Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Trying to connect to device (id=2df56590-cac7-4009-ad15-908a1f6189ef)
2024-05-01T22:07:23.176993Z  INFO client_request{request=GetUserSavedAlbums}: spotify_player::client: Successfully handled the client request, took: 1112ms
2024-05-01T22:07:23.703997Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Connection succeeded (device_id=2df56590-cac7-4009-ad15-908a1f6189ef)!
2024-05-01T22:07:23.704027Z  INFO client_request{request=ConnectDevice}: spotify_player::client: Successfully handled the client request, took: 1639ms
2024-05-01T22:07:28.058788Z  INFO spotify_player::client::handlers: Current context ID (None) is different from the expected ID (Some(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")))), update the context state
2024-05-01T22:07:28.058949Z  INFO client_request{request=GetContext(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")))}: spotify_player::client: Get album context: spotify:album:14FGilar8X2PCvelbjX4tZ
2024-05-01T22:07:28.210977Z  INFO client_request{request=GetContext(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")))}: spotify_player::client: Successfully handled the client request, took: 152ms
2024-05-01T22:07:28.897649Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:28.969617Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:4laOJWnkJHMEvkR8LFohgQ"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:29.131053Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:29.187529Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:4laOJWnkJHMEvkR8LFohgQ"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:29.335781Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:29.359642Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:4laOJWnkJHMEvkR8LFohgQ"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:29.513597Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:30.263586Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:30.417642Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:30.535489Z ERROR client_request{request=Player(StartPlayback(Context(Album(AlbumId("14FGilar8X2PCvelbjX4tZ")), Some(Uri("spotify:track:6EGKCz3dehJc1NAhrvlWYm"))), None))}: spotify_player::client::handlers: Failed to handle client request: no playback found
2024-05-01T22:07:30.613462Z ERROR client_request{request=Player(ResumePause)}: spotify_player::client::handlers: Failed to handle client request: no playback found```

@aome510
Copy link
Owner

aome510 commented May 1, 2024

Can you try running cargo install --git again? Maybe the git repo is not up-to-date when you ran the command. Also, can you make sure that the binary in .cargo/bin/ is run, e.g what is output of which spotify_player? Normally, I recommend people to checkout the repo and run cargo run, but cargo install --git should also work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants