Repository navigation
fix(player): let Previous restart the first song of the queue - #2738
Open
iDiagoValeta wants to merge 1 commit into
Open
iDiagoValeta wants to merge 1 commit into
iDiagoValeta wants to merge 1 commit into
Conversation
Every player UI gated the Previous click on isPreviousAvailable, which is hasPreviousMediaItem(). On the first item of the queue that is false, so the button was greyed out and did nothing, even after the song had played for minutes. The player adapters already fall back to seekTo(0) when there is no previous item, and the media session exposes COMMAND_SEEK_TO_PREVIOUS for that reason, so the notification button worked while the in-app one did not. Previous is now always enabled and always sends UIEvent.Previous; the player decides between restarting and going back. Next keeps its gate.
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.
What & why
On the first song of the queue the in-app Previous button was greyed out and did nothing, so the song could not be restarted from 0:00. Every player UI gated the click on
isPreviousAvailable(hasPreviousMediaItem()), which is false on the first item.The player adapters already handle that case (
seekToPrevious()falls back toseekTo(0)when there is no previous item), and the media session always exposesCOMMAND_SEEK_TO_PREVIOUSfor it, which is why the notification button already worked. This PR removes the gate from the Previous button only: it is always enabled and always sendsUIEvent.Previous, and the player decides between restarting and going back. Next keeps its gate.Touched:
PlayerControlLayout,FullscreenPlayer,AppleMusicShared,ExpressiveTransportRow(plus its KDoc), and the four Previous buttons in the desktopMiniPlayerLayout. No changes incore.Linked issue
Closes #2737
Checklist
Not tested on a device yet: the change was verified by reading the code path from the button down to
seekToPrevious()in both adapters.The issue was opened together with this PR, so it is not accepted yet.