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. It does not run them: the app supplies the closures that execute the probe and the FFmpeg command, so the FFmpeg integration stays in the app rather than in the SDK.

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): .camera or .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. Pass nil to 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
        }
    )