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

Fix: Reauthenticate with SiriusXM when playing a station #1789

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions music_assistant/providers/siriusxm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ async def get_stream_details(
self, item_id: str, media_type: MediaType = MediaType.RADIO
) -> StreamDetails:
"""Get streamdetails for a track/radio."""
# There's a chance that the SiriusXM auth session has expired
# by the time the user clicks to play a station. The sxm-client
# will attempt to reauthenticate automatically, but this causes
# a delay in streaming, and ffmpeg raises a TimeoutError.
# To prevent this, we're going to explicitly authenticate with
# SiriusXM proactively when a station has been chosen to avoid
# this.
await self._client.authenticate()

hls_path = f"http://{self._base_url}/{item_id}.m3u8"

# Keep a reference to the current `StreamDetails` object so that we can
Expand Down
Loading