API 概览
Classroom SDK 通过 Edu Context 为 App 开发者提供实现灵动课堂业务功能的能力。不同的 Context 代表灵动课堂中不同的业务功能模块,每个 Context 既包含供 App 调用的方法,也会向 App 报告事件回调。
Media Context
| 方法 | 描述 |
|---|---|
| getLocalDevices | 获取本地设备。 |
| openLocalDevice | 开启指定本地设备。 |
| closeLocalDevice | 关闭本地设备。 |
| getLocalDeviceState | 获取本地设备状态。 |
| startRenderVideo | 开始渲染视频流。 |
| stopRenderVideo | 停止渲染视频流。 |
| startAudioMixing | 开始混音。 |
| stopAudioMixing | 停止混音。 |
| setAudioMixingPosition | 设置用于混音的音乐文件的起始播放位置。 |
| onVolumeUpdated | 音量变化回调。 |
| onLocalDeviceStateUpdated | 本地设备状态变化回调。 |
| onLocalDeviceConnected | 本地设备已连接回调。 |
| onLocalDeviceDisconnected | 本地设备连接断开回调。 |
| onAudioMixingStateChanged | 混音状态变化回调。 |
Monitor Context
| 方法 | 描述 |
|---|---|
| uploadLog | 上传日志。 |
| onLocalNetworkQualityUpdated | 本地网络质量变化回调。 |
| onLocalConnectionUpdated | 本地与声网服务器连接状态变化回调。 |
Room Context
| 方法 | 描述 |
|---|---|
| joinRoom | 加入房间。 |
| leaveRoom | 离开房间。 |
| getRoomInfo | 获取房间信息。 |
| getRoomProperties | 获取自定义房间属性。 |
| updateRoomProperties | 新增或更新自定义房间属性。 |
| deleteRoomProperties | 删除自定义房间属性。 |
| onRoomJoinedSuccess | 本地成功加入房间回调。 |
| onRoomJoinedFail | 本地加入房间失败回调。 |
| onRoomPropertiesUpdated | 自定义房间属性更新回调。 |
| onRoomPropertiesDeleted | 自定义房间属性删除回调。 |
| onRoomClosed | 房间关闭回调。 |
| onClassStateUpdated | 课堂状态更新回调。 |
Stream Context
| 方法 | 描述 |
|---|---|
| getStreamList | 获取指定用户的所有流。 |
| getAllStreamList | 获取所有流。 |
| setLocalVideoConfig | 设置本地视频流的编码配置。 |
| setRemoteVideoStreamSubscribeLevel | 订阅高分辨率或低分辨率的远端流。 |
| onStreamUpdated | 流更新回调。 |
| onStreamJoined | 流新增回调。 |
| onStreamLeft | 流移除回调。 |
User Context
| 方法 | 描述 |
|---|---|
| getLocalDevices | 获取本地设备。 |
| getCoHostList | 获取所有上台用户的信息。 |
| getUserList | 获取指定角色的用户信息。 |
| getAllUserList | 获取房间内所有用户的信息。 |
| updateUserProperties | 新增或更新自定义用户属性。 |
| deleteUserProperties | 删除自定义用户属性。 |
| getUserProperties | 获取指定用户的自定义属性。 |
| getUserRewardCount | 获取指定用户拥有的奖励数量。 |
| getHandsWaveEnable | 确认是否能举手。 |
| handsWave | 举手申请上讲台发言。 |
| handsDown | 取消举手。 |
| onRemoteUserJoined | 远端用户加入房间回调。 |
| onRemoteUserLeft | 远端用户离开房间回调。 |
| onUserUpdated | 用户信息更新回调。 |
| onCoHostUserListAdded | 用户成功上讲台回调。 |
| onCoHostUserListRemoved | 用户离开讲台回调。 |
| onUserPropertiesUpdated | 自定义用户属性更新回调。 |
| onUserPropertiesDeleted | 自定义用户属性删除回调。 |
| onUserRewarded | 用户奖励数量变更回调。 |
| onLocalUserKickedOut | 本地用户被踢出房间回调。 |
| onHandsWaveEnabled | 举手功能是否启用回调。 |
| onUserHandsWave | 用户举手回调。 |
| onUserHandsDown | 用户手放下回调。 |