import { Unsubscribe } from './utils'; import { Api } from './api'; /** WebRTC peer */ export type WebRTCPeer = { /** Peer connection UID */ uid: string; /** Peer username */ username: string; /** Remote connection to stream */ connection: RTCPeerConnection; }; /** WebRTC session */ export type WebRTCSession = { /** Is the connection active? */ open: boolean; /** Room ID */ id: string; /** Connection UID */ uid: string; /** Local media stream */ stream: MediaStream; /** Connected peers sorted by UID */ peers: { [key: string]: WebRTCPeer; }; /** Disconnection session */ disconnect: Unsubscribe; /** Callback when peers connect */ onConnected?: (peer: WebRTCPeer, track: any) => any; }; export declare class WebRtc { private api; readonly ice: { urls: string[]; username?: string; credential?: string; }[]; constructor(api: Api); private answer; private offer; /** * Create a new WebRTC connection to a room * @param {string} id Room ID * @param {boolean} audio Stream local audio to room/peers * @param {boolean} video Stream local video to room/peers * @returns {Promise} Connection session */ connect(id?: string, audio?: boolean, video?: boolean): Promise; } //# sourceMappingURL=webrtc.d.ts.map