The Video Selfie module records a short video of the user performing a guided series of actions, including capturing their ID and selfie, to confirm physical presence and run liveness and face match checks. It can also capture voice consent.
For an overview of this module and how it works, see Video Selfie.
How you use this module depends on your integration pattern. In Patterns 1 and 2, you add the module to a FlowConfig in code as shown on this page. In Pattern 3, you define your modules and configuration in Dashboard as a Flow or Workflow and reference it by ID with startFlow() or startWorkflow() as shown on Run Flows Configured in Dashboard.
Video Selfie is not available in Capture-Only mode; adding it there throws ModuleNotAvailableException.
Screen recording requires API level 21 or later.
Add Video Selfie
Add a selfie step before Video Selfie: either an ID Scan that captures a selfie, or the Selfie Scan module. The face captured here is matched against that selfie, so omitting it causes the module to fail with
SelfieNotMatchedException.Add the module with one of the
addVideoSelfieoverloads:// Default configuration flowConfigBuilder.addVideoSelfie() // Custom configuration built with VideoSelfie.Builder flowConfigBuilder.addVideoSelfie(videoSelfie)// Default configuration flowConfigBuilder.addVideoSelfie(); // Custom configuration built with VideoSelfie.Builder flowConfigBuilder.addVideoSelfie(videoSelfie);
Example
The example below builds a VideoSelfie module with selfie matching and liveness enabled, adds it to the flow, and listens for the result through onVideoRecorded().
val videoSelfie = VideoSelfie.Builder()
.setSelfieMode(VideoSelfie.SelfieMode.SELFIE_MATCH)
.setLivenessEnabled(true)
.build()
val flowConfig = FlowConfig.Builder()
.addVideoSelfie(videoSelfie)
.build()
IncodeWelcome.getInstance().startOnboarding(
activityContext,
sessionConfig,
flowConfig,
object : OnboardingListener() {
override fun onVideoRecorded(videoSelfieResult: VideoSelfieResult) {
// Video recorded and uploaded
}
override fun onError(error: Throwable) {}
override fun onUserCancelled() {}
}
)
VideoSelfie videoSelfie = new VideoSelfie.Builder()
.setSelfieMode(VideoSelfie.SelfieMode.SELFIE_MATCH)
.setLivenessEnabled(true)
.build();
FlowConfig flowConfig = new FlowConfig.Builder()
.addVideoSelfie(videoSelfie)
.build();
IncodeWelcome.getInstance().startOnboarding(
activityContext,
sessionConfig,
flowConfig,
new IncodeWelcome.OnboardingListener() {
@Override
public void onVideoRecorded(@NonNull VideoSelfieResult videoSelfieResult) {
// Video recorded and uploaded
}
@Override
public void onError(@NonNull Throwable error) {}
@Override
public void onUserCancelled() {}
}
);
Configuration Options
Configure the module with VideoSelfie.Builder. The table below lists the most commonly used options.
| Setting | Description |
|---|---|
setSelfieMode(VideoSelfie.SelfieMode) |
Sets the comparison mode for the captured selfie. SELFIE_MATCH (default) matches the new selfie against a previously captured selfie; FACE_MATCH matches it against the previously captured ID. |
setLivenessEnabled(Boolean) |
Enables or disables the liveness check. |
setShowTutorials(Boolean) |
Shows or hides the tutorial screen before recording. |
setMaxVideoLength(Int) |
Sets the maximum recording length. |
setDisableAudio(Boolean) |
Records video without audio. |
setLogo(Int) |
Sets a drawable resource shown during recording. |
For the complete option set, see VideoSelfie.Builder in API Reference.
Result
Video Selfie delivers a VideoSelfieResult through the OnboardingListener callback onVideoRecorded(VideoSelfieResult). Key fields include:
videoFilePath: The URI pointing to the recorded video file;nullwhen unavailable.audioFilePath: The URI pointing to the recorded audio file;nullwhen unavailable.selfieImagePath: The URI pointing to the captured selfie image;nullwhen unavailable.idFrontImagePath: The URI pointing to the captured ID front image;nullwhen unavailable.idBackImagePath: The URI pointing to the captured ID back image;nullwhen unavailable.documentImagePath: The URI pointing to the captured document image;nullwhen unavailable.voiceConsentSelfiePath: The URI pointing to the voice-consent selfie image;nullwhen unavailable.Fields inherited from
BaseResult:resultCode: TheResultCodefor this result.error: WhenresultCodeisERROR, theThrowablethat caused it; otherwise,null.deviceStats: TheDeviceStatssnapshot of the device state when the result was produced.motionStatus: Device motion assessment during capture. One of the following:UNCLEAR: Motion could not be determined; the default.PASS: Device motion was within acceptable limits.FAIL: Excessive device motion was detected.
Errors surface through OnboardingListener.onError(Throwable). For this module, the throwable is a VideoSelfieException subtype: SelfieNotMatchedException, AudioNotMatchedException, or VideoUploadException.
For all fields, see VideoSelfieResult in API Reference.