Fix ESP32 audio dropouts and improve streaming reliability
FLAC encoder now tracks frame numbers and reuses per-channel sample buffers to reduce allocations. Client dialer always frees the active slot on release so mDNS re-emissions can reconnect cleanly. Server send buffer uses drop-oldest instead of hard failure, with lateness tracking. Added engine stats logging (chunks/sec, kbps) and writer diagnostics. UI simplified to a single play/pause toggle that auto-starts playback on preset selection. Added --preset CLI flag for headless startup. Removed stale systemd service files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -205,9 +205,7 @@
|
||||
<div class="row">
|
||||
<span class="grow">Playback</span>
|
||||
<div class="btn-group">
|
||||
<button id="btn-play">Play</button>
|
||||
<button id="btn-pause">Pause</button>
|
||||
<button id="btn-stop">Stop</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -331,10 +329,12 @@ function render() {
|
||||
}
|
||||
sel.value = state.active_preset || "";
|
||||
|
||||
// playback buttons
|
||||
$("btn-play").disabled = !state.active_preset || state.playback === "playing";
|
||||
$("btn-pause").disabled = state.playback !== "playing";
|
||||
$("btn-stop").disabled = !state.active_preset;
|
||||
// playback toggle button: pauses when playing, resumes when paused.
|
||||
// Disabled when no preset is active (selector controls play/stop).
|
||||
const pauseBtn = $("btn-pause");
|
||||
pauseBtn.disabled = !state.active_preset;
|
||||
pauseBtn.textContent = state.playback === "paused" ? "Play" : "Pause";
|
||||
pauseBtn.dataset.cmd = state.playback === "paused" ? "play" : "pause";
|
||||
|
||||
// volume slider
|
||||
$("volume-label").textContent = state.volume + "%";
|
||||
@@ -429,9 +429,11 @@ $("active-preset").addEventListener("change", async (e) => {
|
||||
refreshAll();
|
||||
});
|
||||
|
||||
$("btn-play").onclick = async () => { await api("POST", "/api/playback", { command: "play" }).catch(e => alert(e.message)); refreshAll(); };
|
||||
$("btn-pause").onclick = async () => { await api("POST", "/api/playback", { command: "pause" }).catch(e => alert(e.message)); refreshAll(); };
|
||||
$("btn-stop").onclick = async () => { await api("POST", "/api/playback", { command: "stop" }).catch(e => alert(e.message)); refreshAll(); };
|
||||
$("btn-pause").onclick = async () => {
|
||||
const cmd = $("btn-pause").dataset.cmd || "pause";
|
||||
await api("POST", "/api/playback", { command: cmd }).catch(e => alert(e.message));
|
||||
refreshAll();
|
||||
};
|
||||
|
||||
const vol = $("volume");
|
||||
vol.addEventListener("input", () => { volumeDirty = true; $("volume-label").textContent = vol.value + "%"; });
|
||||
|
||||
Reference in New Issue
Block a user