Screen sharing: stats for nerds on right-click of the stream

Codecs, picture size and frame rate, bitrate, loss, jitter and the network
path, per viewer for the sharer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 22:28:41 +02:00
co-authored by Claude Opus 5.5
parent a402d1c035
commit 68f68d1d76
4 changed files with 143 additions and 4 deletions
+6
View File
@@ -244,6 +244,12 @@ class ScreenShare {
}
}
// Raw WebRTC statistics for the overlay: of the stream we watch, or one per viewer of ours
async reports(own: boolean): Promise<{ viewer: number | null; report: RTCStatsReport }[]> {
if (!own) return this.watchPc ? [{ viewer: null, report: await this.watchPc.getStats() }] : [];
return Promise.all([...this.peers].map(async ([viewer, pc]) => ({ viewer, report: await pc.getStats() })));
}
// ─── Called by the session ────────────────────────────────────────────────
async receive(s: Session, sender: number, dataId: string, data: Uint8Array): Promise<void> {