UNPKG

agora-edu-core

Version:

Core APIs for building an online classroom

352 lines (351 loc) 8.32 kB
import { EduStoreBase } from '../base'; import { CarouselSetting, ClassroomSchedule, ClassState, ExpandedScope, FcrCustomMessageObserver, HandUpProgress, HostingScene, RecordStatus, RecordStreamingUrl } from './type'; /** * `RoomStore` 类用于初始化教室和监听教室数据。 */ /** @en * The `RoomStore` class is used for initializing rooms and listening for the room data. */ export declare class RoomStore extends EduStoreBase { private _cmdHandler; private _clientServerTimeShift; private _clockRefreshTask?; private _disposers; private _customMessageObservers; /** * @internal * 房间时钟 */ /** @en * @internal * Clock time of the room */ private _clockTime; /** * 教室日程信息 */ /** @en * Classroom schedule info */ classroomSchedule: ClassroomSchedule; /** * @internal * * 主房间数据信息 **/ /** @en * @internal * * main store datastore */ get mainRoomDataStore(): DataStore; /** * @internal * * 分组房间数据信息 **/ /** @en * @internal * * sub store datastore */ get subRoomDataStore(): DataStore; /** * 轮播设置 **/ /** @en * Carousel setting */ get carousel(): CarouselSetting; /** * 视频墙状态 */ /** @en * Expanded scope state */ get expandedScope(): ExpandedScope | undefined; /** * 挥手的用户列表 **/ /** @en * List of users which are waving arm */ get waveArmList(): HandUpProgress[]; /** * 台上用户列表 **/ /** @en * List of users which are on the stage */ get acceptedList(): HandUpProgress[]; /** * 被邀请上台中的用户列表 */ /** @en * List of users which are being invited to the stage */ get inviteList(): HandUpProgress[]; /** * 自定义房间属性 **/ /** @en * Custom room properties */ get flexProps(): Record<string, any>; /** * @internal * @deprecated * * 伪直播属性 **/ /** @en * @internal * @deprecated * * hosting scene properties */ get hostingScene(): HostingScene; /** * 录制状态 **/ /** @en * Record status */ get recordStatus(): RecordStatus; /** * 录制是否已经准备好 **/ /** @en * Whether the recording has been ready */ get recordReady(): boolean; /** * 录制是否在暂停 **/ /** @en * Whether the recording has been ready */ get recordOnHold(): boolean; /** * 录制生成的视频流地址 **/ /** @en * Generated video stream addresses of the record */ get recordStreamingUrl(): RecordStreamingUrl | undefined; /** * 当前教室内正在进行的屏幕共享的流 UUID * @en * The stream UUID for screen sharing currently taking place in the classroom */ get screenShareStreamUuid(): string | undefined; /** * 当前教室内正在进行的屏幕共享的流所属的用户 UUID * @en * The user UUID to which the stream of the screen sharing currently taking place in the classroom belongs */ get screenShareUserUuid(): string | undefined; /** * 当前用户是否在台上 */ /** @en * Whether the local user is on stage */ get isOnPodium(): boolean; /** * 房间时钟 */ /** @en * Clock time of the room */ get clockTime(): number; /** * 当前是否在分享屏幕 */ /** @en * Whether the local user is currently sharing the screen */ get isScreenSharing(): boolean; private _dataStore; /** Methods */ private startClockRefreshTask; private _hanldeTimestampGapChange; /** Actions */ /** * 开始视频轮播 * @param params 轮播设置 **/ /** @en * Starts the video gallery rotation * @param params Carousel setting * */ startCarousel(params: Pick<CarouselSetting, 'range' | 'type' | 'interval'>): Promise<void>; /** * 停止视频轮播 **/ /** @en * * Stops the video carousel rotation */ stopCarousel(): Promise<void>; /** * 授予学生奖励 * @param rewards userUuid: 被奖励用户 UUID, changeRecord: 奖励数量 * @param isBatch 是否批量发奖励 **/ /** @en * Sends rewards to users * @param rewards userUuid: user being rewarded, changeRecord: reward quantity * @param isBatch Whether sends records in a batch */ sendRewards(rewards: { userUuid: string; changeReward: number; }[], isBatch?: boolean): Promise<void>; /** * 更新课堂状态 * * @param state 课堂状态 **/ /** @en * Updates the class state * * @param state The class state */ updateClassState(state: ClassState): Promise<void>; /** * 更新房间自定义属性 * @param properties * @param cause */ /** @en * Updates room flex properties * @param properties * @param cause */ updateFlexProperties(properties: any, cause: any): Promise<void>; /** * @internal * * 增量更新自定义属性 * @param increments * @param cause * @param throttleTime */ /** @en * @internal * * Updates Increment properties * @param increments * @param cause * @param throttleTime */ updateIncrementProperties(increments: Record<string, number>, cause?: unknown, throttleTime?: number): Promise<void>; /** * @internal * @deprecated * * 更新伪直播属性 * * @param properties 伪直播属性 **/ /** @en * @deprecated * @internal * * Updates the hosting scene live properties * * @param properties Hosting scene properties */ updateHostingSceneProperties(properties: HostingScene, cause: any): Promise<void>; /** * 发送自定义频道消息 * @param cmd * @param data * @param sync */ /** @en * * @param cmd * @param data * @param sync */ sendCustomChannelMessage(data: Record<string, any>, needSync?: boolean): Promise<void>; /** * 发送自定义点对点消息 * @param cmd * @param data * @param toUserUuid * @param ack */ /** @en * * @param cmd * @param data * @param toUserUuid * @param ack */ sendCustomPeerMessage(data: Record<string, any>, toUserUuid: string, needAck?: boolean): Promise<void>; /** * 增加一个自定义消息观察者 * @param observer */ /** * * @param observer */ addCustomMessageObserver(observer: FcrCustomMessageObserver): void; /** * 移除一个自定义消息观察者 * @param observer */ /** * * @param observer */ removeCustomMessageObserver(observer: FcrCustomMessageObserver): void; private tickClock; /** * 服务器和本地时间的差(非可观察属性),单位:毫秒 **/ /** @en * Difference between server and local time(non-observable), unit: milliseconds */ get clientServerTimeShift(): number; private _handleRoomPropertiesChange; private _addEventHandlers; private _removeEventHandlers; private _setEventHandler; /** * @internal */ /** @en * @internal */ onInstall(): void; /** * @internal */ /** @en * @internal */ onDestroy(): void; } declare type DataStore = { carousel: CarouselSetting; waveArmList: HandUpProgress[]; acceptedList: HandUpProgress[]; inviteList: HandUpProgress[]; flexProps: Record<string, any>; recordStatus: RecordStatus; recordReady: boolean; recordOnHold: boolean; screenShareStreamUuid?: string; screenShareUserUuid?: string; isOnPodium: boolean; recordStreamingUrl?: RecordStreamingUrl; expandedScope?: ExpandedScope; screenState?: number; }; export {};