音视频通话

房间自定义属性

功能介绍

房间自定义属性用于在房间维度存储业务侧需要的键值信息,例如会议主题、当前主持人、业务状态标记等。同一房间内的与会成员可共享这些字段。

本模块提供完整的生命周期能力:设置整包属性、查询全部或指定键、增量添加或更新、按键删除以及清空全部属性;各操作通过异步接口发起,结果在对应回调中返回。属性发生变更时,还可通过通知接口获知更新(详见 notifyMeetingAttrsChanged)。

下文按典型操作分节说明接口调用与对应回调,各小节末尾列出相关 API 链接。

1.设置房间属性

  • 调用接口:
//即将设置的属性
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
[attrs setValue:@"" forKey:@"MeetingName"];
[attrs setValue:@"" forKey:@"departmentName"];
//全部通知
NSMutableDictionary *options = [NSMutableDictionary dictionary];
[options setValue:@"1" forKey:@"notifyAll"];

[[RTCMeeting shareInstance] setMeetingAttrs:attrs options:options cookie:@""];
  • 回调通知:
//设置会议属性结果
-(void)resetMeetingAttrsRslt:(CRVIDEOSDK_ERR_DEF)sdkErr cookie:(NSString *)cookie
{
   // TODO Auto-generated method stub
}

相关API请参考:

相关结构定义请参考:

2.获取房间属性

  • 调用接口:
//获取的指定的属性
NSArray<NSString*> *keys = @[@"MeetingName", @"CompanyName"];
[[RTCMeeting shareInstance] getMeetingAttrs:keys cookie:@""];

//获取的所有属性
[[RTCMeeting shareInstance] getMeetingAllAttrs:@""];
  • 回调通知:
-(void)getMeetingAllAttrsSuccess:(MeetingAttrs*)attrSeq cookie:(NSString *)cookie {
    // TODO Auto-generated method stub
}

-(void)getMeetingAllAttrsFail:(CRVIDEOSDK_ERR_DEF)sdkErr cookie:(NSString *)cookie {
    // TODO Auto-generated method stub
}

相关API请参考:

3.获取房间特定属性

  • 调用接口:
//获取的指定的属性
NSArray<NSString*> *keys = @[@"MeetingName", @"CompanyName"];
[[RTCMeeting shareInstance] getMeetingAttrs:keys cookie:@""];
  • 回调通知:
-(void)getMeetingAllAttrsSuccess:(MeetingAttrs*)attrSeq cookie:(NSString *)cookie {
    // TODO Auto-generated method stub
}

-(void)getMeetingAllAttrsFail:(CRVIDEOSDK_ERR_DEF)sdkErr cookie:(NSString *)cookie {
    // TODO Auto-generated method stub
}

相关API请参考:

4.添加或更新属性

  • 调用接口:
//即将添加或更新的属性
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
[attrs setValue:@"" forKey:@"MeetingName"];
[attrs setValue:@"" forKey:@"departmentName"];
//全部通知
NSMutableDictionary *options = [NSMutableDictionary dictionary];
[options setValue:@"1" forKey:@"notifyAll"];

[[RTCMeeting shareInstance] addOrUpdateMeetingAttrs:attrs options:options cookie:@""];
  • 回调通知:
-(void)addOrUpdateMeetingAttrsRslt:(CRVIDEOSDK_ERR_DEF)sdkErr cookie:(NSString *)cookie {
     // TODO Auto-generated method stub
}

相关API请参考:

5.删除房间特定属性

  • 调用接口:
NSArray<NSString*> *keys = @[@"MeetingName", @"CompanyName"];
NSMutableDictionary *options = [NSMutableDictionary dictionary];
[[RTCMeeting shareInstance] delMeetingAttrs:keys options:options cookie:@""];
  • 回调通知:
-(void)delMeetingAttrsRslt:(CRVIDEOSDK_ERR_DEF)sdkErr cookie:(NSString *)cookie {
    // TODO Auto-generated method stub
}

相关API请参考:

6.清除房间全部属性

  • 调用接口:
[[RTCMeeting shareInstance] clearMeetingAttrs:@"" cookie:@""];
  • 回调通知:
-(void)clearMeetingAttrsRslt:(CRVIDEOSDK_ERR_DEF)sdkErr cookie:(NSString *)cookie {
    // TODO Auto-generated method stub
}

相关API请参考: