Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,11 @@
}
return {
start: start, advance: advance, hasNext: hasNext, active: active, clear: clear,
// True when the current song is a queue ADVANCE (song 2..N of a set),
// false for its first song or a standalone play. The venue uses this to
// fly in once on arrival at the set, then continue the room between
// songs instead of replaying the arrival flyover every track.
isContinuation: function () { return active() && idx > 0; },
// One-shot: true iff _play just kicked off this playSong. Consumed on
// read so a later MANUAL play still clears the queue. playSong calls this
// instead of trusting options.fromQueue to survive the wrapper chain.
Expand Down Expand Up @@ -1493,7 +1498,7 @@
leaveBtn.style.cssText = 'padding:8px 14px;border:0;border-radius:8px;background:#4080e0;color:#fff;font-weight:600;cursor:pointer';

let settled = false;
function close(leave) {

Check warning on line 1501 in static/app.js

View workflow job for this annotation

GitHub Actions / ci / lint

File has too many lines (2348). Maximum allowed is 1500
if (settled) return;
settled = true;
_exitConfirmOpen = false;
Expand Down
22 changes: 21 additions & 1 deletion static/v3/venue-crowd.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,27 @@
_loadingLoop = null;
_fadingLoop = null;
if (_venueActive && _manifest) {
if (!playIntro()) showLoop(machine.current, FADE_MS);
// The flyover is ARRIVING at the venue, and you arrive once. Songs
// 2..N of a set (a gig / album / playlist) are a NEW song but the
// SAME arrival — the camera should not fly in from the back of the
// room before every track (tester: "it showed the flyover intro
// again" on a gig's second song). Continue the room to the new song's
// loop; only a first-song / standalone arrival flies in.
if (_isSetContinuation()) showLoop(machine.current, FADE_MS);
else if (!playIntro()) showLoop(machine.current, FADE_MS);
}
}

// Is this song load a continuation of a play queue (a set already in
// progress), rather than an arrival? True for song 2..N of a gig/album/
// playlist. The queue owns the answer; treat any error / absent queue as
// "not a continuation" so a standalone play still flies in.
function _isSetContinuation() {
try {
const q = window.feedBack && window.feedBack.playQueue;
return !!(q && typeof q.isContinuation === 'function' && q.isContinuation());
} catch (_) {
return false;
}
}

Expand Down
17 changes: 17 additions & 0 deletions tests/js/play_queue_peek.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,20 @@ test('fromQueue in options still works on its own (in-band path)', () => {
clearGuard(win, { fromQueue: true });
assert.strictEqual(q.active(), true, 'options.fromQueue alone must still keep the queue');
});

// isContinuation(): true for song 2..N of a set, false for the first song / a
// standalone play. The venue uses it to fly in once on arrival, then carry the
// room between songs instead of replaying the arrival flyover every track
// (tester: "it showed the flyover intro again" on a gig's second song).
test('isContinuation is false on the first song, true after advancing', () => {
const { q } = makeQueue();
assert.strictEqual(q.isContinuation(), false, 'idle queue is not a continuation');
q.start(['a.sloppak', 'b.sloppak', 'c.sloppak'], { source: 'gig' });
assert.strictEqual(q.isContinuation(), false, 'the FIRST song of a set is an arrival, not a continuation');
q.advance();
assert.strictEqual(q.isContinuation(), true, 'song 2 is a continuation — no re-flyover');
q.advance();
assert.strictEqual(q.isContinuation(), true, 'song 3 too');
q.clear();
assert.strictEqual(q.isContinuation(), false, 'a cleared queue is not a continuation');
});
19 changes: 19 additions & 0 deletions tests/js/venue_scope.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,22 @@ test('a throwing document does not take the venue down with it', () => {
global.document = prev;
}
});

// The arrival flyover must NOT replay for songs 2..N of a set. onSongLoaded
// consults the play queue: a continuation (gig/album/playlist song 2+) carries
// the room over with a loop crossfade, only an arrival plays the intro.
test('a set continuation carries the room over instead of re-flying-in', () => {
const fs = require('node:fs');
const path = require('node:path');
const src = fs.readFileSync(path.join(__dirname, '..', '..', 'static', 'v3', 'venue-crowd.js'), 'utf8');
const start = src.indexOf('function onSongLoaded(');
const open = src.indexOf('{', src.indexOf(')', start));
let depth = 1, i = open + 1;
while (i < src.length && depth > 0) { const ch = src[i]; if (ch === '{') depth++; else if (ch === '}') depth--; i++; }
const fn = src.slice(start, i);
const contIdx = fn.search(/_isSetContinuation\s*\(\s*\)/);
const introIdx = fn.search(/playIntro\s*\(/);
assert.ok(contIdx !== -1, 'onSongLoaded must consult the set-continuation signal');
assert.ok(introIdx !== -1, 'the intro must still exist for a real arrival');
assert.ok(contIdx < introIdx, 'the continuation check must gate the flyover — a set song 2+ must not fly in');
});
Loading