Skip to content

fix(player): don't restart the finished track on play/pause after the queue ends - #339

Open
loreofmin-ux wants to merge 2 commits into
tryliner:mainfrom
loreofmin-ux:fix/queue-end-play-hidden-bar
Open

loreofmin-ux wants to merge 2 commits into
tryliner:mainfrom
loreofmin-ux:fix/queue-end-play-hidden-bar

Conversation

@loreofmin-ux

@loreofmin-ux loreofmin-ux commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What

When the queue has ended and the player bar is gone, Space and the media play key no longer start the last track again in the background.

Why

At the end of the queue the engine clears the current track, so the player bar hides, but the audio element keeps the last source. Pressing Space called playerRuntime.resume(), which played that source again from the start. The track played with no bar on screen and no way to pause or skip it except pressing Space again.

Recording of the bug on 0.2.10:

How

  • playerEngine.resume() returns early when there is no current track. Every play entry point goes through it: the Space shortcut, the media session play action, the overlay and the Touch Bar.
  • New test in playerStateMachine.test.ts: a single track ends, then play/pause and resume must not reach the runtime and the status stays idle.

Checklist

  • pnpm check passes (lint, build and tests; format:check only flags CONTRIBUTING.md, controls.tsx and Notch.tsx, which already fail on main)
  • Follows AGENTS.md: no comments in code, no any
  • Screenshot or recording attached for UI changes (no UI change; recording of the bug on 0.2.10 attached)
  • Tested in the running app, not only in unit tests
  • docs/PRIVACY.md updated if this changes what the app sends off the device (not affected)
  • New strings added to en.json (none)

Summary by CodeRabbit

  • Bug Fixes
    • Playback no longer resumes when there is no current track. After the only track in a queue finishes with repeat off, using play/pause or resume keeps playback stopped and the player idle.

… queue ends

When the last track of the queue ends, the engine clears the current track
and the player bar hides, but the audio element keeps its source. Pressing
Space (or the media play key) then called the runtime resume, which played
that source again from the start with the bar still hidden and no way to
control it. resume() now does nothing when there is no current track.
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between b4a6c6e and 3619a4f.

Files selected for processing: 2
  • src/features/player/engine/playerEngine.ts
  • src/features/player/engine/playerStateMachine.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

PlayerEngine.resume() now returns without changing playback when no current track exists. A state-machine test covers the ended-queue case with repeat off.

Changes: Player resume guard

Layer / File(s) Summary
Guard resume and test ended-queue behavior
src/features/player/engine/playerEngine.ts, src/features/player/engine/playerStateMachine.test.ts
resume() returns when no current track exists. The test checks that togglePlayPause and resume do not restart playback after the only track ends with repeat off.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: feralbureau

Merge Risk: Minimal · up to 3619a

The change prevents finished tracks from restarting after the queue ends and preserves normal resume behavior when a track is selected.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: play/pause and resume no longer restart the finished track after the queue ends. The raw summary and objectives match this. The engine's resume() now returns early whe…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: play/pause and resume no longer restart the finished track after the queue ends. The raw summary and objectives match this. The engine's resume() now returns early when no current track exists, and a state-machine test covers the ended-queue case. The title is specific, uses the conventional fix(player) prefix, and fits the changeset.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch has not been deployed

No deployments
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.

1 participant