> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stmlink.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> 对外开放的服务端接口有两组前缀，都用同一套鉴权：`/server/v1/...`（SRTC 与 SMeeting 的主接口）和 `/stm/srvapi/v1/...`（SMeeting 的用户体系，服务端极简对接会用到）。鉴权是 app_id + nonce + timestamp + signature 四个请求头，用 app_key 做 HMAC-SHA256 签名，只能从业务方自己的后端调用。除这两组前缀外的接口均为内部接口，不要建议客户调用。
> app_key 是服务端密钥，绝不能出现在客户端代码、前端配置或移动 App 里。客户端加入频道用的 token 必须由业务方后端签发后下发（SRTC 走 `/server/v1/channel/grant`，SMeeting 走 `/stm/srvapi/v1/member/grant`）。
> SRTC 与 SMeeting 是上下两层不同的产品，术语不通用：SRTC 是音视频底座，说「频道 channel」「加入 / 退出」；SMeeting 建在 SRTC 之上，说「房间 room」「会议 meeting」「进入 / 退出」。回答时按用户所在的层用对应术语，不要把「房间」「会议」安到 SRTC 的接口上。
> 同一能力在各端 SDK 里的包名、类名、方法名并不相同。写示例代码时请使用文档中该端自己的 API，不要把一个端的写法套到另一个端上。苹果平台每个产品都有两套 SDK（Swift 原生与 Objective-C），两套 API 不能混用。

# MeetingUserEvent

> 接收当前会议成员进出、角色与权限、设备状态、请求确认、等候室、会场移动和轨道变化

`MeetingUserEvent` 承载当前会议的成员、成员权限和成员轨道事件，通过 `MeetingEngine.userEvent` 注册。可继承 `MeetingUserSimpleEvent` 按需覆写。

## 使用说明

* 事件参数优先提供发生变化的成员 UID 和增量状态；需要完整成员或轨道快照时通过 `MeetingEngine.infosManager` 查询。

* 监听可在入会前赋值，离会后会被清除。

* `onUserEnter()` 只提供 UID；需要完整信息时再通过 `MeetingEngine.infosManager.getMemberByUid(uid)` 查询。

* 观众不进入正式成员列表，身份变化通过 `onMeMembershipChanged()` 通知。

## 成员生命周期

### onExitRoom(reason)

```kotlin theme={null}
fun onExitRoom(reason: LeaveMeetingReason)
```

方法说明：当前用户因被踢、被替换、心跳超时或频道销毁等原因退出会议。

参数说明：

| 参数       | 说明                |
| -------- | ----------------- |
| `reason` | Meeting 映射后的离会原因。 |

返回值说明：无（`Unit`）。

### onUserEnter(uid)

```kotlin theme={null}
fun onUserEnter(uid: String)
```

方法说明：远端用户进入当前会议。

参数说明：

| 参数    | 说明         |
| ----- | ---------- |
| `uid` | 新进入用户 UID。 |

返回值说明：无（`Unit`）。

### onUserExit(memberInfo)

```kotlin theme={null}
fun onUserExit(memberInfo: MemberInfo)
```

方法说明：远端用户离开当前会议。

参数说明：

| 参数           | 说明                        |
| ------------ | ------------------------- |
| `memberInfo` | 离开用户最后一次可用的 Meeting 成员快照。 |

返回值说明：无（`Unit`）。

### onMemberUpdated(memberInfo)

```kotlin theme={null}
fun onMemberUpdated(memberInfo: MemberInfo)
```

方法说明：指定成员的 Meeting 信息刷新。

参数说明：

| 参数           | 说明        |
| ------------ | --------- |
| `memberInfo` | 更新后的成员快照。 |

返回值说明：无（`Unit`）。

### onUserNameChanged(targetUid, nickname)

```kotlin theme={null}
fun onUserNameChanged(targetUid: String, nickname: String)
```

方法说明：成员昵称变化。

参数说明：

| 参数          | 说明        |
| ----------- | --------- |
| `targetUid` | 目标成员 UID。 |
| `nickname`  | 变更后的成员昵称。 |

返回值说明：无（`Unit`）。

### onUserRoleChanged(targetUid, roleType)

```kotlin theme={null}
fun onUserRoleChanged(targetUid: String, roleType: MemberRoleType)
```

方法说明：成员角色变化。

参数说明：

| 参数          | 说明        |
| ----------- | --------- |
| `targetUid` | 目标成员 UID。 |
| `roleType`  | 变更后的成员角色。 |

返回值说明：无（`Unit`）。

### onMeMembershipChanged(isMember)

```kotlin theme={null}
fun onMeMembershipChanged(isMember: Boolean)
```

方法说明：当前用户的正式成员或观众身份变化。

参数说明：

| 参数         | 说明                          |
| ---------- | --------------------------- |
| `isMember` | `true` 表示正式成员，`false` 表示观众。 |

返回值说明：无（`Unit`）。

## 设备与权限

### onUserCameraStateChanged(targetUid, cameraState, reason)

```kotlin theme={null}
fun onUserCameraStateChanged(
    targetUid: String,
    cameraState: DeviceState,
    reason: ChangeReason
)
```

方法说明：成员摄像头状态变化。

参数说明：

| 参数            | 说明            |
| ------------- | ------------- |
| `targetUid`   | 目标成员 UID。     |
| `cameraState` | 打开或关闭状态。      |
| `reason`      | 成员自行操作或主持人操作。 |

返回值说明：无（`Unit`）。

### onUserMicStateChanged(targetUid, micState, reason)

```kotlin theme={null}
fun onUserMicStateChanged(
    targetUid: String,
    micState: DeviceState,
    reason: ChangeReason
)
```

方法说明：成员麦克风状态变化。

参数说明：

| 参数          | 说明            |
| ----------- | ------------- |
| `targetUid` | 目标成员 UID。     |
| `micState`  | 麦克风打开或关闭状态。   |
| `reason`    | 成员自行操作或主持人操作。 |

返回值说明：无（`Unit`）。

### onUserDrawDisabledChange(operatorUid, targetUid, disabled)

```kotlin theme={null}
fun onUserDrawDisabledChange(
    operatorUid: String?,
    targetUid: String?,
    disabled: Boolean?
)
```

方法说明：指定成员的白板涂鸦权限变化。

参数说明：

| 参数            | 说明                         |
| ------------- | -------------------------- |
| `operatorUid` | 可空操作者 UID。                 |
| `targetUid`   | 可空目标成员 UID。                |
| `disabled`    | `true` 禁止涂鸦；无法解析时为 `null`。 |

返回值说明：无（`Unit`）。

### onUserChatDisabledChange(operatorUid, disabled)

```kotlin theme={null}
fun onUserChatDisabledChange(operatorUid: String?, disabled: Boolean)
```

方法说明：当前成员聊天权限变化。

参数说明：

| 参数            | 说明                       |
| ------------- | ------------------------ |
| `operatorUid` | 操作者 UID；系统事件时可能为 `null`。 |
| `disabled`    | `true` 表示禁止当前成员聊天。       |

返回值说明：无（`Unit`）。

### onHandUpConfirm(operatorUid, targetUid, approved, handUpType)

```kotlin theme={null}
fun onHandUpConfirm(
    operatorUid: String?,
    targetUid: String,
    approved: Boolean,
    handUpType: HandUpType
)
```

方法说明：主持人处理了指定成员的举手申请。

参数说明：

| 参数            | 说明                    |
| ------------- | --------------------- |
| `operatorUid` | 可空主持人 UID。            |
| `targetUid`   | 申请成员 UID。             |
| `approved`    | `true` 同意，`false` 拒绝。 |
| `handUpType`  | 举手申请类型。               |

返回值说明：无（`Unit`）。

## 主持人请求与成员回复

### onRequestOpenCamera(operatorUid)

```kotlin theme={null}
fun onRequestOpenCamera(operatorUid: String?)
```

方法说明：当前用户收到打开摄像头请求。

参数说明：

| 参数            | 说明                       |
| ------------- | ------------------------ |
| `operatorUid` | 请求方 UID；无法确定时可能为 `null`。 |

返回值说明：无（`Unit`）。使用 `confirmOpenCameraAgree()` / `confirmOpenCameraRefuse()` 回复。

### onRequestOpenMic(operatorUid)

```kotlin theme={null}
fun onRequestOpenMic(operatorUid: String?)
```

方法说明：当前用户收到打开麦克风请求。

参数说明：

| 参数            | 说明                       |
| ------------- | ------------------------ |
| `operatorUid` | 请求方 UID；无法确定时可能为 `null`。 |

返回值说明：无（`Unit`）。使用 `confirmOpenMicAgree()` / `confirmOpenMicRefuse()` 回复。

### onRequestStartShare(operatorUid)

```kotlin theme={null}
fun onRequestStartShare(operatorUid: String?)
```

方法说明：当前用户收到开始屏幕共享请求。

参数说明：

| 参数            | 说明                       |
| ------------- | ------------------------ |
| `operatorUid` | 请求方 UID；无法确定时可能为 `null`。 |

返回值说明：无（`Unit`）。使用 `confirmStartScreenShareAgree()` / `confirmStartScreenShareRefuse()` 回复。

### onUserConfirmOpenCamera(operatorUid, approved)

```kotlin theme={null}
fun onUserConfirmOpenCamera(operatorUid: String, approved: Boolean)
```

方法说明：目标成员回复了打开摄像头请求。

参数说明：

| 参数            | 说明                             |
| ------------- | ------------------------------ |
| `operatorUid` | 回复请求的成员 UID。                   |
| `approved`    | `true` 表示同意打开摄像头，`false` 表示拒绝。 |

返回值说明：无（`Unit`）。

### onUserConfirmOpenMic(operatorUid, approved)

```kotlin theme={null}
fun onUserConfirmOpenMic(operatorUid: String, approved: Boolean)
```

方法说明：目标成员回复了打开麦克风请求。

参数说明：

| 参数            | 说明                             |
| ------------- | ------------------------------ |
| `operatorUid` | 回复请求的成员 UID。                   |
| `approved`    | `true` 表示同意打开麦克风，`false` 表示拒绝。 |

返回值说明：无（`Unit`）。

## 等候室与会场移动

### onMoveInWaitingRoom(operatorUid, nickname)

```kotlin theme={null}
fun onMoveInWaitingRoom(operatorUid: String?, nickname: String?)
```

方法说明：当前用户被移入等候室。

参数说明：

| 参数            | 说明                       |
| ------------- | ------------------------ |
| `operatorUid` | 操作者 UID；系统操作时可能为 `null`。 |
| `nickname`    | 操作者昵称；无法确定时可能为 `null`。   |

返回值说明：无（`Unit`）。

### onUserEnterWaitingRoom(uid, nickname)

```kotlin theme={null}
fun onUserEnterWaitingRoom(uid: String, nickname: String)
```

方法说明：等候室中有用户进入。

参数说明：

| 参数         | 说明            |
| ---------- | ------------- |
| `uid`      | 进入等候室的用户 UID。 |
| `nickname` | 用户昵称。         |

返回值说明：无（`Unit`）。

### onUserExitWaitingRoom(uid, nickname)

```kotlin theme={null}
fun onUserExitWaitingRoom(uid: String, nickname: String)
```

方法说明：等候室中有用户离开。

参数说明：

| 参数         | 说明            |
| ---------- | ------------- |
| `uid`      | 离开等候室的用户 UID。 |
| `nickname` | 用户昵称。         |

返回值说明：无（`Unit`）。

### onRequestMoveToMainMeetOrSubMeet(targetMeetingId, targetMeetingTitle)

```kotlin theme={null}
fun onRequestMoveToMainMeetOrSubMeet(
    targetMeetingId: String?,
    targetMeetingTitle: String?
)
```

方法说明：当前用户被请求移动到主会场或指定讨论组。

参数说明：

| 参数                   | 说明         |
| -------------------- | ---------- |
| `targetMeetingId`    | 可空目标会议 ID。 |
| `targetMeetingTitle` | 可空目标会议标题。  |

返回值说明：无（`Unit`）。

## 轨道变化

### onTrackAdded(uid, trackInfo)

```kotlin theme={null}
fun onTrackAdded(uid: String, trackInfo: TrackInfo)
```

方法说明：远端成员新增一条媒体轨道。

参数说明：

| 参数          | 说明           |
| ----------- | ------------ |
| `uid`       | 新增轨道的成员 UID。 |
| `trackInfo` | 新增轨道的信息。     |

返回值说明：无（`Unit`）。

### onTrackUpdated(uid, trackInfo)

```kotlin theme={null}
fun onTrackUpdated(uid: String, trackInfo: TrackInfo)
```

方法说明：远端成员的一条媒体轨道信息更新。

参数说明：

| 参数          | 说明           |
| ----------- | ------------ |
| `uid`       | 更新轨道的成员 UID。 |
| `trackInfo` | 更新后的轨道信息。    |

返回值说明：无（`Unit`）。

### onTrackRemoved(uid, trackInfo)

```kotlin theme={null}
fun onTrackRemoved(uid: String, trackInfo: TrackInfo)
```

方法说明：远端成员移除一条媒体轨道。

参数说明：

| 参数          | 说明              |
| ----------- | --------------- |
| `uid`       | 移除轨道的成员 UID。    |
| `trackInfo` | 被移除轨道的最后一次可用快照。 |

返回值说明：无（`Unit`）。
