Skip to content

fix(player): handle missing audio instead of playing the wrong track - #29

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

EnesYilmazcode merged 2 commits into
mainfrom
claude/funny-hawking-930hed

Conversation

@EnesYilmazcode

Copy link
Copy Markdown
Owner

Fixes #3.

Problem

When an imported track's bytes were gone (cleared storage / failed import), the load effect set missing and returned without touching the <audio> element, so it kept playing the previous track under a now-missing current — and nothing told the user (the missing flag was never read in the UI).

Fix

  • On a missing blob: pause(), drop src, load(), reset isPlaying — the old track actually stops.
  • Surface missing in the UI: mini bar shows "Audio unavailable — re-import", Now Playing shows a message in place of the scrubber, and the play button is disabled in both (next/prev stay enabled so you can move on).
  • Reset progress/duration at the start of every load so the scrubber doesn't flash the previous track's position (roundup item from [LOW] Roundup: playback / media-session / import code-quality cleanups #19).

Verification

Built clean; behavioral test:

Check Result
Real track playing, then switch to blob-less track → audio paused: true, src removed ✅
Mini bar text "Audio unavailable — re-import"
page errors none ✅

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits July 15, 2026 00:29
When an imported track's bytes were gone, the load effect set `missing` and
returned WITHOUT touching the <audio> element, so it kept playing the PREVIOUS
track while the UI showed the new (silent) one — and nothing told the user
anything was wrong (the `missing` flag was never read).

- On a missing blob, pause the element, drop its src, and reset isPlaying, so
  the old track actually stops.
- Surface `missing` in the UI: the mini bar shows "Audio unavailable —
  re-import" and Now Playing shows a message in place of the scrubber; the play
  button is disabled in both (nothing to play), while next/prev stay enabled so
  you can move on.
- Reset progress/duration at the start of every load so the scrubber doesn't
  briefly show the previous track's position.

Verified in-browser: playing a real track then switching to a blob-less track
stops the audio (paused, src removed) and shows the unavailable message.

Fixes #3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkDKh1Uo1a4D7n5wCKdcKF
Review follow-up: release the prior track's object URL when we bail on a
missing blob, instead of leaving it allocated until the next successful load.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkDKh1Uo1a4D7n5wCKdcKF
@EnesYilmazcode
EnesYilmazcode merged commit 63171cd 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

Development

Successfully merging this pull request may close these issues.

[HIGH] Missing audio blob: previous track keeps playing & no UI feedback

2 participants