跳到主要内容

云回看

更新时间:2026-06-16 17:21:46

云端存储录像与事件

// 导入头文件
import 'package:airtc_engine/src/cloud_storage/rtcx_cloud_storage.dart';

云存储录像调用接口

RTCXFluCloudPlaybackApi {
/// 查询云存录像列表
@async
RTCXFluCloudStorageRecordListRsp queryRecordList(
RTCXFluCloudStorageRecordReq req,
);

/// 查询云存事件列表
@async
RTCXFluCloudStorageEventListRsp queryEventList(
RTCXFluCloudStorageEventReq req,
);

/// 查询云存录像点播地址
@async
RTCXFluCloudStorageVodUrlRsp queryVodUrl(RTCXFluCloudStorageVodUrlReq req);

/// 查询云存事件点播地址
@async
RTCXFluCloudStorageVodEventUrlRsp queryVodEventUrl(
RTCXFluCloudStorageVodEventUrlReq req,
);

/// 查询月录像
@async
RTCXFluCloudStorageMonthRecordRsp queryMonthRecord(
RTCXFluCloudStorageMonthRecordReq req,
);

/// 查询月事件
@async
RTCXFluCloudStorageMonthEventRsp queryMonthEvent(
RTCXFluCloudStorageMonthEventReq req,
);

/// 删除云存录像
@async
RTCXFluCloudStorageDeleteRecordRsp deleteRecord(
RTCXFluCloudStorageDeleteRecordReq req,
);

/// 删除云存事件
@async
RTCXFluCloudStorageDeleteEventRsp deleteEvent(
RTCXFluCloudStorageDeleteEventReq req,
);

/// 查询事件描述(事件最新记录时间,事件小红点)
@async
RTCXFluCloudStorageEventDescRsp queryEventDesc(
RTCXFluCloudStorageEventDescReq req,
);

/// 查询设备当前机房信息
@async
RTCXFluCloudStorageCurrentRegionRsp queryCurrentRegion(
RTCXFluCloudStorageCurrentRegionReq req,
);

/// 查询设备历史机房信息
@async
RTCXFluCloudStorageHistoryRegionListRsp queryHistoryRegion(
RTCXFluCloudStorageHistoryRegionReq req,
);

/// 查询消息中心事件描述(消息中心最新记录时间,消息中心小红点)
@async
RTCXFluCloudStorageMessageDescRsp queryMessageDesc(
RTCXFluCloudStorageMessageDescReq req,
);

/// 查询月消息(消息中心按天统计)
@async
RTCXFluCloudStorageMonthMessageRsp queryMonthMessage(
RTCXFluCloudStorageMonthMessageReq req,
);

/// 查询消息中心事件列表
@async
RTCXFluCloudStorageMessageEventListRsp queryMessageCenterEventList(
RTCXFluCloudStorageMessageEventReq req,
);

/// 批量删除消息中心事件
@async
RTCXFluCloudStorageDeleteMessageRsp deleteMessage(
RTCXFluCloudStorageDeleteMessageReq req,
);

/// 根据图片ID列表获取图片地址
@async
RTCXFluCloudStoragePicUrlListRsp queryPictureUrlById(
RTCXFluCloudStoragePicUrlReq req,
);

/// 查询当前云存储套餐详情
@async
RTCXFluCloudServicesRsp queryDeviceCurrentCloudServices(RTCXFluCloudServicesReq req);

/// 查询历史云存储套餐详情
@async
RTCXFluCloudServicesHistoryRsp queryDeviceHistoryCloudServices(
RTCXFluCloudServicesReq req,
);
}

云端存储套餐调用接口

/// 查询当前云存储套餐详情
@async
RTCXFluCloudServicesRsp queryDeviceCurrentCloudServices(RTCXFluCloudServicesReq req);

/// 查询历史云存储套餐详情
@async
RTCXFluCloudServicesHistoryRsp queryDeviceHistoryCloudServices(
RTCXFluCloudServicesReq req,
);

创建api实例

// 创建api实例
final RTCXFluCloudPlaybackApi cloudPlaybackApi = RTCXFluCloudPlaybackApi();

查询云存录像列表

备注:该接口默认一次性返回beginTime和endTime时间段内所有数据,(注意:如果该时间段跨度比较大,可能查询比较耗时,所以建议不要跨度太大,或者通过分页查询)

  • 分页规则:
    • 设置pageSize参数,如pageSize = @(10)

    • 当响应的RTCXFluCloudStorageRecordListRsp.nextValid = YES,说明可以继续查询下一页数据,否则没有可查询的更多数据了;

    • 查寻下一页时,入参beginTime为上一次的beginTime,endTime为上一次的RTCXFluCloudStorageRecordListRsp.nextEndTime。

void queryRecordList() {
RTCXFluCloudStorageRecordReq req = RTCXFluCloudStorageRecordReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
pageSize: 20,
pageStart: 0,
);
cloudPlaybackApi
.queryRecordList(req)
.then((RTCXFluCloudStorageRecordListRsp rsp) {
print("queryRecordList rsp:${rsp.toString()}");
List<RTCXFluCloudStorageSectionRsp>? recordList = rsp.recordFileList;
if (rsp.nextValid != null && rsp.nextValid == true) {
// 说明可以继续查询下一页数据,否则没有可查询的更多数据了;
}
})
.catchError((error) {
print("queryRecordList error:${error.toString()}");
});
}

查询云存事件列表

备注:该接口默认一次性返回beginTime和endTime时间段内所有数据,(注意:如果该时间段跨度比较大,可能查询比较耗时,所以建议不要跨度太大,或者通过分页查询)

  • 分页规则:
    • 设置pageSize参数,如pageSize = @(50)

    • 当响应的rsp.nextValid = YES,说明可以继续查询下一页数据,否则没有可查询的更多数据了;

    • 查寻下一页时,入参beginTime为上一次的beginTime,endTime为上一次的RTCXFluCloudStorageEventListRsp.nextEndTime。

void queryEventList() {
RTCXFluCloudStorageEventReq req = RTCXFluCloudStorageEventReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
pageSize: 20,
);
cloudPlaybackApi
.queryEventList(req)
.then((RTCXFluCloudStorageEventListRsp rsp) {
print("queryEventList rsp:${rsp.toString()}");
List<RTCXFluCloudStorageEventRsp>? eventList = rsp.eventList;
if (rsp.nextValid != null && rsp.nextValid == true) {
// 说明可以继续查询下一页数据,否则没有可查询的更多数据了;
}
})
.catchError((error) {
print("queryEventList error:${error.toString()}");
});
}

查询云存录像点播地址

void queryVodUrl() {
RTCXFluCloudStorageVodUrlReq req = RTCXFluCloudStorageVodUrlReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryVodUrl(req)
.then((RTCXFluCloudStorageVodUrlRsp rsp) {
print("queryVodUrl rsp:${rsp.toString()}");
String? vodUrl = rsp.vodUrl;
// vodUrl
})
.catchError((error) {
print("queryVodUrl error:${error.toString()}");
});
}

查询云存事件点播地址

void queryVodEventUrl() {
RTCXFluCloudStorageVodEventUrlReq req = RTCXFluCloudStorageVodEventUrlReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryVodEventUrl(req)
.then((RTCXFluCloudStorageVodEventUrlRsp rsp) {
print("queryVodEventUrl rsp:${rsp.toString()}");
String? vodUrl = rsp.vodUrl;
// 点播地址vodUrl
})
.catchError((error) {
print("queryVodEventUrl error:${error.toString()}");
});
}

查询月录像

void queryMonthRecord() {
RTCXFluCloudStorageMonthRecordReq req = RTCXFluCloudStorageMonthRecordReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryMonthRecord(req)
.then((RTCXFluCloudStorageMonthRecordRsp rsp) {
print("queryMonthRecord rsp:${rsp.toString()}");
List<RTCXFluCloudStorageDayRecordRsp>? dayCntList = rsp.dayCntList;
})
.catchError((error) {
print("queryMonthRecord error:${error.toString()}");
});
}

查询月事件

void queryMonthEvent() {
RTCXFluCloudStorageMonthEventReq req = RTCXFluCloudStorageMonthEventReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryMonthEvent(req)
.then((RTCXFluCloudStorageMonthEventRsp rsp) {
print("queryMonthEvent rsp:${rsp.toString()}");
List<RTCXFluCloudStorageDayEventRsp>? eventCntList = rsp.eventCntList;
})
.catchError((error) {
print("queryMonthEvent error:${error.toString()}");
});
}

查询月消息

void queryMonthMessage() {
RTCXFluCloudStorageMonthMessageReq req = RTCXFluCloudStorageMonthMessageReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryMonthMessage(req)
.then((RTCXFluCloudStorageMonthMessageRsp rsp) {
print("queryMonthMessage rsp:${rsp.toString()}");
})
.catchError((error) {
print("queryMonthMessage error:${error.toString()}");
});
}

删除云存录像

void deleteRecord() {
RTCXFluCloudStorageDeleteRecordReq req = RTCXFluCloudStorageDeleteRecordReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.deleteRecord(req)
.then((RTCXFluCloudStorageDeleteRecordRsp rsp) {
print("deleteRecord rsp:${rsp.toString()}");
})
.catchError((error) {
print("deleteRecord error:${error.toString()}");
});
}

删除云存事件

void deleteEvent() {
RTCXFluCloudStorageDeleteEventInfo info =
RTCXFluCloudStorageDeleteEventInfo(
iotId: iotId,
eventId: 1,
region: '',
);

RTCXFluCloudStorageDeleteEventReq req = RTCXFluCloudStorageDeleteEventReq(
iotId: iotId,
events: [info],
);
cloudPlaybackApi
.deleteEvent(req)
.then((RTCXFluCloudStorageDeleteEventRsp rsp) {
print("deleteEvent rsp:${rsp.toString()}");
})
.catchError((error) {
print("deleteEvent error:${error.toString()}");
});
}

删除消息中心事件

void deleteMessage() {
RTCXFluCloudStorageDeleteMessageInfo info =
RTCXFluCloudStorageDeleteMessageInfo(
iotId: iotId,
eventId: 1,
region: region,
);
RTCXFluCloudStorageDeleteMessageReq req =
RTCXFluCloudStorageDeleteMessageReq(iotId: iotId, messages: [info]);
cloudPlaybackApi
.deleteMessage(req)
.then((RTCXFluCloudStorageDeleteMessageRsp rsp) {
print("deleteMessage rsp:${rsp.toString()}");
})
.catchError((error) {
print("deleteMessage error:${error.toString()}");
});
}

查询事件描述

即:查询事件最新记录时间,事件小红点

void queryEventDesc() {
RTCXFluCloudStorageEventDescReq req = RTCXFluCloudStorageEventDescReq(
iotId: iotId,
);
cloudPlaybackApi
.queryEventDesc(req)
.then((RTCXFluCloudStorageEventDescRsp rsp) {
print("queryEventDesc rsp:${rsp.toString()}");
})
.catchError((error) {
print("queryEventDesc error:${error.toString()}");
});
}

查询消息中心事件描述

即:消息中心最新记录时间,消息中心小红点

void queryMessageDesc() {
RTCXFluCloudStorageMessageDescReq req = RTCXFluCloudStorageMessageDescReq(
iotId: iotId,
);
cloudPlaybackApi
.queryMessageDesc(req)
.then((RTCXFluCloudStorageMessageDescRsp rsp) {
print("queryMessageDesc rsp:${rsp.toString()}");
})
.catchError((error) {
print("queryMessageDesc error:${error.toString()}");
});
}

查询消息中心事件列表

事件类型,-128:(自定义消息);1(表示移动侦测);2(表示声音侦测)。详见SDK接口参数描述

void queryMessageCenterEventList() {
RTCXFluCloudStorageMessageEventReq req = RTCXFluCloudStorageMessageEventReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryMessageCenterEventList(req)
.then((RTCXFluCloudStorageMessageEventListRsp rsp) {
print("queryMessageCenterEventList rsp:${rsp.toString()}");
})
.catchError((error) {
print("queryMessageCenterEventList error:${error.toString()}");
});
}

备注:该接口默认一次性返回beginTime和endTime时间段内所有数据,(注意:如果该时间段跨度比较大,可能查询比较耗时,所以建议不要跨度太大,或者通过分页查询)

调用示例如下:

void queryMessageCenterEventList() {
/// 事件类型。0:(自定义消息);1(表示移动侦测);2(表示声音侦测);3(表示人形侦测); 不传表示获取所有类型。可选
RTCXFluCloudStorageMessageEventReq req = RTCXFluCloudStorageMessageEventReq(
iotId: iotId,
beginTime: beginTime,
endTime: endTime,
eventTypes: [
"1",
"2",
"3"
]
);
cloudPlaybackApi
.queryMessageCenterEventList(req)
.then((RTCXFluCloudStorageMessageEventListRsp rsp) {
print("queryMessageCenterEventList rsp:${rsp.toString()}");
})
.catchError((error) {
print("queryMessageCenterEventList error:${error.toString()}");
});
}

查询当前云存储套餐详情

void queryDeviceCurrentCloudServices() {
RTCXFluCloudServicesReq req = RTCXFluCloudServicesReq(
iotId: iotId,
startTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryDeviceCurrentCloudServices(req)
.then((RTCXFluCloudServicesRsp rsp) {
print("queryDeviceCurrentCloudServices rsp:${rsp.toString()}");
})
.catchError((error) {
print("queryDeviceCurrentCloudServices error:${error.toString()}");
});
}

查询历史云存储套餐详情

void queryDeviceHistoryCloudServices() {
RTCXFluCloudServicesReq req = RTCXFluCloudServicesReq(
iotId: iotId,
startTime: beginTime,
endTime: endTime,
);
cloudPlaybackApi
.queryDeviceHistoryCloudServices(req)
.then((RTCXFluCloudServicesHistoryRsp rsp) {
print("queryDeviceHistoryCloudServices rsp:${rsp.toString()}");
})
.catchError((error) {
print("queryDeviceHistoryCloudServices error:${error.toString()}");
});
}