diff --git a/simulator/static/app.js b/simulator/static/app.js index a0a5096..40c26ae 100644 --- a/simulator/static/app.js +++ b/simulator/static/app.js @@ -506,6 +506,10 @@ function controls() { return { visual: $("visual").checked ? "on" : "off", audio: $("audio").checked ? "soundtrack" : "off", + // Back-compat: a server process predating the visual/audio split still requires + // a 7-way `content` and would 422 the new payload. Send both — the current + // server ignores `content`, an old one ignores visual/audio. + content: $("visual").checked ? "video" : "off", left: +$("left").value, right: +$("right").value, dark: mood < 0 ? -mood : 0, light: mood > 0 ? mood : 0, volume: 2, brightness: 2, @@ -522,7 +526,11 @@ async function update() { if (!resp.ok) { readout.textContent = "invalid: " + resp.status; return; } const data = await resp.json(); readout.textContent = JSON.stringify(data, null, 2); - if (!data.render.video.shown) { + // Tolerate a stale server that still returns {content:{video}} instead of the + // {render:{video:{shown}}} (visual/audio-split) shape, so video works either way. + const videoShown = data.render ? !!(data.render.video && data.render.video.shown) + : !!(data.content && data.content.video); + if (!videoShown) { // Blank the screen. Cover with #black AND hide the video layers themselves — // the