Event Download
Pre-requisite: The user has to be signed in to perform the following operations.
EventDownloader builds the commands needed to turn a recorded event into a local video file or a still image. The SDK fetches the event’s playlist with eventM3U8, appends the Authorization token to every segment, writes the rewritten playlist to the temporary directory and builds the FFmpeg command against that file. Only the probe and the FFmpeg execution are delegated to the app through the closures; executeProbe is not called for snapshots. The call fails with IVError.customError("Authorization token is missing in URL") if the URL carries no token.
EventDownloader.instance
The camera type is passed as EventDownloader.CameraType, which is either .camera or .nvr.
Build the Download Command
To build the command for a recorded event, The following method can be used:
cameraType(optional):.cameraor.nvr. Defaults to.camera.url(required): The playlist url of the event, including its authorization query parameter.isSnapshot(optional): Pass true to produce a still image instead of a video.size(optional): The output size. Passnilto keep the native resolution.hardwareConfig(optional): The hardware config of the camera, for stitched multi sensor output.executeProbe(required): Called with the probe command to be run. Return its output through the supplied result closure.executeFFmpeg(required): Called with the final command and the paths it will write, or with an error.
EventDownloader.instance.buildCommand(
cameraType: EventDownloader.CameraType,
url: URL,
isSnapshot: Bool,
size: CGSize?,
hardwareConfig: HardwareConfig?,
executeProbe: { command, result in
// Run the probe command and pass its output to result
},
executeFFmpeg: { outcome in
// Run the returned command, or handle the error
}
)
Daily Summaries
Summary videos are plain files rather than segmented playlists, so they have their own builder with no playlist rewrite:
EventDownloader.buildCommandForDailySummary(cameraType:url:size:hardwareConfig:executeProbe:executeFFmpeg:)
See Daily Summaries.