import type { MutableRefObject } from "react"; import { type VideoWanted } from "./videoDemand.js"; import type { AudioTransportOffer } from "../../transport/session.js"; interface SFUConnectionRefs { isDisconnectingRef: MutableRefObject; sfuWebSocketRef: MutableRefObject; peerConnectionRef: MutableRefObject; } export interface SFUWebSocketCloseInfo { code: number; reason: string; wasClean: boolean; } interface SFUConnectionOptions { /** * Called only after room_joined has completed and the SFU WebSocket later closes * abnormally, so the outer hook can mark the state FAILED and let auto-reconnect run. */ onAbnormalClose?: (info: SFUWebSocketCloseInfo) => void; /** * What the SFU said about itself when it let us in. Called once, before the * connect promise resolves. */ onRoomJoined?: (info: RoomJoinedInfo) => void; /** What viewers want of one of our streams, from an SFU that says (GRYT-1432). */ onVideoWanted?: (wanted: VideoWanted & { mid: string; }) => void; /** Which own-transport sender id is which user, each time someone joins or leaves it (GRYT-1830). */ onAudioSenders?: (senders: Map) => void; /** Whether anyone in the room is off the own transport and still needs WebRTC audio (GRYT-1853). */ onWebRTCAudioWanted?: (wanted: boolean) => void; } /** The SFU's webrtc_audio_wanted, or null for anything that isn't one. */ export declare function parseWebRTCAudioWanted(data: string): boolean | null; /** The SFU's audio_senders: decimal sender id to user id. Anything else in it is dropped. */ export declare function parseAudioSenders(data: unknown): Map; export interface RoomJoinedInfo { /** * SFU_CALL_ALONE_TIMEOUT on the SFU we reached, in seconds. Zero means it * never ends a call for being one person; null means it did not say. */ callAloneTimeoutSeconds: number | null; /** SFU_MAX_INGEST_KBPS: the most this peer should send the SFU, or null for no cap. */ maxIngestKbps: number | null; /** The own voice transport's offer, or null when the SFU has none (GRYT-1818). */ audioTransport: AudioTransportOffer | null; } /** * What room_joined carries, for SFUs that carry anything. It used to be a sentence; this * parses and falls back rather than switching on a version, so an older SFU gives nulls. */ export declare function parseRoomJoined(data: unknown): RoomJoinedInfo; export declare function connectToSfuWebSocket(sfuUrl: string, joinToken: unknown, refs: SFUConnectionRefs, eSportsModeEnabled?: boolean, options?: SFUConnectionOptions): Promise; export {};