UNPKG

agora-meeting-sdk

Version:

For publishing npm package agora-metting-sdk (Web). Get more information from https://docs.agora.io

522 lines (521 loc) 14.2 kB
import { AgoraEduApi } from '../core/services/edu-api'; import { EnumOnlineState } from '../core/services/interface'; import { RecordConfig } from '../core/media-service/interfaces'; export declare enum EduCourseState { EduCourseStatePending = 0, EduCourseStateStart = 1, EduCourseStateStop = 2 } /** * 教室状态类型 * EduClassroomStateTypeAllStudentsChat = 0, * EduClassroomStateTypeCourseState = 1, * EduClassroomStateTypeRoomAttrs = 2, */ export declare enum EduClassroomStateType { EduClassroomStateTypeAllStudentsChat = 0, EduClassroomStateTypeCourseState = 1, EduClassroomStateTypeRoomAttrs = 2 } /** * 教室流动作 * add = 0, * modify = 1, * remove = 2, */ export declare enum EduStreamAction { add = 1, modify = 2, remove = 3 } /** * 房间属性 */ export interface EduRoomAttrs { [key: string]: any; } /** * 教育SDK频道命令类型 */ export declare enum EduChannelMessageCmdType { initState = 0, courseState = 1, roomMediaState = 2, roomChatState = 3, roomPropertiesStateChanged = 4, roomPropertiesBatchUpdated = 5, muteChatOperation = 6, userListChanged = 20, userStateUpdated = 21, userPropertyUpdated = 22, userPropertiesUpdated = 23, streamListChanged = 40, streamListBatchUpdated = 41, boardState = 60, boardUserState = 61, customMessage = 99 } /** * 教育SDK点对点命令类型 */ export declare enum EduPeerMessageCmdType { peer = 1, roomInfo = 2, userStream = 3, customMessage = 99 } /** * 教育SDK角色枚举 * invisible = 0,为观众 * teacher = 1,为老师 * student = 2,为学生 * assistant = 3,为助教 */ export declare enum EduRoleTypeEnum { none = -1, invisible = 0, teacher = 1, student = 2, assistant = 3 } /** * 教育SDK房间枚举 * Room1v1Class = 1,1v1 * RoomSmallClass = 4,小班课 */ export declare enum EduRoomTypeEnum { Room1v1Class = 0, RoomSmallClass = 4, RoomBigClass = 2 } /** * 教育SDK角色枚举,消息体类型 * teacher = 1,为老师 * student = 2,为学生 * assistant = 3,为助教 * invisible = 0,为观众 */ export declare enum EduRoleType { host = "host", teacher = "host", audience = "audience", student = "broadcaster", invisible = "invisible", assistant = "assistant" } /** * 音频类型 * none = 0, 为无 * mic = 1, 麦克风 */ export declare enum EduAudioSourceType { none = 0, mic = 1 } /** * 视频类型 * none = 0, 为无 * camera = 1, 摄像头 * screen = 2, 屏幕分享 */ export declare enum EduVideoSourceType { none = 0, camera = 1, screen = 2 } export declare enum ConnectionState { } export declare enum EduUserStateType { EduUserStateTypeVideo = 0, EduUserStateTypeAudio = 1, EduUserStateTypeChat = 2, EduUserStateTypeBoard = 3 } export declare enum NetworkQuality { NetworkQualityUnknown = -1, NetworkQualityHigh = 1, NetworkQualityMiddle = 2, NetworkQualityLow = 3 } export declare enum ConnectionChangeReason { } export declare enum LogLevel { } export interface EduConfiguration { appId: string; cefClient?: any; platform: 'web' | 'electron'; agoraRtc?: any; agoraElectron?: any; logLevel: LogLevel; logDirectoryPath: string; codec?: string; sdkDomain?: string; rtmUid: string; rtmToken: string; recordConfig?: RecordConfig; } export interface EduClassroomConfiguration extends EduConfiguration { authorization: string; } export interface EduClassroomManagerInit { apiService: AgoraEduApi; config: EduClassroomConfiguration; } export declare enum EduSceneType { Scene1v1 = 0, SceneSmall = 1, SceneLarge = 2, SceneMedium = 4 } export interface EduClassroomParams { userName: string; userUuid: string; roomName: string; roomUuid: string; role: EduRoleType; } export interface EduClassroomJoinOptions { userName: string; userUuid: string; } export declare enum EduClassroomType { EduClassroomType1V1 = 0, EduClassroomTypeSmall = 1, EduClassroomTypeBig = 2 } export interface InitClassroomManagerConfig { roomName: string; roomUuid: string; streamUuid: string; classType: EduClassroomType; limit?: { teacherLimit: number; studentHostLimit: number; studentAudienceLimit: number; }; } export interface EduClassroomMediaOptions { autoSubscribeVideo: boolean; autoSubscribeAudio: boolean; autoPublishCamera: boolean; autoPublishMicrophone: boolean; } export interface EduClassroomJoinOptions { userName: string; userUuid: string; roomUuid: string; sceneType?: EduSceneType; autoPublish: boolean; streamUuid?: string; } export interface EduClassroomSubscribeOption { autoSubscribeVideo: boolean; autoSubscribeAudio: boolean; } export interface ClassroomStateParams { courseState: number; muteAllChat: number; muteAllVideo: number; muteAllAudio: number; } export interface UserQueryParams { nextId?: string; count: number; updateTimeOffset?: number; includeOffline?: number; } export interface StreamQueryParams { nextId?: string; count: number; updateTimeOffset?: number; includeOffline?: number; } export interface AgoraFetchParams { url?: string; method: string; data?: any; token?: string; full_url?: string; type?: string; restToken?: string; } export interface PeerMessageParams { roomUuid: string; userId: string; msg: string; } export interface ChannelMessageParams { msg: string; roomUuid: string; } export declare type EduClassroomInfo = { roomUuid: string; roomName: string; }; export interface InitEduRoomParams { roomName: string; roomUuid: string; streamUuid: string; roleConfig: { host: { limit: number; }; broadcaster: { limit: number; }; audience: { limit: number; }; assistant: { limit: number; }; }; } export declare type EduClassroomStatus = { courseState: EduCourseState; startTime: number; isStudentChatAllowed: boolean; onlineUsersCount: number; }; export interface EduClassroomAttrs { roomInfo: EduClassroomInfo; roomStatus: EduClassroomStatus; roomProperties: Record<string, string>; time: number; } export interface EduClassroom { roomInfo: EduClassroomInfo; roomProperties: EduRoomAttrs; roomStatus: EduClassroomStatus; } export declare enum EduRenderMode { } export interface EduRenderConfig { renderMode: EduRenderMode; } export interface EduVideoConfig { resolution?: any; fps?: string; } export interface EduStreamConfig { streamUuid: string; streamName: string; enableCamera: boolean; sourceType: EduVideoSourceType; enableMicrophone: boolean; cameraDeviceId: string; microphoneDeviceId: string; } export interface EduSubscribeOptions { } export interface EduBoard { isPublisher: boolean; } export interface EduBoardOperator { user: EduUser; board: EduBoard; } export interface EduBoardRoomModel { boardOperators: Array<EduBoardOperator>; } export interface EduReply { appId: string; roomId: string; recordId: string; } export interface EduVideoEncoderConfiguration { width: number; height: number; frameRate: number; bitrate: number; } export interface EduUserInfo { userUuid: string; userName: string; role: string; } export interface EduCustomMessage { fromUser: EduUserInfo; message: string; timestamp: number; } export interface EduTextMessage { fromUser: EduUserInfo; message: string; messageId: string; sensitiveWords: string[]; type: number; timestamp: number; } export interface EduRenderConfig { } export interface EduShareScreenConfig { streamUuid: string; streamName: string; } export interface EduStreamParams { streamUuid: string; userUuid: string; streamName: string; audioSourceType: EduAudioSourceType; videoSourceType: EduVideoSourceType; videoState: number; audioState: number; } export interface EduUser { userUuid: string; userName: string; role: EduRoleType; userProperties?: Record<any, any>; } export interface EduUserAttrs extends EduUser { state?: EnumOnlineState; updateTime?: number; streamUuid?: string; rtcToken?: string; screenRtcToken?: string; rtmToken?: string; type?: number; } export declare class EduUserData { private _user?; private _ts?; private _state?; private _type?; private _streamUuid?; private _rtcToken?; private _screenRtcToken?; _rtmToken?: string; get rtmToken(): string; get type(): number; constructor(data: EduUserAttrs); updateUser(args: Partial<EduUserAttrs>): void; updateState(v: number): void; setRtcToken(v: string): void; setScreenRtcToken(v: string): void; updateUserChatMute(v: boolean): void; get rtcToken(): string; get screenRtcToken(): string; get streamUuid(): string; get user(): EduUser; get ts(): number; get state(): number; private _streamsMap; get streams(): Record<any, any>; updateStreamsMap(map: any): void; static fromArray(list: any[]): EduUserData[]; static combineLatest(list: any[]): EduUserData[]; } export interface EduStreamEvent { modifiedStream: EduStream; operatorUser: EduUser; } export interface EduStream { streamUuid: string; streamName: string; videoSourceType: number; audioSourceType: number; hasVideo: boolean; hasAudio: boolean; userInfo: { userUuid: string; userName: string; role: EduRoleType; }; } export interface StreamType { userUuid: string; streamUuid: string; streamName: string; videoSourceType: number; audioSourceType: number; videoState: number; audioState: number; } export interface DeleteStreamType { userUuid: string; streamUuid: string; } export interface UserGroup { groupUuid: string; groupName: string; members: Array<{ userUuid: string; userName: string; reward?: number; streamUuid?: any; }>; groupProperties?: { reward?: number; }; interactOutGroups?: object; } export interface RoomProperties { groupStates?: any; interactOutGroups?: any; groups?: any; students?: any; } export interface EduStreamAttrs extends EduStream { updateTime?: number; state?: EnumOnlineState; token?: string; } export declare class EduStreamData { private _stream?; private _rtcToken?; private _ts?; private _state?; constructor(data: EduStreamAttrs); updateStreamUuid(uuid: string): void; updateMediaState(args: any): void; updateStream(args: Partial<EduStreamAttrs>): void; updateTime(time: number): void; update(newData: EduStreamData): void; modifyStream(args: Partial<EduStreamAttrs>): void; setRtcToken(token: string): void; get token(): string; get state(): number; get stream(): EduStream; get ts(): number; static fromArray(list: any[]): EduStreamData[]; static combineLatest(list: any[]): EduStreamData[]; } declare function event_user_init_online(user: EduUser, count: number, fromClassroom: EduClassroom): void; declare function event_remote_user_joined(user: EduUser, count: number, fromClassroom: EduClassroom): void; declare function event_remote_user_left(user: EduUser, count: number, fromClassroom: EduClassroom): void; declare function event_update_classroom(reason: EduClassroomStateType, fromClassroom: EduClassroom): void; declare function event_user_message(textMessage: EduTextMessage, fromClassroom: EduClassroom): void; declare function event_room_message(textMessage: EduTextMessage, fromClassroom: EduClassroom): void; declare function event_connection_state_changed(state: ConnectionState, reason: ConnectionChangeReason, fromClassroom: EduClassroom): void; declare function event_network_quality(quality: NetworkQuality): void; declare function event_remote_stream_init_online(remoteStream: EduStream, count: number, fromClassroom: EduClassroom): void; declare function event_remote_stream_added(remoteStream: EduStream, count: number, fromClassroom: EduClassroom): void; declare function event_remote_stream_updated(remoteStream: EduStream, count: number, fromClassroom: EduClassroom): void; declare function event_remote_stream_removed(remoteStream: EduStream, count: number, fromClassroom: EduClassroom): void; export interface IEduClassroomManager { once(event: 'user-init-online', listener: typeof event_user_init_online): void; on(event: 'remote-user-joined', listener: typeof event_remote_user_joined): void; on(event: 'remote-user-left', listener: typeof event_remote_user_left): void; on(event: 'room-message', listener: typeof event_room_message): void; on(event: 'user-message', listener: typeof event_user_message): void; once(event: 'remote-stream-init-online', listener: typeof event_remote_stream_init_online): void; on(event: 'remote-stream-added', listener: typeof event_remote_stream_added): void; on(event: 'remote-stream-updated', listener: typeof event_remote_stream_updated): void; on(event: 'remote-stream-removed', listener: typeof event_remote_stream_removed): void; on(event: 'update-classroom', listener: typeof event_update_classroom): void; on(event: 'network-quality', listener: typeof event_network_quality): void; on(event: 'connection-state-change', listener: typeof event_connection_state_changed): void; getLocalUser(): EduUserData; getStudentCount(): number; getTeacherCount(): number; getTeacherList(): EduUser[]; getStudentList(): EduUser[]; getFullUserList(): EduUser[]; getFullStreamList(): EduStream[]; joinClassroomAsTeacher(option: EduClassroomJoinOptions): Promise<void>; joinClassroomAsStudent(option: EduClassroomJoinOptions): Promise<void>; leaveClassroom(): Promise<any>; } export {};