fix: skip unavailable Spotify tracks during playback#173
Open
gjermundgaraba wants to merge 4 commits intobjarneo:mainfrom
Open
fix: skip unavailable Spotify tracks during playback#173gjermundgaraba wants to merge 4 commits intobjarneo:mainfrom
gjermundgaraba wants to merge 4 commits intobjarneo:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Design decisions:
playlist.Trackstruct 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.Next(),Prev(),PeekNext(), andActivateSelected()resolve playable tracks internally, so the UI no longer needs retry loops or provider-specific playability checks.falseis returned, so the UI cursor and playback state do not drift. Unplayable queued entries are still pruned when consumed.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.(unavailable)suffix, so skipped items remain visible to the user.