Use index-based tracking for player carousel and playback queue#1924
Merged
Conversation
This change shifts the player UI and carousel logic from identifying tracks by ID to using their specific index in the playback queue. This improves support for queues containing duplicate songs by ensuring the UI correctly maps to the active media item. Key changes: - Pass `currentMediaItemIndex` through `UnifiedPlayerSheetLayers`, `FullPlayerContent`, and `AlbumCarouselSelection`. - Replace ID-based carousel state (`pendingCarouselSongId`) with index-based state (`pendingCarouselIndex`). - Update skip prediction logic (`predictSkipNextCarouselIndex`, `predictSkipPreviousCarouselIndex`) to operate on indices instead of track IDs. - Implement `buildQueueOccurrenceKeys` in `AlbumCarouselSelection` to generate unique keys for carousel items, preventing stable ID collisions when the same song appears multiple times in a queue. - Add helper functions to resolve the current queue index by prioritizing the media player's reported index over a simple ID lookup.
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.
This change shifts the player UI and carousel logic from identifying tracks by ID to using their specific index in the playback queue. This improves support for queues containing duplicate songs by ensuring the UI correctly maps to the active media item.
Key changes:
currentMediaItemIndexthroughUnifiedPlayerSheetLayers,FullPlayerContent, andAlbumCarouselSelection.pendingCarouselSongId) with index-based state (pendingCarouselIndex).predictSkipNextCarouselIndex,predictSkipPreviousCarouselIndex) to operate on indices instead of track IDs.buildQueueOccurrenceKeysinAlbumCarouselSelectionto generate unique keys for carousel items, preventing stable ID collisions when the same song appears multiple times in a queue.