Recording a video stream#
Recording a video stream is a task you may need to perform for further processing of images. The recorded video stream will then be divided into frames. The most suitable still images will be later used for facial recognition and getting the best shot.
In LUNA ID for Android#
To record a video stream, open a camera by using recordVideo = true
. For example:
LunaID.showCamera(
...
recordVideo = true,
)
When the camera finishes its work, LunaID.allEvents()
(or more specialized LunaID.finishStates()
) will emit the ResultSuccess
event with the best shot found and an optional path to the recorded video. The entire process of getting the best shot is written to this video file.
LUNA ID does not manage the video file. This means, that file management, that is deletion, copying, sending to a server, and so on, is performed on your side.
The recording stops when the best shot is captured or when a user closes the camera before LUNA ID gets the best shot.
In LUNA ID for iOS#
To record a video stream:
1․ Define the recordVideo
parameter as true
in:
let controller = LMCameraBuilder.viewController(delegate: self,
recordVideo: true)
2․ Find the video file path in the bestShot
function in the LMCameraDelegate
protocol.
public protocol LMCameraDelegate: AnyObject {
func bestShot(_ bestShot: LunaCore.LCBestShot, _ videoFile: String?)
func error(_ error: LMCameraError, _ videoFile: String?)
}
The detected face in the frame is tracked all the time when the camera is on.