stream: show "Connexion en cours" until prefetch is known
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
bfa7cc1046
commit
126cb8f8ac
1 changed files with 6 additions and 4 deletions
|
|
@ -102,7 +102,7 @@
|
|||
<div class="bg" id="bg"></div>
|
||||
<main class="card">
|
||||
<div class="logo" id="stationName">◈</div>
|
||||
<div class="np-label"><span class="dot"></span><span id="npLabel">Préchargement</span><span id="provider" class="provider" hidden></span></div>
|
||||
<div class="np-label"><span class="dot"></span><span id="npLabel">Connexion en cours</span><span id="provider" class="provider" hidden></span></div>
|
||||
<div class="title" id="title">—</div>
|
||||
<div class="artist" id="artist"></div>
|
||||
<audio id="player" controls autoplay preload="none"></audio>
|
||||
|
|
@ -182,12 +182,14 @@
|
|||
const r = await fetch("/ingest/status", { cache: "no-store" });
|
||||
const s = await r.json();
|
||||
const ready = Number(s.ready) || 0;
|
||||
const prefetch = Number(s.prefetch) || 0;
|
||||
if (prefetch > 0 && ready >= prefetch) {
|
||||
const prefetch = Number.isFinite(Number(s.prefetch)) ? Number(s.prefetch) : -1;
|
||||
if (prefetch >= 0 && ready >= prefetch) {
|
||||
bufferFull = true;
|
||||
npLabel.textContent = "en cours";
|
||||
} else if (prefetch >= 0) {
|
||||
npLabel.textContent = `Préchargement ${ready}/${prefetch}`;
|
||||
} else {
|
||||
npLabel.textContent = `Préchargement ${ready}/${prefetch || "…"}`;
|
||||
npLabel.textContent = "Connexion en cours";
|
||||
}
|
||||
} catch (e) { /* keep last known label */ }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue