music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.39k stars 51 forks source link

Spotify - Stream appears to play but no sound output - HA media player stuck buffering. #2982

Closed jazzyisj closed 1 month ago

jazzyisj commented 1 month ago

What version of Music Assistant has the issue?

2.3.0b28

What version of the Home Assistant Integration have you got installed?

2024.9.1

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

Streaming Spotify - no sound output.

MASS media player appears to be playing with album art, progress indicator etc. HA media player remains in buffering state. Youtube, TuneIn, Radio, and local files all work as expected.

I've removed the spotify provider and reinstalled it. I've cleared the core cache. I've restarted the server and reloaded the integration. Spotify plays from computers, phones, and on all cast devices without MASS with no issues. Happens on all media players (Cast, Fully Kiosk)

image image

How to reproduce

Play a spotify playlist, album, or song.

Music Providers

Spotify

Player Providers

All media players. Cast (Nest Hubs, Nest Mini's, Chromecasts, and Google Home), Fully Kiosk.

Full log output

music-assistant.log

Additional information

This has been happening fore the last couple beta releases.

What version of Home Assistant Core are your running

2024.10.0b4

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

ODROID

marcelveldt commented 1 month ago

Can you go into MA settings --> Core modules --> Streamserver --> advanced section. Check if the publish IP there matches your internal local IP

jazzyisj commented 1 month ago

Yep, Public IP looks ok. 192.168.1.100

marcelveldt commented 1 month ago

Did you check another source, like radio station to verify if this is isolated to spotify ?

jazzyisj commented 1 month ago

Yes. Youtube Music, Tune In, and local files all work fine. Listening to YT music right now :-)

jazzyisj commented 1 month ago

Updated to 2.3.0b29, problem persists but now I'm getting errors in the MASS log.

music-assistant.log

marcelveldt commented 1 month ago

OK so it appears that librespot itself is simply not outputting any audio. I indeed added an exception to the code to catch that (and prevent it from getting stuck indefinitely).

Couple of questions:

1) Did it ever work ? Like before version 2.2 or 2.1 ? 2) Are you using a Spotify premium account ?

jazzyisj commented 1 month ago

Yes I have Spotify premium. I've been using Spotify with MASS pretty much since the day you released it. It only stopped working maybe 2 or 3 updates ago. Am I really the only one having an issue? I don't think anything has changed on my that might have caused this.

marcelveldt commented 1 month ago

We had/have some nasty issues with (Spotify) playback lately but this is not one of them tbh so the issue seems to be isolated to your case so far.

The only other thing that could be going on is that its account related but that is super far stretched. Do you have discord ? Can you PM me there please ? I like to send you a test account to try out to rule out if its maybe account related.

jazzyisj commented 1 month ago

I PM'd you on discord. I've logged into my Spotify account to check and it's definitely a Premium Family Plan in good standing. There is only one account on there now so that can't be the issue. Spotify is working correctly on all my other devices.

This is the service call I've been using in Dev Tools to test (with various valid Playlist names). I've also tried with Artist, Track, and Album with the same results.

action: mass.play_media
data:
  media_id: All Out 60s
  media_type: playlist
target:
  entity_id:
    - media_player.office_hub_2
jazzyisj commented 1 month ago

We have discovered the issue! Thank you for pointing me in the right direction marcelveldt.

The Pi-Hole on my network randomly starting blocking requests to a domain spotify is calling. I don't know if my adlist got updated or if Spotify made a change but if you run into this issue check if these domains are getting blocked on your Pi-Hole and whitelist them if they are.

audio-ak-spotify-com.akamaized.net
audio-akp-spotify-com.akamaized.net