forked from Foxyz/sync_replay_project
Protocol 13: Up next preloads, so switching to it is instant
Every app gets the first Up next item ready itself (own Jellyfin plan, direct links, guests via /j when state.relayNext says the server's login can pass it on) and opens it in a hidden, muted, paused second player; the swap promotes that player instead of opening cold, so its buffer counts at once. Reports go out on open and when the buffer reaches the gate's need. SwitchTrace times each phase. Measured in the e2e harness: 1.5-3 s before, 35-103 ms with a preload. Relayed items still open cold for everyone but their source (ROADMAP). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4275abe470
commit
ddd7a21195
19 files changed
+1041
-142
No files matched your search
@@ -66,13 +66,16 @@ void main() {
|
||||
MemberView(id: 'm2', name: 'b', ready: false, inSet: false, buffered: 0, stale: false),
|
||||
],
|
||||
relay: true,
|
||||
relayNext: true,
|
||||
);
|
||||
final json = wire(state.toJson());
|
||||
expect(json['relay'], true);
|
||||
expect(json['relayNext'], true);
|
||||
expect((json['members'] as List)[0], containsPair('jf', {'abc123': false}));
|
||||
expect((json['members'] as List)[1], isNot(contains('jf')));
|
||||
final back = StateBroadcast.fromJson(json);
|
||||
expect(back.relay, isTrue);
|
||||
expect(back.relayNext, isTrue);
|
||||
expect(back.members[0].jf, {'abc123': false});
|
||||
expect(back.members[1].jf, isEmpty);
|
||||
expect(HelloMedia.fromJson(back.media!).jellyfin, ref);
|
||||
@@ -80,7 +83,9 @@ void main() {
|
||||
final plain = StateBroadcast(
|
||||
eventId: 1, transport: 'held', position: 0, serverTime: DateTime.utc(2026), mediaId: 1, members: const []);
|
||||
expect(plain.toJson().containsKey('relay'), isFalse);
|
||||
expect(plain.toJson().containsKey('relayNext'), isFalse);
|
||||
expect(StateBroadcast.fromJson(wire(plain.toJson())).relay, isFalse);
|
||||
expect(StateBroadcast.fromJson(wire(plain.toJson())).relayNext, isFalse);
|
||||
});
|
||||
|
||||
test('welcome relayUrl round-trips, omitted when null', () {
|
||||
|
||||
Reference in new issue
Block a user