Player: now-playing title with cover, start banner, one status pill; media art for everyone

The swapper sends the media's poster and banner once (`art`, Jellyfin
images or AniList by parsed name); state carries their hashes and every
member fetches them from /i/ like avatars. state.media.swapBy names who
put the media up. uosc and the standard bar show cover, title and
episode; a banner card shows before playback starts. The top-left health
pill and the waiting pill become one frosted status pill in plain words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-09 01:19:34 +03:00
1 parent d092ea371a
commit b534c8c7ea
29 files changed
+1892 -236

No files matched your search

+31
View File
@@ -56,4 +56,35 @@ void main() {
await server.stop();
}
});
test('media art arrives by hash over /i/; a swap clears it', () async {
final server = SyncServer(const AppConfig(port: 0, secret: 's', name: 'art'));
await server.start();
final client = SyncClient();
final cache = ArtCache(client);
final poster = Uint8List.fromList([0xFF, 0xD8, 0xFF, ...List<int>.generate(197, (i) => i % 256)]);
try {
await client.connect(
wsUri: Uri.parse('ws://127.0.0.1:${server.boundPort}/sync'),
secret: 's',
name: 'alice',
);
client.sendSwap(const HelloMedia(name: 'Show - 01.mkv', size: 0, duration: 0, url: 'http://example.com/a.mkv'));
await _poll(() => client.lastState?.media?['swapBy'] == client.memberId, 'swap');
client.sendArt(client.lastState!.mediaId, poster: base64Encode(poster));
await _poll(() => ArtCache.artHashesOf(client.lastState!).isNotEmpty, 'art in state');
final hash = ArtCache.artHashesOf(client.lastState!).single;
expect(hash, avatarHashOf(poster));
await _poll(() => cache.bytesFor(hash) != null, 'art bytes');
expect(cache.bytesFor(hash), poster);
client.sendSwap(const HelloMedia(name: 'Other.mkv', size: 0, duration: 0, url: 'http://example.com/b.mkv'));
await _poll(() => client.lastState?.media?['name'] == 'Other.mkv', 'second swap');
expect(ArtCache.artHashesOf(client.lastState!), isEmpty);
} finally {
cache.dispose();
await client.dispose();
await server.stop();
}
});
}