/* Copyright 2026 Element Creations Ltd. SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE in the repository root for full details. */ /** * The public media types of the SDK: what a member publishes, the tracks it * arrives as and how a host renders them. The client and member types are in * `api.ts`. */ import { type Track, type TrackProcessor, type VideoCodec, } from "livekit-client"; import { type Observable } from "rxjs"; import { type Behavior } from "./reactive/Behavior"; export interface AudioCaptureSettings { echoCancellation?: boolean; noiseSuppression?: boolean; autoGainControl?: boolean; } export interface VideoCaptureSettings { resolution?: { width: number; height: number; frameRate?: number }; maxBitrate?: number; maxFramerate?: number; codec?: VideoCodec; } /** * One thing to publish: a source, where to capture it from and how to encode * it. Where the device and the settings are left out, the browser's and * LiveKit's defaults apply. */ export type PublishRequest = | { source: "microphone"; deviceId?: string; capture?: AudioCaptureSettings } | { source: "camera"; deviceId?: string; /** Background blur and the like. */ processor?: TrackProcessor; capture?: VideoCaptureSettings; } | { source: "screenShare"; /** Whether to capture the screen's audio too. Default true. */ audio?: boolean; capture?: VideoCaptureSettings; }; export type MediaSource = | "microphone" | "camera" | "screenShare" | "screenShareAudio" /** Published without a source; the application knows what it is. */ | "unknown"; export type MediaStreamStats = | RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats | undefined; /** One published track of a member. */ export interface MediaTrack { source: MediaSource; kind: "audio" | "video"; /** Stable for the life of the track. */ id: string; muted$: Behavior; /** False when the SFU reports the track as unencrypted. */ encrypted$: Behavior; /** Polled while subscribed. */ stats$: Behavior; /** * Rendering. The view hands its `