import EventEmitter from 'eventemitter3'; import { AuthConfig, AuthResponse } from './auth-api-client'; import { RoomApiClient } from './room-api-client'; import { Stats } from '../session/session'; import { DownSession } from '../session/down-session'; import { UpSession } from '../session/up-session'; import { RemoteParticipant } from '../participant/remote-participant'; import { LocalParticipant } from '../participant/local-participant'; import { LocalMedia } from '../local/local-media'; import { RemoteAudioElements } from '../remote/remote-audio-elements'; import { RemoteVideo } from '../remote/remote-video'; import { Local } from '../local/local'; import { LocalScreen } from '../local/local-screen'; import { RemoteAudio } from '../remote/remote-audio'; declare type RoomStatus = 'created' | 'initiated' | 'connected' | 'disconnected' | 'destroyed' | 'kicked'; export declare class Room extends EventEmitter { roomId: string; upSession: UpSession; downSession: DownSession; roomApiClient: RoomApiClient; authConfig: AuthConfig; authResponse: AuthResponse; roomStatus: RoomStatus; localParticipant: LocalParticipant; participantMap: ParticipantMap; receiverMap: ReceiverMap; audioStreamIdMap: Record; config: RoomConfig; remoteAudioElements: RemoteAudioElements; audioOccupants: ParticipantMap; audioLvlUpdateTs: number; subscribeStreamIdsQueue: { key: string; streamIds: number[]; }[]; unsubscribeStreamIdsQueue: { key: string; pairs: { receiverId: string; streamId: number; }[]; }[]; streamIdsQueueInterval: number; isStreamIdsQueueWorking: boolean; qualityMetricInterval: number; statIntervalDelay: number; constructor(authConfig: AuthConfig, authResponse: AuthResponse, config?: Partial); get remoteParticipants(): RemoteParticipant[]; /** * 미디어 서버로 부터 참여자 id를 발급받고, 세션을 생성한다. */ connect(roomId: string): Promise; /** * 생성된 세션을 제거한다. */ disconnect(reason?: 'disconnected' | 'destroyed' | 'kicked'): Promise; /** * 내 미디어를 다른 참여자에게 공유한다. */ publish(localMedias: LocalMedia[] | LocalScreen[] | Local[], isRecording?: boolean): Promise; /** * 다른 참여자에게 공유한 내 미디어를 취소한다. */ unpublish(localMedias: LocalMedia[] | LocalScreen[] | Local[]): Promise; /** * 다른 참여자의 비디오를 가져온다. */ subscribe(participantOrStreamIds: number[] | RemoteParticipant): Promise; /** * 다른 참여자의 비디오 가져오는걸 취소한다. */ unsubscribe(participantOrStreamIds: number[] | RemoteParticipant): Promise; getParticipant(participantId: string): RemoteParticipant | null; getAudioOccupants(): RemoteParticipant[]; getRemoteVideo(videoId: number): RemoteVideo | null; getRemoteAudio(audioId: number): RemoteAudio | null; private _checkAlreadySubscribe; /** * 현재 리시버가 MAX를 초과했는지 체크한다. */ private _checkMaxReceiverCount; /** * 현재 리시버 갯수를 반환한다. */ private _getCurrentReceiverCount; /** * 타입별 리시버 갯수를 조절한다. */ _setReceiverPool(videoSize: number): Promise; private _assignVideoStream; /** * down session에서 전달된 참여자 정보를 처리한다. */ private _handleParticipantsInfo; private _handleReceivers; getRemoteAudioLevels(): { remoteParticipants: { level: number; remoteParticipant: RemoteParticipant; }[]; }; switchSpeaker(deviceId: string): Promise; _startQueueMonitor(): void; getLocalStats(): Promise; getRemoteStats(): Promise; private _getLocalQualityMetricReport; private _getRemoteQualityMetricReport; private _getQualityMetricReport; private _dispatch; sendUserMessage(targets: string[], message: string, type?: string): Promise; private _startQualityMetricReport; private _setParticipantInfoToStats; } declare type ParticipantMap = { [participantId: string]: RemoteParticipant; }; declare type ReceiverMap = { [receiverId: string]: { type: 'audio' | 'video'; streamId: number | null; }; }; export declare type RoomConfig = { videoReceiverInitialCount: number; videoReceiverGrowthRate: number; videoReceiverMaximumCount: number; cpuOveruseDetection: boolean; maxFramerate: { l: number; m: number; h: number; }; voiceMode: boolean; }; export declare type QualityStat = { localQualityStat: LocalQualityStat; remoteQualityStat: RemoteQualityStat; }; export declare type LocalQualityStat = { audioMetrics: LocalAudioMetrics[]; videoMetrics: LocalVideoMetrics[]; }; export declare type LocalAudioMetrics = { streamId: number; bytesSent: number; packetsSent: number; srcAudioLevel: number; }; export declare type LocalVideoMetrics = { streamId: number; profile: 'l' | 'm' | 'h'; bytesSent: number; framesEncoded: number; framesSent: number; pliCount: number; srcFrames: number; }; export declare type RemoteQualityStat = { audioMetrics: RemoteAudioMetrics[]; videoMetrics: RemoteVideoMetrics[]; availableIncomingBitrate: number; }; export declare type RemoteAudioMetrics = { receiverId: number; streamId: number; bytesReceived: number; totalSamplesReceived: number; packetsLost: number; audioLevel: number; }; export declare type RemoteVideoMetrics = { receiverId: number; streamId: number; bytesReceived: number; framesReceived: number; framesDecoded: number; pliCount: number; packetsLost: number; }; export {};