Repository navigation
Reset play state when a new album loads into the drawer - #305
Merged
Merged
Conversation
Swapping src on a playing audio element pauses it without firing a pause event, so the play button and progress bar kept showing the previous track as playing. Handle emptied to reflect the paused state and reset the progress display.
sabjorn
requested changes
Oct 2, 2026
sabjorn
left a comment
Owner
There was a problem hiding this comment.
remove the comment please -- and then also add a test for this. unless there are no tests for the other parts that were already here (i.e. the onpause and onended callbacks)
Collaborator
Author
|
Updated 👍 |
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.
Problem
When a track is playing and you hit Preview on a different album, the drawer keeps showing the pause button and the old progress position. You had to toggle play/pause to get it back in sync.
Cause
Assigning a new
srcto a playing<audio>element pauses it as part of the media load algorithm, but firesemptiedrather thanpause, so ouronpausehandler never ran.Fix
Handle
emptiedinbindAudioEventsto show the paused state and reset the progress bar and elapsed time. Next/prev while playing still continue playback, sinceplayfires afteremptied.Testing
npm run typecheck,npm run lint,npm testpass.Screen recording
before:
before.mov
after:
after.mov