voelin-ui: show how many watch a stream, from the gateway's directory

The viewer count in the player and on the stream cards was never filled
in a real session: the engine subscribes to the gateway's stream
directory, whose entries carry the number of viewers, but the UI dropped
those updates. Keep the counts per session by stream id from
`GatewayUpdate::Streams`, `StreamStarted`, `StreamUpdated`,
`StreamRegistered` and `StreamEnded`, and show them in the player ("12
watching") and on the voice channel's stream cards. The sample data
answers with a directory, like a gateway, instead of setting the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 06:40:50 +03:00
1 parent 1041ffaf5c
commit 99bc5af617
28 files changed
+62 -12

No files matched your search

+2
View File
@@ -225,6 +225,8 @@ export struct StreamItem {
streamer: string,
// The streamer's client id (their avatar in the members).
streamer-id: int,
// How many watch it (the gateway's directory; 0 unknown).
viewers: int,
audio: bool,
// "Screen", "Window", "Camera"; and the announced bitrate ("8 Mbit/s").
kind: string,
+2 -2
View File
@@ -140,8 +140,8 @@ component StreamCard inherits Rectangle {
large: true;
y: (parent.height - self.height) / 2;
}
if stream.watching && Bridge.viewer-count > 0: Chip {
text: @tr("{} watching", Bridge.viewer-count);
if stream.viewers > 0: Chip {
text: @tr("{} watching", stream.viewers);
icon: Icons.eye;
tint: #ffffff;
fill: #060a18a0;