房间自定义属性
功能介绍
房间自定义属性用于在房间维度存储业务侧需要的键值信息,例如会议主题、当前主持人、业务状态标记等。同一房间内的与会成员可共享这些字段。
本模块提供完整的生命周期能力:设置整包属性、查询全部或指定键、增量添加或更新、按键删除以及清空全部属性;各操作通过异步接口发起,结果在对应回调中返回。属性发生变更时,还可通过通知接口获知更新(详见 onNotifyMeetingAttrsChanged)。
下文按典型操作分节说明接口调用与对应回调,各小节末尾列出相关 API 链接。
1.设置房间属性
- 调用接口:
//即将设置的属性
Map<String, String> attrs = {
"MeetingName": "xxx",
"departmentName": "xxx"
};
Map<String, Object> options = {
notifyAll: 1, //0(默认值):不通知,1:通知房间所有人员
}
CommonResult result = await RtcSDK.attributeManager.setMeetingAttrs(attrs, options);
相关API请参考:
相关结构定义请参考:
2.获取房间属性
- 调用接口:
//获取的所有属性
MeetingAttrResult result = await RtcSDK.attributeManager.getMeetingAllAttrs();
相关API请参考:
3.获取房间特定属性
- 调用接口:
//获取的指定的属性
List<String> keys = ["MeetingName", "CompanyName"];
MeetingAttrResult result = await RtcSDK.attributeManager.getMeetingAttrs(keys);
相关API请参考:
4.添加或更新属性
- 调用接口:
Map<String, String> attrs = {
"MeetingName": "xxx",
"departmentName": "xxx"
};
Map<String, Object> options = {
notifyAll: 0
}
CommonResult result = await RtcSDK.attributeManager.addOrUpdateMeetingAttrs(attrs, options)
相关API请参考:
5.删除房间特定属性
- 调用接口:
List<String> keys = ["MeetingName", "CompanyName"];
Map<String, String> options = {};
CommonResult result = await RtcSDK.attributeManager.delMeetingAttrs(keys, options)
相关API请参考:
6.清除房间全部属性
- 调用接口:
Map<String, String> options = {};
CommonResult result = await RtcSDK.attributeManager.clearMeetingAttrs(options)
相关API请参考: