diff --git a/web.py b/web.py index 4a3e879..55c83fb 100644 --- a/web.py +++ b/web.py @@ -626,14 +626,15 @@ function togglePlayer(idx, filename) { if (!open) { if (!audio.getAttribute('data-src-set')) { + audio.preload = 'metadata'; audio.src = '/stream/' + encodeURIComponent(filename); + audio.load(); audio.setAttribute('data-src-set','1'); } prow.hidden = false; btn.setAttribute('aria-expanded','true'); btn.textContent = '⏹ Hide'; btn.setAttribute('aria-label','Hide player for '+filename); - // Move focus to audio control so keyboard users can operate it immediately audio.focus(); } else { audio.pause(); @@ -828,9 +829,12 @@ async function load() { prow.className = 'player-row'; prow.id = 'prow-'+i; prow.hidden = true; + const durLabel = f.duration != null + ? `
Duration: ${fmtDur(f.duration)}
` + : ''; prow.innerHTML = ` + aria-label="Playback: ${esc(f.name)}">${durLabel} `; tbody.appendChild(prow);