加入房间
1、客户端加入房间配置信息
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
sid | string | 是 | room id | YXQ-202206232022062300001003 03000001-16578802507758596 |
uid | string | 是 | 用户 id | user_poc |
displayname | string | 是 | 展示名称 | new peer |
destination | string | 是 | 目标 | webrtc://ion/peer1 |
role | number | 是 | 角色 | Ion.Role.HOST |
direction | number | 是 | 方向 | Ion.Direction.INCOMING |
客户端加入房间代码示例:
room.join({
sid: roomId,
uid: userId,
displayname: 'new peer',
destination: 'webrtc://ion/peer1',
role: Ion.Role.HOST,
protocol: Ion.Protocol.WEBRTC,
direction: Ion.Direction.INCOMING,
})
2、remoteRTC加入房间配置信息
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
roomId | string | 是 | room id | YXQ-202206232022062300001003 03000001-16578802507758596 |
userId | string | 是 | 用户 id | user_poc |
remoteRTC加入房间代码示例:
// 因为room.join是Promise,可以在客户端成功加入房间的 then 方法里 让remoteRTC加入房间
.then( result => {
remoteRTC.join(roomId, userId)
})