mirror of
https://codeberg.org/armin/noiz.git
synced 2026-09-01 05:50:52 +02:00
keep visualizers active after clearing playlist while audio is still playing
This commit is contained in:
parent
6479e49d18
commit
cba38cf500
1 changed files with 9 additions and 8 deletions
17
index.html
17
index.html
|
|
@ -560,7 +560,7 @@ function drawSpectrum() {
|
|||
}
|
||||
}
|
||||
const vuCanvas = document.getElementById('vuMeter');
|
||||
if (vuCanvas && tracks.length && analyserL && analyserR) {
|
||||
if (vuCanvas && (tracks.length || !audio.paused) && analyserL && analyserR) {
|
||||
const vuctx = vuCanvas.getContext('2d');
|
||||
const vuRect = vuCanvas.getBoundingClientRect();
|
||||
const vuDpr = window.devicePixelRatio || 1;
|
||||
|
|
@ -1683,13 +1683,14 @@ isolateBtn.addEventListener('click', isolateTracks);
|
|||
deleteBtn.addEventListener('click', deleteTrack);
|
||||
clearBtn.addEventListener('click', () => {
|
||||
if (tracks.length === 0) return;
|
||||
audio.pause();
|
||||
audio.src = '';
|
||||
audio.load();
|
||||
if (isCrossfading) { audioNext.pause(); audioNext.src = ''; audioNext.load(); }
|
||||
for (const t of tracks) URL.revokeObjectURL(t.url);
|
||||
tracks = [];
|
||||
currentIndex = -1;
|
||||
if (currentIndex >= 0) {
|
||||
const current = tracks[currentIndex];
|
||||
tracks = [current];
|
||||
currentIndex = 0;
|
||||
} else {
|
||||
tracks = [];
|
||||
currentIndex = -1;
|
||||
}
|
||||
selectedIndices.clear();
|
||||
anchorTrack = null;
|
||||
renderTracks();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue