SmartSelfie Capture
Selfies can be captured two different ways - automatically or manually. The automatic way is to let the SDK capture the selfie when a user smiles. The manual way is to add a button to the ui, and when the button is clicked, force the SDK to use the selfie from the next captured frame. The Smart Selfie capture instructions below must be followed for both. To optionally implement the manual capture, follow the Manual capture instructions.
Smart Selfie capture instructions :
In the storyboard for the ViewController class that will capture the selfie, add a VideoPreviewView. VideoPreviewView is a custom view class that is defined in the Smile Identity SDK. It will be used to capture the selfie. To add the VideoPreviewView in the storyboard do the following steps:
�Add a
UIView
to aViewController Scene
.Select the UIView, and select VideoPreviewView as the Class. Set the Module
to Smile_Identity_SDK, and uncheck the Inherit Module From Target, as the image below shows.
Add the
VideoPreview
as an outlet and name itpreviewView
Next, add a
UILabel
. This label will display prompts to the user, such as “Smile”. Add the UILabel as an outlet and name itlblPrompt
.Make the
ViewController
be a delegate for the capture selfie callbacks
6. Declare a CaptureSelfie
var at the class level
7. To setup selfie capturing, override the viewWillAppear function and add the following lines.
Where lblPrompt
and previewView are the controls that were added the the storyboard.
userTag is the custom user tag. In this example, it is send the default user tag value that is defined in the SmileIDSingleton
.
Setting useFrontCamera
indicates whether the client has chosen to use the front or back camera.
Calling SelfieCaptureConfig.setMaxFrameTimeout()
controls how many camera frames containing a detectable face should occur before the selfie capture process times out. After the timeout, the selfie capture process completes. The default value is 120 frames. The minimum value is 8.
8. Override the viewDidAppear
function and add the following lines.
9. Overriding the viewWillDisappear
function and add the following lines. This will stop the camera capture.
10. Implement the CaptureSelfieDelegate callbacks
Last updated