diff --git a/src/scripts/theme/webamp/index.ts b/src/scripts/theme/webamp/index.ts index 0d52c5f..7427cce 100644 --- a/src/scripts/theme/webamp/index.ts +++ b/src/scripts/theme/webamp/index.ts @@ -52,11 +52,17 @@ async function loadAndInsert() { if (inserting) return; inserting = true; const tracks = await loadTracks(); - // TODO: Webamp shouldn't stop playing the active track whenever the playlist changes. - amp.setTracksToPlay([]); + + // TODO: This kinda messes up the UI, + // but at least the active audio doesn't stop playing. + amp.store.dispatch({ type: "REMOVE_ALL_TRACKS" }); + // TODO: Webamp blows up if you add too much tracks amp.appendTracks(tracks.slice(0, 1000)); - amp.nextTrack(); + + const status = amp.getMediaStatus(); + if (status !== "PLAYING") amp.nextTrack(); + inserting = false; }