ActiveFaceCaptureSessionController
class ActiveFaceCaptureSessionController : ObservableObject
This controller handles the business logic for the active face capture session. It handles the processing of the frames captured by the camera and updates the UI accordingly.
-
The active face capture model representing the current state of the session
Declaration
Swift
var model: ActiveFaceCaptureModel
-
The active face capture session
Declaration
Swift
var session: ActiveFaceCaptureSession?
-
The face scanner controller to capture the camera frames
Declaration
Swift
var faceScanController: FaceScannerController
-
Callback for updating the circle color. Usually subscribed by the view.
Declaration
Swift
var onUpdateCircleColor: ((_ model: ActiveFaceCaptureModel) -> Void)?
-
Callback for updating the directional score. Usually subscribed by the view.
Declaration
Swift
var onDirectionUpdate: ((_ model: ActiveFaceCaptureModel) -> Void)?
-
Callback for updating the instructions. Usually subscribed by the view.
Declaration
Swift
var onInstructionUpdate: ((_ model: ActiveFaceCaptureModel) -> Void)?
-
Callback for updating the animation. Usually subscribed by the view.
Declaration
Swift
var onAnimationUpdate: ((_ model: ActiveFaceCaptureModel) -> Void)?
-
Callback for updating the number of states. Usually subscribed by the view.
Declaration
Swift
var onNumOfStateUpdate: ((_ model: ActiveFaceCaptureModel) -> Void)?
-
Callback for handling session errors. Usually subscribed by the view.
Declaration
Swift
var onSessionError: ((_ model: ActiveFaceCaptureModel) -> Void)?
-
Callback for handling session completion. Usually subscribed by the view.
Declaration
Swift
var onSessionCompleted: (() -> Void)?
-
Lock object for thread safety
Declaration
Swift
let lock: Lock
-
Initializes the model and registers the frame captured callback.
Declaration
Swift
init()
-
Declaration
Swift
required init?(coder: NSCoder)
-
Resets the controller by clearing the session and initializing a new model.
Declaration
Swift
func reset()
-
Prepares the controller by initializing the model and the active face capture session.
Declaration
Swift
func prepare()
-
Processes the frame captured by the camera and updates the model accordingly. It handles the interaction with the SenseCrypt SDK and updates the UI based on the processing result.
Declaration
Swift
func frameCaptured(image: CMSampleBuffer)
Parameters
image
The frame captured by the camera
-
This function is used to get the current directional score
Declaration
Swift
func getCurrentDirectionalScore(processResult: ActiveFaceCaptureProcessingResult?) -> Float?
Parameters
processResult
The processing result from the session
Return Value
The current directional score
-
This function is used to get the color of the circle based on the active face capture state
Declaration
Swift
func getCircleColor(activeFaceCaptureState: ActiveFaceCaptureStateName?) -> UInt
Parameters
activeFaceCaptureState
The active face capture state
Return Value
The color of the circle
-
This function is used to get the angle of the arc based on the active face capture state
Declaration
Swift
func arcAngle(activeFaceCaptureState: ActiveFaceCaptureStateName?) -> Double
Parameters
activeFaceCaptureState
The active face capture state
Return Value
The angle of the arc
-
Returns the animation file based on the active face capture state
Declaration
Swift
func getCurrentAnimationFile(activeFaceCaptureState: ActiveFaceCaptureStateName?) -> String
Parameters
activeFaceCaptureState
The active face capture state
Return Value
The animation file
-
This function is used to get the current head pose of the user based on the process result
Declaration
Swift
func getCurrentHeadPose(processResult: ActiveFaceCaptureProcessingResult?) -> String?
Parameters
processResult
The processing result from the session
Return Value
The current head pose
-
Returns the current user action based the ActiveFaceCaptureState
Declaration
Swift
func getCurrentUserAction(activeFaceCaptureState: ActiveFaceCaptureStateName?) -> String
Parameters
activeFaceCaptureState
The active face capture state
Return Value
The current user action
-
Checks if the arc should be shown based on the user action
Declaration
Swift
func isArcShowingUserAction(expectedUserAction: ActiveFaceCaptureStateName?) -> Bool
Parameters
expectedUserAction
The expected user action
Return Value
A boolean value indicating whether the arc should be shown
-
This function is used to update the model based on the processing result
Declaration
Swift
func updateModel(processResult: ActiveFaceCaptureProcessingResult?)
Parameters
processResult
The processing result from the session