Skip to content

fix: report a resume that fails as a playback_error - #451

Open
spockfish wants to merge 1 commit into
devgianlu:masterfrom
verox-audio:fix/report-failed-resume
Open

spockfish wants to merge 1 commit into
devgianlu:masterfrom
verox-audio:fix/report-failed-resume

Conversation

@spockfish

Copy link
Copy Markdown
Contributor

Resuming a paused track opens the output again. When another program holds the device, that fails, and play() returns the error to the dealer request, but API clients hear nothing: no playing, no playback_error. The Spotify app shows the track playing at 0:00 while nothing plays, and a client that manages the device for several players can't tell that go-librespot wanted it.

What happens

Another player holds the ALSA device while go-librespot's session is paused. Pressing play in the Spotify app:

level=warning msg="failed handling dealer request" error="failed starting playback: ALSA error at snd_pcm_open: Device or resource busy"

and no event on the API's websocket. A load that fails the same way already emits playback_error (stage load); a resume didn't.

Fix

play() emits a playback_error with a new stage, resume, when seeking before play or starting the output fails. The track stays paused. API.md lists the new stage.

Tested

  • Unit test: a paused track with a player that can't start reports one playback_error with stage resume and the track's URI, and stays paused.
  • On a Raspberry Pi 3 (aarch64): with go-librespot paused and another player on the DAC, play from the Spotify app now emits the event. Our client uses it to make the other player let go of the device and then calls /player/resume, which plays.

🤖 Generated with Claude Code

Resuming a paused track opens the output again, which fails when another
program holds the device. play() returned the error to the dealer and
API clients heard nothing: the Spotify app showed the track playing at
0:00. It now emits a playback_error with stage "resume"; the track stays
paused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant