Repository navigation
Add setTracks instance method - #1380
Merged
Merged
Conversation
|
Size Change: 0 B Total Size: 490 kB ℹ️ View Unchanged
|
✅ Deploy Preview for tourmaline-kringle-c98715 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
captbaritone
force-pushed
the
set-tracks-without-playing
branch
2 times, most recently
from
October 15, 2026 16:42
462136f to
7c4bf87
Compare
setTracksToPlay always starts playing the first track, so embedders who want to swap the source without autoplaying had to dispose() and create a new instance. setTracks replaces the playlist, stops any current playback, and loads the first track (like initialTracks) without playing it.
captbaritone
force-pushed
the
set-tracks-without-playing
branch
from
October 15, 2026 17:00
7c4bf87 to
fb74c51
Compare
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.
setTracksToPlay(tracks)replaces the playlist but always starts playing (LOAD_STYLE.PLAY). An embedder who wants to swap the source without autoplaying, e.g. when the user selects a different file in a list, has todispose()and create a new Webamp instance.This adds:
It replaces the playlist and stops any current playback. The first track is loaded the same way
initialTracksare (LOAD_STYLE.BUFFER), so its name and duration show up and it's ready to play, but it doesn't start.I went with a separate method rather than an options argument on
setTracksToPlay({ play: false }), because "set tracks to play, but don't play" reads oddly.Documented in the instance methods docs.
Testing
setTracks.test.tsuses a fake media class via__customMediaClass. It checks that the playlist is replaced, the first track is loaded withautoPlay: false, andplay()isn't called.tsc,eslint,prettier --checkandvitest runpass locally.