Member Management API
Member list, unified operations (stage/mute/kick), hand-raise, and stage loop.
API Reference
approveHandUp()
Teacher approves a student's hand-raise, inviting them to the stage (same as memberAction Stage_Up).
| Parameter | Type | Description |
|---|---|---|
| userId | string | Student userId to invite to stage |
Returns: Promise<any>
Example:
// 遍历举手列表逐个同意 / Iterate over the hand-up list and approve
for (const m of classroom.state.handUpList$.get()) {
await classroom.approveHandUp(m.userId);
}clearHandUpList()
Clear the entire hand-up list (teacher/assistant only).
Returns: Promise<TResult<void>>
Example:
// 一键拒绝所有未处理的举手 / One-click reject all pending hand-raises
await classroom.clearHandUpList();deleteHandUpMembers()
Remove specific members from the hand-up list.
Only clears the hand-up state of the specified members; does not affect their other permissions.
| Parameter | Type | Description |
|---|---|---|
| userIds | string[] | Array of user IDs to remove |
Returns: Promise<TResult<void>>
Example:
await classroom.deleteHandUpMembers(['student_001', 'student_002']);getAllCommand()
Query stage invitation status for all users; returns all pending and completed invitation records.
Returns: Promise<TResult<any>>
getHandUpList()
Get the paginated hand-up list of students currently awaiting approval.
Equivalent to the reactive state.handUpList$; used for one-shot refresh.
| Parameter | Type | Description |
|---|---|---|
| page? | number | Page number (default 1) |
| pageSize? | number | Items per page (default 20) |
Returns: Promise<TResult<HandUpListResponse>>
getMemberInfo()
Query info for a single member.
| Parameter | Type | Description |
|---|---|---|
| userId | string | Target user ID |
| forceRemote? | boolean | true=强制从服务端拉取最新数据;false=优先使用本地缓存(默认) |
Returns: Promise<TResult<MemberInfo>>
Example:
// 优先使用本地缓存 / Prefer local cache
const info = await classroom.getMemberInfo('student_001');
// 强制刷新(如确认权限变更后立即查询) / Force refresh
const fresh = await classroom.getMemberInfo('student_001', true);getMemberList()
Get a paginated list of classroom members (roster), including role, online status, permissions, etc.
Incremental pagination: the SDK maintains a cursor and merges results into state.memberMap$; subscribe to state.memberList$ for reactive access to the latest list.
| Parameter | Type | Description |
|---|---|---|
| page? | number | Page number starting from 1 (default 1) |
| pageSize? | number | Items per page (default 20) |
Returns: Promise<TResult<MemberListResponse>>
Example:
// 首次拉取第一页 / Fetch the first page
await classroom.getMemberList(1, 50);
// 通过响应式信号订阅完整成员列表 / Subscribe via reactive signal
classroom.state.memberList$.subscribe((list) => renderRoster(list));getPermissionList()
Actively fetch the latest permission list (SDK auto-fetches once on join; use this to force refresh).
Results are merged into state.memberMap$ and TEvent.PERMISSION_UPDATE is emitted.
Returns: Promise<TResult<void>>
getUserCommand()
Query the current stage invitation status for a specific user (pending/accepted/rejected).
| Parameter | Type | Description |
|---|---|---|
| userId | string | Target user ID |
Returns: Promise<TResult<any>>
handUp()
Student raises hand to request joining the stage for speaking.
After calling, the teacher receives the request via state.handUpList$; the student's state.myHandUpStatus$ becomes true.
Only effective when hand-raise is enabled (state.enableStage$ === true); fails otherwise.
Returns: Promise<any>
Example:
if (!classroom.state.enableStage$.get()) { toast.warn('当前课堂未开启连麦'); return; }
const result = await classroom.handUp();
if (!result.ok) toast.error(result.message);handUpCancel()
Student cancels hand raise, withdrawing the stage request.
Returns: Promise<any>
Example:
await classroom.handUpCancel();lockStageLoop()
Lock/unlock stage loop rotation.
When locked, automatic switching is paused and the current student stays on stage; unlocking resumes rotation.
| Parameter | Type | Description |
|---|---|---|
| lock? | boolean | true=锁定暂停轮换(默认 true,不传即锁定);false=解锁恢复轮换 |
Returns: Promise<TResult<void>>
Example:
await classroom.lockStageLoop(); // 锁定 / lock
await classroom.lockStageLoop(false); // 解锁 / unlockmemberAction()
Unified member operation entry point supporting stage up/down, mute, kick, grant permissions, and more.
| Parameter | Type | Description |
|---|---|---|
| param | MemberActionParam | Operation params containing action type and target userId |
Returns: Promise<any>
Example:
// 邀请学生上台 / Invite a student to the stage
await classroom.memberAction({ userId: 'stu_001', action: MemberActionType.Stage_Up });
// 禁言学生 / Silence a student
await classroom.memberAction({ userId: 'stu_002', action: MemberActionType.Silence });
// 踢出学生 / Kick a student
await classroom.memberAction({ userId: 'stu_003', action: MemberActionType.Kick_Out });memberLike()
Send a like; the total like count is reactively updated via state.likeCount$.
The server merges/throttles likes; client-side throttling is unnecessary.
Returns: Promise<TResult<void>>
Example:
// 用户点击点赞按钮 / User taps the like button
onClickLike(() => classroom.memberLike());
// 订阅总点赞数 / Subscribe to total like count
classroom.state.likeCount$.subscribe((count) => updateLikeBadge(count));rejectHandUp()
Teacher rejects a student's hand-raise (clears their hand-up state).
| Parameter | Type | Description |
|---|---|---|
| userId | string | Student userId to reject |
Returns: Promise<any>
Example:
await classroom.rejectHandUp('student_001');sendCommand()
Send a stage invitation command to a specific user; used for teacher-initiated stage invitation flow.
The student receives the invitation via state.askStageStatus$ and decides whether to accept.
| Parameter | Type | Description |
|---|---|---|
| userId | string | Target user ID |
| param? | Record<string, unknown> | Optional params (e.g., auto-mic/camera) |
Returns: Promise<TResult<any>>
Example:
// 老师邀请学生上台 / Teacher invites student to stage
await classroom.sendCommand('stu_001');
// 带附加参数 / With additional params
await classroom.sendCommand('stu_001', { autoMic: true, autoCamera: false });startStageLoop()
Start the rotating stage loop — students automatically take turns on stage based on config (teacher/assistant only).
Once started, the SDK automatically rotates students on stage at the configured interval until stopStageLoop() is called or all students have had their turn.
Status is reflected in state.stageLoopEnabled$; pause rotation with lockStageLoop(true).
| Parameter | Type | Description |
|---|---|---|
| params | StageLoopParams | 循环上台参数(每人时长/间隔/自动开麦/自动开摄像头等) |
Returns: Promise<TResult<void>>
Example:
await classroom.startStageLoop({
duration: 120, // 每人上台 120 秒 / 120s per student
interval: 5000, // 切换间隔 5 秒(毫秒)/ 5000ms switch interval
autoMic: true, // 自动开麦 / auto unmute mic
autoCamera: true, // 自动开摄像头 / auto open camera
memberNumber: 1, // 每轮上台人数(可选)/ students on stage per round (optional)
});stopStageLoop()
Stop the rotating stage loop; all currently rotating students will be taken off stage.
Returns: Promise<TResult<void>>
Example:
await classroom.stopStageLoop();updateStageLoop()
Hot-update stage loop parameters (no stop/restart needed; changes take effect immediately).
| Parameter | Type | Description |
|---|---|---|
| params | StageLoopParams | New stage loop config |
Returns: Promise<TResult<void>>
Example:
// 把每人上台时长改为 60 秒 / Change per-student duration to 60s
await classroom.updateStageLoop({ duration: 60, interval: 5000, autoMic: true, autoCamera: true });