Capture Modes
When initializing a capture session, you can choose between two capture modes: Manual Capture and Auto Capture. This is configured via SelfieCaptureOptions
, which is defaulted to Auto Capture using the front camera and with a 10 second timeout.
Manual Capture
Manual Capture mode requires user interaction for the selfie to be captured. When this mode is configured, text will be displayed on screen prompting the user to tap to capture when ready.
let options = SelfieCaptureOptions(enableAutoCapture: false)
Auto Capture
With this mode enabled, the SDK continuously processes camera frames through an image-processing pipeline, checking things such as motion, blur, glare, etc. Once a frame passes these checks, then the image is captured automatically.
// Timeout is in seconds
let options = SelfieCaptureOptions(enableAutoCapture: true, autoCaptureTimeout: 10.0)
Once the timeout is reached, then the user is presented with an alert that allows them to select their capture mode and reattempt.
Camera Selection
Selfie capture uses the front facing camera by default but also supports back camera capture. This is especially useful in scenarios such as a retail environment where an employee is handling the device and can take on the role of capturing the customers photo.
// Timeout is in seconds
let options = SelfieCaptureOptions(enableAutoCapture: true, autoCaptureTimeout: 10.0, useFrontCamera: false)