export declare const MinDBFS = -758.596; export declare namespace Backend { type UID = string; /** * Reports capture device lifecycle changes: * - `started`: a capture opened successfully on the requested device. * Fires on every open — initial creation, re-open after unmute, device * switches and settings-triggered re-opens. * - `defaulted`: a capture opened, but on the default device — the * requested device was unavailable (e.g. unplugged or a rotated * deviceId). Fires instead of `started` for that open. * - `stopped`: the capture was closed because the active device vanished. * * Exactly one of `started`/`defaulted` is emitted per successful open. * Handlers must tolerate unrecognized status values; new values may be * added in minor releases. */ type OnStatusChanged = (status: 'started' | 'stopped' | 'defaulted') => void; type OnEvent = (method: string, properties: unknown) => void; type Version = '9'; type Transport = 'H3' | 'WebRTC'; interface Plugin { readonly version: Version; readonly playbackVolume: PlaybackVolume; readonly supportedTransports: Transport[]; joinRoom(parameters: JoinRoomParameters): Room; createAudioCapture(parameters: CreateAudioCaptureParameters): Promise; createAudioPlayback(parameters: CreateAudioPlaybackParameters): Promise; createVideoCapture(ms: MediaStream, parameters?: CreateVideoCaptureParameters): Promise; createVideoPlayback(parameters: CreateVideoPlaybackParameters): Promise; enumerateDevices(): Promise>; setOutputVolume(volume: PlaybackVolume): void; setOutputDevice(device: DeviceParameters): Promise; close(): void; } interface Device { readonly type: 'AudioPlayback' | 'AudioCapture'; readonly name: string; readonly id: string; readonly isDefault: boolean; } interface DeviceParameters { readonly device?: Device; /** * Survives mute/unmute cycles, but is replaced — not merged — by every * `setDevice` call: pass it again when switching devices, or device * status notifications silently stop. */ readonly onStatusChanged?: OnStatusChanged; } interface Activity { isSilent: boolean; rmsDBFS: number; } interface JitterStats { packetsBuffered: number; packetsSeen: number; packetsProcessed: number; packetsTooEarly: number; packetsTooLate: number; packetsDropped: number; packetsInvalid: number; packetsRepeated: number; packetsLost: number; } interface ConnectionStats { bytesSent: number; bytesReceived: number; packetsSent: number; packetsReceived: number; rtt: number; packetLoss: number; } interface JoinRoomParameters { readonly url: string | 'loopback'; readonly token: string; readonly roomId?: string; readonly userData?: Uint8Array; readonly position?: [number, number, number]; readonly cipher?: SetupCipherSettings; readonly transport?: Transport; readonly onEvent: OnEvent; } interface Room { readonly token: string; readonly cipher: Cipher | undefined; readonly connectionStats: ConnectionStats; request(method: string, properties: unknown): Promise; link(media: Media): Promise; unlink(media: Media): void; close(): void; } interface Media { readonly customType?: string; close(): void; } interface AudioMedia extends Media { readonly activity: Activity; } interface CreateAudioPlaybackParameters { readonly uid: UID; readonly volume?: PlaybackVolume; readonly customType?: string; } interface CreateVideoPlaybackParameters { readonly uid: UID; readonly customType?: string; } interface AudioPlayback extends AudioMedia { readonly uid: UID; readonly volume: PlaybackVolume; readonly jitterStats: JitterStats; setVolume(value: PlaybackVolume): void; } interface CreateAudioCaptureParameters extends Partial { readonly volume?: CaptureVolume; readonly vad?: VadConfig; readonly apm?: ApmConfig; readonly customType?: string; } interface CreateVideoCaptureParameters { readonly codec?: 'H264' | 'AV1' | 'VP8' | 'VP9'; readonly maxBitrate?: number; readonly maxFramerate?: number; readonly scaleResolutionDownBy?: number; readonly degradationPreference?: 'balanced' | 'maintain-framerate' | 'maintain-resolution'; readonly volume?: CaptureVolume; readonly vad?: VadConfig; readonly customType?: string; } interface AudioCapture extends AudioMedia { readonly volume: CaptureVolume; readonly vad?: VadConfig; readonly apm?: ApmConfig; startLoopback(): Promise; stopLoopback(): Promise; setVad(config: VadConfig): void; setApm(config: ApmConfig): Promise; setDevice(device: DeviceParameters): Promise; setVolume(value: CaptureVolume): Promise; } interface VideoCapture extends Media { mediaStream?: MediaStream; setDevice(ms: MediaStream): Promise; volume: CaptureVolume; setVolume(volume: CaptureVolume): Promise; vad: VadConfig; setVad(vad: VadConfig): void; audioCapture?: AudioCapture; } interface VideoPlayback extends Media { readonly uid: UID; readonly mediaStream?: MediaStream; } type PlaybackVolume = [number, number]; type CaptureVolume = 'muted' | number; interface VadConfig { voiceActivity?: SensitivityRange; volumeGate?: SensitivityRange; } interface SensitivityRange { attackThreshold: number; releaseThreshold: number; } interface ApmConfig { echoCanceller: boolean; highPassFilter: boolean; noiseSuppression: 'None' | 'Low' | 'Moderate' | 'High' | 'VeryHigh'; transientSuppressor: boolean; gainController: boolean; } type SetupCipherSettings = { type: 'OdinCrypto'; } & OdinCryptoSettings; type CipherSettings = OdinCryptoSettings; interface OdinCryptoSettings { password: string | null; } enum PeerCipherStatus { InvalidPassword = -1, Unknown = 0, Unencrypted = 1, Encrypted = 2 } interface Cipher { configure(settings: CipherSettings): void; getPeerStatus(peerId: number): PeerCipherStatus; } } export declare const CONNECTION_STATS_INITIAL: Backend.ConnectionStats; export declare const JITTER_STATS_INITIAL: Backend.JitterStats; /** * The voiceActivity unit is %. * The volumeGate unit is in dbfs. */ export declare const VAD_DEFAULTS: Backend.VadConfig; export declare const APM_DEFAULTS: Backend.ApmConfig;