diff --git a/stream/index.html b/stream/index.html index d9f2a60..690ed52 100644 --- a/stream/index.html +++ b/stream/index.html @@ -41,6 +41,16 @@ transition: background .15s; } .share button:hover { background: rgba(155,140,255,.3); } + .actions { display: flex; gap: .5rem; margin-top: .75rem; } + .actions button, .actions a { + flex: 1; text-align: center; text-decoration: none; + padding: .6rem .9rem; font-size: .85rem; font-weight: 600; cursor: pointer; + color: #f2f0f7; background: rgba(155,140,255,.18); + border: 1px solid rgba(155,140,255,.35); border-radius: 10px; + transition: background .15s; + } + .actions button:hover, .actions a:hover { background: rgba(155,140,255,.3); } + .actions button:disabled { opacity: .5; cursor: default; } .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; margin-right: .4rem; vertical-align: middle; box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: pulse 2s infinite; } @@ -58,6 +68,9 @@
+
+ +
@@ -113,6 +126,15 @@ setTimeout(() => { copyBtn.textContent = prev; }, 1500); }); + // Passer au morceau suivant. + const skipBtn = document.getElementById("skipBtn"); + skipBtn.addEventListener("click", async () => { + skipBtn.disabled = true; + try { await fetch("/skip", { method: "POST" }); } catch (e) { /* ignore */ } + // Laisser le temps à la bascule, puis rafraîchir l'affichage. + setTimeout(() => { skipBtn.disabled = false; poll(); }, 900); + }); + poll(); setInterval(poll, 5000); diff --git a/stream/radio.liq b/stream/radio.liq index 8e536a1..6d83aa1 100644 --- a/stream/radio.liq +++ b/stream/radio.liq @@ -111,3 +111,14 @@ harbor.http.register( resp.json({title=m["title"], artist=m["artist"]}) end ) + +# Passer au morceau suivant : on saute le morceau en cours sur la source +# diffusée. request.dynamic a déjà préchargé le suivant, donc l'enchaînement +# est immédiat (le prochain /next est demandé au daemon dans la foulée). +harbor.http.register( + port=8000, method="POST", "/skip", + fun(_, resp) -> begin + source.skip(radio) + resp.json({skipped=true}) + end +)