自定义房间属性
RCRTCRoom 类提供在音视频房间属性扩展功能。在音视频房间中,可以设置、获取和删除扩展属性。
设置房间属性
使用 setAttribute
设置房间属性。
Objective C
[self.room setAttribute:[info toJsonString]
forKey:@"属性 Key 值"
message:message
completion:^(BOOL isSuccess, RCRTCCode code) {
}];
参数 | 类型 | 说明 |
---|---|---|
attributeValue | NSString | 属性值 |
key | NSString | 属性名称 |
message | RCMessageContent | 是否在设置属性的时候携带消息内容,传空则不往房间中发送消息,可以通过自定义消息通知其他端有新属性已经设置 |
completion | RCRTCOperationCallback | 设置完成回调 block |
获取房间属性
Objective C
[self.room getAttributes:{@"属性 Key 值"}
completion:^(BOOL isSuccess, RCRTCCode code, NSDictionary * _Nullable attr) {
}];
参数 | 类型 | 说明 |
---|---|---|
attributeKeys | NSArray | 属性 Key 值列表 |
completion | RCRTCAttributeOperationCallback | 查询结果的回调 block |
删除属性
Objective C
[self.room deleteAttributes:@[@" Key 值"]
message:deleteMessage
completion:^(BOOL isSuccess, RCRTCCode code) {
}];