diff options
Diffstat (limited to 'static/modules/obs.js')
| -rw-r--r-- | static/modules/obs.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/static/modules/obs.js b/static/modules/obs.js index 6842522..bcf237b 100644 --- a/static/modules/obs.js +++ b/static/modules/obs.js @@ -54,6 +54,26 @@ async function post(action, body = {}) { } } +// The dashboard's running slot: what is live, the scene and the elapsed +// time, and a stop for it. +export const busy = (st) => Boolean(st.connected && (st.recording || st.streaming)); + +export function slot(st, el) { + if (!el.firstChild) { + el.innerHTML = `<i class="nf sic rec"></i> + <span class="what"><span></span></span><span class="pct num"></span> + <span class="meta"><span></span></span> + <button class="act">Stop</button>`; + } + const what = st.recording ? (st.paused ? "Recording paused" : "Recording") : "Streaming"; + el.querySelector(".what > span").textContent = `${what} · ${st.currentScene ?? ""}`; + el.querySelector(".pct").textContent = st.recording ? clock(st.recordingTime) : "live"; + el.querySelector(".meta > span").textContent = + [st.recording ? "recording" : null, st.streaming ? "streaming" : null].filter(Boolean).join(" + "); + el.querySelector(".act").onclick = () => + post(st.recording ? "record" : "stream", { on: false }); +} + function bigButton(kind, name, label, on, times) { const b = document.createElement("button"); b.className = `deck-btn ${kind}${on ? " on" : ""}`; |
