Skip to content

feat(player): complete MediaSession handlers + teardown - #27

Merged
EnesYilmazcode merged 1 commit into
mainfrom
claude/funny-hawking-930hed
Jul 15, 2026
Merged

EnesYilmazcode merged 1 commit into
mainfrom
claude/funny-hawking-930hed

Conversation

@EnesYilmazcode

Copy link
Copy Markdown
Owner

Fixes #10. Fixes #11.

Problem

  • The lock screen / Control Center / CarPlay expose a stop control and 15s skip (seekbackward/seekforward) that had no handlers, so those affordances did nothing.
  • The registration effect never cleared its handlers, so when the queue emptied the lock screen stayed bound to the previous track's stale closures.
  • playbackState was set only from isPlaying, so it never reflected the "nothing loaded" state.

Fix

Verification

Built clean; runtime smoke test:

Check Result
Play → metadata.title set, playbackState "Last Stop", playing
Pause → playbackState paused
All handlers register (no throw) none ✅

⚠️ The remote actions themselves (AirPods stem, lock-screen skip) can't be triggered in a headless browser — worth a quick real-device check, but registration + state sync are confirmed.

🤖 Generated with Claude Code


Generated by Claude Code

The lock screen / Control Center / CarPlay expose a stop control and 15s skip
(seekbackward/seekforward) that had no handlers, so those affordances did
nothing. The registration effect also never cleared its handlers, so when the
queue emptied the lock screen stayed bound to the previous track's closures.

- Register stop, seekbackward, seekforward (plus the existing seekto), each
  wrapped so an engine that doesn't support an action doesn't throw.
- Tear all handlers down on cleanup and when nothing is loaded (also clear
  metadata), via a shared MEDIA_ACTIONS list.
- Centralize playbackState as the single source of truth: 'none' when nothing
  is loaded, else mirror isPlaying — so iOS routes the next remote press to the
  correct action.

Verified in-browser: playing sets metadata + playbackState 'playing', pausing
sets 'paused', and all handlers register without throwing.

Fixes #10. Fixes #11.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkDKh1Uo1a4D7n5wCKdcKF
@EnesYilmazcode
EnesYilmazcode merged commit 77703ec into main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants