Recording and Snapshots
Note: The camera should have already started streaming LiveView before making any interactions
Start Recording
To start recording the live stream, The following can be used:
size(optional): The size of the recorded video. Passnilto keep the native resolution.fileName(optional): The name of the file to be written.
liveViewObject.startRecording(size: CGSize?, fileName: String? = nil)
The isRecordingLiveView property can be read to check whether a recording is in progress.
Stop Recording
To stop the recording, The following can be used:
completion(required): Returns the path of the recorded file on success.
liveViewObject.stopRecording { result in
switch result {
case .success(let path):
// Path of the recorded file
case .failure(let error):
// Handle the error
}
}
Capture a Snapshot
To capture a still image from the live stream, The following can be used:
size(optional): The size of the captured image. Passnilto keep the native resolution.snapshot(required): Returns the captured image.
liveViewObject.captureSnapshot(size: CGSize?) { image in
// Captured image
}
Capture from a specific view
On a multi sensor camera each lens renders into its own IVVideoView. To capture from one view rather than the whole stream, the same methods are available on the view itself:
let videoView = liveViewObject.remoteViews.first
videoView?.captureSnapshot(size: CGSize?) { image in
// Captured image
}
videoView?.stopRecording { result in
// Path of the recorded file, or an error
}