连麦用户列表
本文档主要讲述连麦用户列表及节点 ConnectMicItem
的 Api 说明。
一、连麦列表
1.1 获取连麦列表
观众观看连麦用户流方式:
当观众未连麦时,以混流的方式观看;
当观众连麦后,以 RTC 流观看;
当观众上麦或连麦用户流加入后触发 ConnectMicEvents.ConnectMicDataChange 事件,开发者通过事件的 micDatas
或 getMicDatas
方法获取连麦用户列表。
Api 方法: getMicDatas(): ConnectMicItemData[]
返回值说明: ConnectMicItemData[]
类型
示例:
1.2 连麦节点数据
Interface 接口: ConnectMicItemData
userId
用户 id
string
nickname
用户昵称
string
avatar
用户头像
string
userType
用户类型
ChatUserType
isLocal
是否为本地推流
boolean
isMaster
是否为主讲
boolean
currentVolume
当前音量(0 ~ 1)
number
isAudioMuted
是否关闭麦克风
boolean
isVideoMuted
是否关闭摄像头
boolean
pusherAttributes
推流参数
PusherAttributes
playerAttributes
拉流参数
PlayerAttributes
二、连麦数据事件
当连麦列表发送改变时会触发 ConnectMicEvents.ConnectMicDataChange
连麦列表修改事件,场景包括:上下麦、连麦用户麦克风和摄像头状态更改、音量更改等,开发者在获取新的连麦列表数据后,需要将数据中的 pusherAttributes
或 playerAttributes
重新赋值给 <live-pusher>
或 <live-player>
,详细可参考 demo 中的 <connect-mic-player>
组件。
Last updated
Was this helpful?