import { Notifier } from "./notifier"; import { InternalMessage, JoinedRoom, LeftRoom, ParticipantRenamed, ParticipantRole, RoomEvent, RoomState, StatsType, TrackType, TransportType, UserId, UserNickname } from "./constants"; import { Connection } from "./connection"; import { WebRTCStats } from "./webrtc-stats"; import Logger from "./logger"; import { BitrateTestController } from "./BitrateTest"; import { Mutex } from "async-mutex"; import { RTCMetricsServerDescription } from '@flashphoner/web-sdk-metrics'; export declare class Room { #private; _webRTCMetricsServerDescription: RTCMetricsServerDescription; _mediaSessionId: string; protected notifier: Notifier; protected connection: Connection; _id: string; _name: string; _userId: string; _pin: string; _nickname: string; protected logger: Logger; _uid: string; _crutch: { mutex: Mutex; tid: string; }; protected stats: WebRTCStats; constructor(connection: Connection, name: string, pin: string, nickname: UserNickname, creationTime: number, userId?: UserId, webRTCMetricsServerDescription?: RTCMetricsServerDescription); processEvent(e: InternalMessage): Promise; /** * Join the room * * @param pc - peer connection * @param nickname - user nickname * @param config - [track.id] : track content type * @param predefinedTracksCount - Initial number of allocated transceivers. * @param transportType - Ice transport protocol. "UDP"/"TCP". */ join(pc: RTCPeerConnection, nickname?: UserNickname, config?: { [key: string]: string; }, predefinedTracksCount?: number, transportType?: TransportType): Promise; /** * Used for SDP exchange */ updateState(config?: { [key: string]: string; }): Promise; /** * Destroy room * * Participants will receive {@link RoomEvent.ENDED}. * {@link state} will be {@link RoomState.DISPOSED} */ destroyRoom(): Promise; getBitrateTest(): BitrateTestController; /** * Leave room * * Participants will receive {@link RoomEvent.LEFT} with {@link LeftRoom}. * {@link state} will be {@link RoomState.DISPOSED} */ leaveRoom(): Promise; /** * Evict participant * * Participants will receive {@link RoomEvent.EVICTED} with {@link EvictedFromRoom}. */ evictParticipant(userId: UserId): Promise; /** * Rename participant * * Participants will receive {@link RoomEvent.PARTICIPANT_RENAMED} with {@link ParticipantRenamed}. */ renameParticipant(userId: UserId, newNickname: UserNickname): Promise; sendMessage(msg: string): Promise; /** * Change the quality of the requested track */ changeQuality(trackId: string, quality: string, tid: number): Promise; /** * Mute track * * Participants will receive {@link RoomEvent.MUTE_TRACKS} with {@link AddRemoveTracks} */ muteTrack(trackId: string, mute: boolean): Promise; private muteRemoteTrack; on(event: RoomEvent, callback: (arg0: InternalMessage) => void): Room; off(event: RoomEvent, callback: (arg0: InternalMessage) => void): Room; id(): string; protected updateName(name: string): void; name(): string; userId(): string; pin(): string; nickname(): string; pc(): RTCPeerConnection; role(): ParticipantRole; invite(): string; state(): RoomState; creationTime(): number; getStats(track: MediaStreamTrack, type: StatsType, callback: Function): void; getRemoteTrack(kind: TrackType, force: boolean): Promise; } export interface RemoteTrack { readonly track: MediaStreamTrack; readonly preferredQuality?: string; readonly tid?: number; readonly sid?: number; readonly disposed: boolean; demandTrack(remoteMid?: string): Promise; mute(): Promise; unmute(): Promise; setPreferredQuality(quality?: string): Promise; setSid(sid: number): Promise; setTid(tid: number): Promise; dispose(): Promise; }