fix(player): handle missing audio instead of playing the wrong track - #29
Merged
Merged
Conversation
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
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.
Fixes #3.
Problem
When an imported track's bytes were gone (cleared storage / failed import), the load effect set
missingand returned without touching the<audio>element, so it kept playing the previous track under a now-missingcurrent— and nothing told the user (themissingflag was never read in the UI).Fix
pause(), dropsrc,load(), resetisPlaying— the old track actually stops.missingin 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).progress/durationat 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:
paused: true,srcremoved ✅"Audio unavailable — re-import"✅🤖 Generated with Claude Code
Generated by Claude Code