From 799619557bad032c6bb50b2c6228788e46d01c49 Mon Sep 17 00:00:00 2001 From: "Timo K." Date: Thu, 8 Oct 2026 16:35:01 +0200 Subject: [PATCH] [SDK] make stats$ a polled method and add audioLevel$ to audio tracks --- sdk/SdkArchitecture.md | 16 ++-- sdk/dev/main.ts | 2 +- sdk/src/media-api.ts | 25 +++--- .../livekit/LivekitMediaTrack.test.ts | 85 +++++++++++++++++-- .../livekit/LivekitMediaTrack.ts | 34 +++++--- .../livekit/LivekitMemberMedia.ts | 4 +- sdk/src/utils/LazyBehavior.test.ts | 52 ------------ sdk/src/utils/LazyBehavior.ts | 53 ------------ 8 files changed, 127 insertions(+), 144 deletions(-) delete mode 100644 sdk/src/utils/LazyBehavior.test.ts delete mode 100644 sdk/src/utils/LazyBehavior.ts diff --git a/sdk/SdkArchitecture.md b/sdk/SdkArchitecture.md index 8ad211853..a1a7623f4 100644 --- a/sdk/SdkArchitecture.md +++ b/sdk/SdkArchitecture.md @@ -599,11 +599,11 @@ export interface MediaTrack { /** False when the SFU reports the track as unencrypted. Fixed for the life of the track. */ encrypted: boolean; /** - * Inbound statistics for a remote track, outbound for a local one. Polled - * once a second, but only while someone is subscribed, so a statistics - * panel costs nothing while closed. + * Inbound statistics for a remote track, outbound for a local one, polled + * every `intervalMs` while the observable is subscribed and not at all + * otherwise, so a statistics panel costs nothing while closed. */ - stats$: Behavior; + stats$(intervalMs: number): Observable; /** * Rendering. The view hands its