diff --git a/simulator/e2e/tests/altitude-lock.spec.ts b/simulator/e2e/tests/altitude-lock.spec.ts index 4c9c3d9..a6da1d3 100644 --- a/simulator/e2e/tests/altitude-lock.spec.ts +++ b/simulator/e2e/tests/altitude-lock.spec.ts @@ -83,13 +83,14 @@ test("audio is a 0-10 level dial", async ({ page }) => { expect(ctl.max).toBe("10"); }); -test("the experience auto-starts once loaded: video on + audio at 3/10", async ({ page }) => { +test("boots silent (video off, audio 0); turning video on couples audio to 3/10", async ({ page }) => { await boot(page); - // No gesture needed — autoStart() flips Video on and lifts audio to a gentle level - // the moment the preload finishes. - await expect.poll(() => page.evaluate(() => (document.querySelector("#visual") as HTMLInputElement).checked)).toBe(true); + // Boots SILENT — no un-gestured auto-start, so the browser autoplay block never bites. + expect(await page.evaluate(() => (document.querySelector("#visual") as HTMLInputElement).checked)).toBe(false); + expect(await page.evaluate(() => (document.querySelector("#audio") as HTMLInputElement).value)).toBe("0"); + // Turning Video on (a click gesture) lifts the audio dial to a gentle 3/10. + await enableVideo(page); await expect.poll(() => page.evaluate(() => (document.querySelector("#audio") as HTMLInputElement).value)).toBe("3"); - // The level label reflects it. expect(await page.evaluate(() => document.querySelector("#audio-level-val")?.textContent)).toBe("3"); }); diff --git a/simulator/static/app.js b/simulator/static/app.js index dbe005e..7fe28d1 100644 --- a/simulator/static/app.js +++ b/simulator/static/app.js @@ -1260,8 +1260,12 @@ async function main() { $("stage").addEventListener("wheel", onWheel, { passive: false }); update(); // render the initial state (both toggles off → black, silent) await preloadAllMedia(); // download all media, updating the loading bar - hideLoading(); // experience is ready to run smoothly - autoStart(); // once loaded: video on + gentle audio (3/10), no gesture needed + hideLoading(); // experience is ready — boots SILENT (video off, audio 0) + // No un-gestured auto-start: a browser autoplay policy blocks an audio play() made + // outside a user gesture (muted video survives, sound does not), so an auto-start + // would show video but stay silent. Instead the experience waits for the operator to + // turn Video on — that click IS the gesture, and its handler (above) lifts audio to + // 3/10 and starts the soundtrack in-gesture, so sound reliably comes up with video. } // Populate the language dropdown from the registry and wire live switching. @@ -1297,16 +1301,4 @@ function setLanguage(lang) { if (lastAffect) renderAffect(lastAffect.strength, lastAffect.intensity, lastAffect.right); } -// Auto-start the experience the moment media is ready: bring Video on and the audio -// level to 3/10 (the same gentle default the first manual Video-on couples in). The -// audio