fix(sim): boot silent (video off, audio 0) — no un-gestured auto-start
The post-load autoStart() flipped Video on and lifted audio to 3/10 with no user gesture. Browser autoplay policy blocks an audio play() made outside a gesture (muted video survives, sound does not), so auto-start showed video but stayed silent. Boot SILENT instead and wait for the operator to turn Video on — that click IS the gesture, and its handler couples audio to 3/10 and starts the soundtrack in-gesture, so sound reliably comes up with video. Updates the pytest e2e + Playwright e2e specs to assert boot-silent + the video-on-couples-audio wiring instead of the old auto-start wiring. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+6
-14
@@ -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 <audio> elements ideally unlock inside a user gesture (Safari); this fires
|
||||
// outside one, so a browser with a strict autoplay policy may BLOCK the first audio
|
||||
// play() until any interaction — the on-screen audio status readout will show it.
|
||||
function autoStart() {
|
||||
$("visual").checked = true;
|
||||
videoEverOn = true;
|
||||
if (audioLevel() === 0) { $("audio").value = "3"; updateAudioLevelLabel(); }
|
||||
applyAudio();
|
||||
update();
|
||||
}
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user