aome510 / spotify-player

A Spotify player in the terminal with full feature parity
MIT License
3.37k stars 146 forks source link

Can only play audio via Spotifyd (can't use librespot to create a device) #496

Closed platorotto closed 2 months ago

platorotto commented 2 months ago

Describe the bug I've been trying to get to play audio via the terminal using the spotify-player AUR binary but I can't seem to find the spotify-player device in the devices tab. I already added my own client_id so I can control the music if it's playing in another device, hence, I've been using the spotifyd daemon to make it work. Not sure if I'm missing something or it should work out of the box. I've already re-read the config.md but it still doesn't work. Maybe the streaming tab could help but I already downloaded librespot directly from the AUR and it's the same.

Expected behaviour Play audio via the spotify-player device in spotify connect.

Screenshots If spotifyd isn't on, this is what it shows. 1720403986

Environment

aome510 commented 2 months ago

Maybe related to https://github.com/aome510/spotify-player/issues/463

Not sure if I'm missing something or it should work out of the box

It should work out of the box. Can you share logs/backtraces if applicable?

Tbf, it's difficult for me to debug this kind of streaming issue because I cannot reproduce the error on my end. Normally, it happened because of some broken/missing system dependencies and is specific to each user's environment.

I would suggest you try other audio backends as described in https://github.com/aome510/spotify-player?tab=readme-ov-file#audio-backend to find one that works

aome510 commented 2 months ago

Note that spotifyd and spotify_player use the same library to handle streaming, so it's very weird that one works but another doesn't. What audio backend does spotifyd use?

platorotto commented 2 months ago

Note that spotifyd and spotify_player use the same library to handle streaming, so it's very weird that one works but another doesn't. What audio backend does spotifyd use?

do you mind showing me how to check for the spotifyd backend?

first I downloaded the AUR binary the normal way, I suppose it came with the rodio-backend but when I checked the streaming tab i tried cargo install spotify_player --no-default-features --features pulseaudio-backend

edit: adding the second paragraph

platorotto commented 2 months ago

It should work out of the box. Can you share logs/backtraces if applicable?

This is it. I don't think there's anything memorable since the first line is the config and it only shows the that there was no playback device available. 1720406067

I would suggest you try other audio backends as described in https://github.com/aome510/spotify-player?tab=readme-ov-file#audio-backend to find one that works

i'll try the one spotifyd says

platorotto commented 2 months ago

Note that spotifyd and spotify_player use the same library to handle streaming, so it's very weird that one works but another doesn't. What audio backend does spotifyd use?

i just checked. spotifyd uses pulseaudio so there must be something i did wrong. do you recommend uninstalling and reinstalling? if so, should I do it via cargo or aur?

aome510 commented 2 months ago

if so, should I do it via cargo or aur?

Did it work with aur before with the rodio backend? Otherwise, you can try to install with default features from cargo with cargo install spotify_player.

The linked log looks wrong to me. There should be a step to initialize the integrated player after getting token, for example:

2024-07-08T02:39:20.664290Z  INFO spotify_player::token: Got new token: Token { access_token: "$TOKEN", expires_in: TimeDelta { secs: 3600, nanos: 0 }, expires_at: Some(2024-07-08T03:39:20.664253Z), refresh_token: None, scopes: {} }
2024-07-08T02:39:20.665227Z  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-07-08T02:39:20.666979Z  INFO spotify_player::streaming: Initializing a new integrated player with device_id=4853b9db-96c0-4278-b8e1-bf686f3dd22a
2024-07-08T02:39:20.667182Z  INFO spotify_player::streaming: Starting an integrated Spotify player using librespot's spirc protocol

Look like the app is run w/o any audio device 🤔 . Can you try re-install?

aome510 commented 2 months ago

Also, can you make sure that the correct binary with correct set of features is run? From the above log, it seems that you run the binary installed by cargo install spotify_player --no-default-features

platorotto commented 2 months ago

Also, can you make sure that the correct binary with correct set of features is run? From the above log, it seems that you run the binary installed by cargo install spotify_player --no-default-features

okay, i removed everything and redownloaded using cargo install spotify_player --no-default-features --features pulseaudio-backend but I'm stuck with a cargo problem. I'm getting this error warning: be sure to add /home/alejandro/.cargo/bin to your PATH to be able to run the installed binaries and I'm not quite sure how to fix it. I'm a noob with bash stuff and I'm using zsh as of rn

aome510 commented 2 months ago

Oh it's not an error but just a warning, so that you can run the downloaded binary with spotify_player. You can update $PATH by adding export PATH="$HOME/.cargo/bin:$PATH" to your .zshrc. You should also be able to run the binary directly with ./home/alejandro/.cargo/bin/spotify_player

platorotto commented 2 months ago

Oh it's not an error but just a warning, so that you can run the downloaded binary with spotify_player. You can update $PATH by adding export PATH="$HOME/.cargo/bin:$PATH" to your .zshrc. You should also be able to run the binary directly with ./home/alejandro/.cargo/bin/spotify_player

Fixed it! I added that to .zshrc, relogged and it worked. Thanks!!