Skip to content

Recording a video stream only with the face detected#

With LUNA ID, you can record either entire video sessions or only video sessions in which a face was detected in at least one frame.

In LUNA ID for Android#

To do this, call LunaID.showCamera() with ShowCameraParams(recordVideo=true, ignoreVideoWithoutFace=true).

In LUNA ID for iOS#

To do this, pass appropriate values for the recordVideo and configuration parameters to the LMCameraBuilder.viewController camera controller instance creation function:

let controller = LMCameraBuilder.viewController(delegate: self,
                                                    configuration: LCLunaConfiguration,
                                                    recordVideo: true)
Parameter Description
configuration The parameter is represented by the LCLunaConfiguration structure. The LCLunaConfiguration → saveOnlyFaceVideo = true parameter is responsible for saving video files only with a face detected.
recordVideo The parameter is responsible for saving the video file.

You can 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?)

}