Optimize shuffle performance for large queues#594
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| withContext(Dispatchers.Main) { | ||
| player.setMediaItems(reorderedItems, safeIndex, positionMs) | ||
| } |
There was a problem hiding this comment.
Shuffle toggle replaces playlist without preparing or resuming
When toggling shuffle on/off, rebuildPlayerQueue calls player.setMediaItems(...) without a subsequent prepare()/play(). Player#setMediaItems resets the controller to an unprepared state, so an active session will stop playback and remain idle after shuffle/unshuffle. The prior implementation used move/add operations to preserve playback, and elsewhere in this file setMediaItems is followed by prepare()/play() (e.g., lines ~1734-1743), indicating preparation is required. Result: enabling or disabling shuffle during playback will silence the player until the user manually hits play.
Useful? React with 👍 / 👎.
- Remove redundant `kotlin.random.Random` imports in `PlayerViewModel.kt`. - Introduce `headerPadding` to `QueueMiniPlayer` to dynamically adjust top padding. - Remove redundant horizontal padding from the `QueueMiniPlayer` modifier in `QueueBottomSheet.kt`, centralizing padding logic within the component itself.
|
much needed, good job! |
Summary
Testing
Codex Task