From 286a24214f22e0817a97fc29b9ed465c0d91a6fc Mon Sep 17 00:00:00 2001 From: byrongamatos Date: Sun, 12 Jul 2026 01:35:17 +0200 Subject: [PATCH] fix(venue-crowd): bail loop-fade completion when a stinger preempted the layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex preflight round 6: the loop crossfade's completion callback could still run between a stinger's start and its canplaythrough, promoting the stinger's layer to active and pausing the real loop — it now bails when the fading loop was preempted. Co-Authored-By: Claude Fable 5 --- static/v3/venue-crowd.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/v3/venue-crowd.js b/static/v3/venue-crowd.js index 2e92422..2981bf7 100644 --- a/static/v3/venue-crowd.js +++ b/static/v3/venue-crowd.js @@ -240,7 +240,12 @@ if (!ok || !_venueActive) return; _fadingLoop = state; fadeMixTo(layer === 1 ? 1 : 0, fadeMs, () => { - if (_fadingLoop === state) _fadingLoop = null; + // Preempted mid-fade (stinger claimed this layer while we + // were still ramping): the layer no longer holds this loop — + // promoting it would pause the real loop and hand fade-back + // the wrong target. + if (_fadingLoop !== state) return; + _fadingLoop = null; const old = _videos[_activeLayer]; _activeLayer = layer; if (old && !old.paused) old.pause();