I’m using MobileSDK to export video. Is there a way to export only the segments that contain data, as my current export includes segments without data?
const exportFileVms = async (item) => {
updateExportItemStatus(exportConfig.exporting)
updateExportItemPercent(0)
const camId = item?.deviceId
const startTime = moment(item?.fromDate).valueOf()
const endTime = moment(item?.toDate).valueOf()
const params = {
CameraId: camId,
StartTime: startTime + 1000,
EndTime: endTime - 1000,
Type: item?.format,
Filename: item?.name
}
XPMobileSDK.sendCommand("StartExport", params, {}, checkStatusVideoExport, callBackExportFail)
}
const checkStatusVideoExport = (data) => {
const exportId = data.response.outputParameters.ExportId
intelCheckStatusVideoId.current = setInterval(function () {
XPMobileSDK.getExport(
data.response.outputParameters.ExportId,
(data) => createExportDownloadLink(exportId, data),
createLinkDownloadFail
)
}, 500)
}
const callBackExportFail = (error) => {}
const createExportDownloadLink = (exportId, data) => {
if (data.State === 101) {
clearInterval(intelCheckStatusVideoId.current)
updateExportItemStatus(exportConfig.download_success)
const investigationId = "00000000-0000-0000-0000-000000000000"
XPMobileSDK.createExportDownloadLink(
exportId,
investigationId,
item?.format,
(dataDownload) => createLinkDownloadSuccess(exportId, dataDownload),
createLinkDownloadFail
)
} else if (data.State >= 0 && data.State < 101) {
updateExportItemPercent(data.State)
} else if (data.State < 0) {
updateExportItemPercent(0)
clearInterval(intelCheckStatusVideoId.current)
updateExportItemStatus(exportConfig.export_fail)
} else {
updateExportItemPercent(0)
clearInterval(intelCheckStatusVideoId.current)
updateExportItemStatus(exportConfig.export_fail)
}
}
const createLinkDownloadSuccess = (exportId, data) => {
const link = `IP:port/data`
downloadVideo(exportId, link)
}
const createLinkDownloadFail = (error) => {}
const downloadVideo = async (exportId, link) => {
const downloadLink = document.createElement("a")
downloadLink.href = link
downloadLink.target = "_blank"
downloadLink.download = "download"
downloadLink.click()
deleteExport(exportId)
}