Skip to content

fix(player): let Previous restart the first song of the queue - #2738

Open
iDiagoValeta wants to merge 1 commit into
maxrave-dev:devfrom
iDiagoValeta:fix/previous-restarts-first-song
Open

iDiagoValeta wants to merge 1 commit into
maxrave-dev:devfrom
iDiagoValeta:fix/previous-restarts-first-song

Conversation

@iDiagoValeta

@iDiagoValeta iDiagoValeta commented Oct 24, 2026 •

Copy link
Copy Markdown

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 to seekTo(0) when there is no previous item), and the media session always exposes COMMAND_SEEK_TO_PREVIOUS for 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 sends UIEvent.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 desktop MiniPlayerLayout. No changes in core.

Linked issue

Closes #2737

Checklist

  • This PR addresses an accepted issue (linked above)
  • I wrote or personally reviewed every line of this change
  • I tested it on Android and/or Desktop (say which, and how)

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.

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.
Copilot AI balanced review requested due to automatic review settings October 24, 2026 10:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

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.

[Bug]: Previous button does nothing on the first song of the queue instead of restarting it

2 participants