mirror of
https://codeberg.org/armin/noiz.git
synced 2026-09-01 14:00:54 +02:00
fix: stop audio playback when currently playing track is deleted
This commit is contained in:
parent
ba7d3d0310
commit
c944e1eb4a
1 changed files with 8 additions and 0 deletions
|
|
@ -1043,6 +1043,14 @@ function deleteTrack() {
|
||||||
if (selectedIndices.size === 0) return;
|
if (selectedIndices.size === 0) return;
|
||||||
const sortedSel = [...selectedIndices].sort((a, b) => a - b);
|
const sortedSel = [...selectedIndices].sort((a, b) => a - b);
|
||||||
const willDeleteCurrent = selectedIndices.has(currentIndex);
|
const willDeleteCurrent = selectedIndices.has(currentIndex);
|
||||||
|
if (willDeleteCurrent) {
|
||||||
|
audio.pause();
|
||||||
|
audio.currentTime = 0;
|
||||||
|
if (isCrossfading) {
|
||||||
|
audioNext.pause();
|
||||||
|
audioNext.currentTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (selectedIndices.size === tracks.length) {
|
if (selectedIndices.size === tracks.length) {
|
||||||
for (const idx of sortedSel) {
|
for (const idx of sortedSel) {
|
||||||
if (idx !== currentIndex) URL.revokeObjectURL(tracks[idx].url);
|
if (idx !== currentIndex) URL.revokeObjectURL(tracks[idx].url);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue