云回看
更新时间:2025-07-04 11:30:46
云端存储录像相关接口调用同【通用版-云回看】类似,区别在于专属版在构建RTCXCloudStorageReq子类请求对象时,需要设置RTCXCloudStorageReq.isPrivatized = YES来区分是私有化设备,目前专属版只支持如下接口:
// 导入设备管理SDK头文件
#import <RTCXDeviceCenter/RTCXDeviceCenter.h>
@protocol RTCXCloudStorageProtocol <NSObject>
/**
* 查询云存录像列表
*
* @param req 请求参数对象
* @param onSuccess 成功回调
* @param onError 失败回调
*/
- (void)queryRecordListWithReq:(nonnull RTCXCloudStorageRecordReq *)req onSuccess:(nullable RTCXCloudStorageOnSuccess)onSuccess onError:(nullable RTCXCloudStorageOnError)onError;
/**
* 查询云存录像点播地址
*
* @param req 请求参数对象
* @param onSuccess 成功回调
* @param onError 失败回调
*/
- (void)queryVodUrlWithReq:(nonnull RTCXCloudStorageVodUrlReq *)req onSuccess:(nullable RTCXCloudStorageOnSuccess)onSuccess onError:(nullable RTCXCloudStorageOnError)onError;
/**
* 查询月录像
*
* @param req 请求参数对象
* @param onSuccess 成功回调
* @param onError 失败回调
*/
- (void)queryMonthRecordWithReq:(nonnull RTCXCloudStorageMonthRecordReq *)req onSuccess:(nullable RTCXCloudStorageOnSuccess)onSuccess onError:(nullable RTCXCloudStorageOnError)onError;
/**
* 删除云存录像
*
* @param req 请求参数对象
* @param onSuccess 成功回调
* @param onError 失败回调
*/
- (void)deleteRecordWithReq:(nonnull RTCXCloudStorageDeleteRecordReq *)req onSuccess:(nullable RTCXCloudStorageOnSuccess)onSuccess onError:(nullable RTCXCloudStorageOnError)onError;
@end
查询云存录像列表
备注:该接口默认一次性返回beginTime和endTime时间段内所有数据,(注意:如果该时间段跨度比较大,可能查询比较耗时,所以建议不要跨度太大,或者通过分页查询)
- 分页规则:
-
设置pageSize参数,如pageSize = @(10)
-
当响应的RTCXCloudStorageRecordListRsp.nextValid = YES,说明可以继续查询下一页数据,否则没有可查询的更多数据了;
-
查寻下一页时,入参beginTime为上一次的beginTime,endTime为上一次的RTCXCloudStorageRecordListRsp.nextEndTime。
-
RTCXCloudStorageRecordReq *recordReq = [[RTCXCloudStorageRecordReq alloc] init];
recordReq.iotId = weakSelf.curDevice.iotId;
recordReq.beginTime = @(beginTime);
recordReq.endTime = @(endTime);
recordReq.isPrivatized = YES;
[RTCXDeviceService(RTCXCloudStorageProtocol) queryRecordListWithReq:recordReq onSuccess:^(id _Nullable data, id _Nullable rawData) {
RTCXCloudStorageRecordListRsp *rsp = data;
NSArray *records = rsp.recordFileList;
NSMutableArray *sectionArray = [[NSMutableArray alloc] initWithCapacity:0];
[records enumerateObjectsUsingBlock:^(RTCXCloudStorageRecordRsp *_Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
TimelineSectionClip *sectionClip = [[TimelineSectionClip alloc] init];
sectionClip.startTime = [NSDate dateWithTimeIntervalSince1970:obj.beginTime/1000];
sectionClip.endTime = [NSDate dateWithTimeIntervalSince1970:obj.endTime/1000];
[sectionArray addObject:sectionClip];
}];
[weakSelf.timelineData insertSectionDatas:sectionArray needUpdateWhenSameID:YES];
} onError:^(NSError * _Nullable error) {
[weakSelf showToast:@"查询云存录像列表失败"];
}];
查询云存录像点播地址
RTCXCloudStorageVodUrlReq *req = [[RTCXCloudStorageVodUrlReq alloc] init];
req.iotId = self.observer.iotId;
req.beginTime = @(startTime);
req.endTime = @(endTime);
req.isPrivatized = YES;
[RTCXDeviceService(RTCXCloudStorageProtocol) queryVodUrlWithReq:req onSuccess:^(id _Nullable data, id _Nullable rawData) {
RTCXCloudStorageVodUrlRsp *rsp = data;
NSString *vodUrl = rsp.vodUrl;
} onError:^(NSError * _Nullable error) {
}];
查询月录像
RTCXCloudStorageMonthRecordReq *req = [[RTCXCloudStorageMonthRecordReq alloc] init];
req.iotId = self.curDevice.iotId;
req.beginTime = @(beginTime);
req.endTime = @(endTime);
req.zoneOffsetId = [self getTimeZoneOffset];
req.isPrivatized = YES;
[RTCXDeviceService(RTCXCloudStorageProtocol) queryMonthRecordWithReq:req onSuccess:^(id _Nullable data, id _Nullable rawData) {
RTCXCloudStorageMonthRecordRsp *rsp = data;
self.monthRecordRsp = rsp;
[self reloadTableview];
} onError:^(NSError * _Nullable error) {
[self showToast:@"查询云录像统计列表失败"];
}];
删除云存录像
RTCXCloudStorageDeleteRecordReq *deleteRecordReq = [[RTCXCloudStorageDeleteRecordReq alloc] init];
deleteRecordReq.iotId = weakSelf.curDevice.iotId;
deleteRecordReq.beginTime = @(beginTime);
deleteRecordReq.endTime = @(endTime);
deleteRecordReq.isPrivatized = YES;
[RTCXDeviceService(RTCXCloudStorageProtocol) deleteRecordWithReq:deleteRecordReq onSuccess:^(id _Nullable data, id _Nullable rawData) {
[weakSelf showToast:@"删除云存录像成功"];
[weakSelf queryData];
} onError:^(NSError * _Nullable error) {
[weakSelf showToast:@"删除云存录像失败"];
}];
设备缩略图
@protocol RTCXDeviceMgrProtocol <NSObject>
/**
* 获取设备缩略图
*
* @param req 请求参数对象
* @param onSuccess 成功回调
* @param onError 失败回调
*/
- (void)getDeviceThumbnailWithReq:(nonnull RTCXGetDeviceThumbnailReq *)req onSuccess:(nullable RTCXDeviceMgrOnSuccess)onSuccess onError:(nullable RTCXDeviceMgrOnError)onError;
@end
调用示例如下:
RTCXGetDeviceThumbnailReq *req = [[RTCXGetDeviceThumbnailReq alloc] init];
req.productKey = self.productKeyTF.text;
req.deviceName = self.deviceNameTF.text;
req.definition = 1;
req.picType = @"jpg";
req.isPrivatized = YES;
[RTCXDeviceService(RTCXDeviceMgrProtocol) getDeviceThumbnailWithReq:req onSuccess:^(id _Nullable data, id _Nullable rawData) {
RTCXGetDeviceThumbnailRsp *rsp = data;
COMMON_PRINTF(@"+++++%@",rsp);
} onError:^(NSError * _Nullable error) {
COMMON_PRINTF(@"+++++%@",error);
}];