Skip to content

fix: skip unavailable Spotify tracks during playback#173

Open
gjermundgaraba wants to merge 4 commits intobjarneo:mainfrom
gjermundgaraba:fix/spotify-unavailable-tracks
Open

fix: skip unavailable Spotify tracks during playback#173
gjermundgaraba wants to merge 4 commits intobjarneo:mainfrom
gjermundgaraba:fix/spotify-unavailable-tracks

Conversation

@gjermundgaraba
Copy link
Copy Markdown
Contributor

I noticed when we hit unavailable tracks on Spotify, the player would just derp out and stop.
Fixing this was surprisingly gnarly, but I think the approach taken here is quite robust and can be reused for other providers if they have similar concepts.

image

Design decisions:

  • Spotify tracks that are marked unplayable are kept in the playlist and flagged on the shared playlist.Track struct instead of being dropped from playlist navigation. This keeps the visible playlist aligned with Spotify, avoids index mismatches, and makes the flag available to any provider.
  • Skip logic now lives in the playlist package. Next(), Prev(), PeekNext(), and ActivateSelected() resolve playable tracks internally, so the UI no longer needs retry loops or provider-specific playability checks.
  • Navigation uses rollback-on-failure for playlist position/current track: if no playable track is found, the active position is restored and false is returned, so the UI cursor and playback state do not drift. Unplayable queued entries are still pruned when consumed.
  • Unplayable queue entries are pruned lazily when advancing playback rather than eagerly removed, which avoids extra change propagation.
  • ActivateSelected() separates selection from activation: it resolves the selected row to the next playable track in playlist order, reports whether a skip occurred, and lets the UI show a message without owning playability rules.
  • Unplayable tracks are rendered in the playlist as dimmed rows with an (unavailable) suffix, so skipped items remain visible to the user.

Mark Spotify tracks as unplayable when the API reports restrictions,
skip them in next/prev/activate playback flows, and surface their
state in the playlist UI.

Add coverage for playlist navigation and playback behavior around
unavailable tracks.
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