Record a video while user performs a scan
MobbScan offers you the possibility to record an unattended video of the user while performing the verification process.
Configuration
Before adding the unattended video to your application, you should modify the following:
configure an extra dependency in your
build.gradle
configuration file (dependencies section).dependencies { ... implementation 'com.twilio:video-android:7.5.1' ... }
Add required permission in the
AndroidManifest.xml
of your project:<!-- Required to record audio --> <uses-permission android:name="android.permission.RECORD_AUDIO" />
Adding the recording process
MobbScan provides you with a default activity that will open a new
MobbScanAPI.getInstance().startUnattendedVideo(scanId) { result, resultData, error ->
// Your finished listener code here
}
MobbScanAPI.getInstance().startUnattendedVideo(scanId, new VideoUnattendedFinishedListener() {
@Override
public void onFinished(VideoUnattendedResult result, MobbScanVideoDetectionResultData resultData, MobbScanAPIError error) {
// Your finished listener code here...
}
});
Configuring timeout
This process depends on the user to scan the document in order to finish recording the video. In order to keep the video between some time and size limits, the unattended video process has a timeout.
This timeout is by default set at 3 minutes.
If you want to change this value, you can use the following method call instead of the regular one:
MobbScanAPI.getInstance().startUnattendedVideo(scanId, YOUR_TIMEOUT_IN_SECONDS) { result, resultData, error ->
// Your finished listener code here
}
MobbScanAPI.getInstance().startUnattendedVideo(scanId, YOUR_TIMEOUT_IN_SECONDS, new VideoUnattendedFinishedListener() {
@Override
public void onFinished(VideoUnattendedResult result, MobbScanVideoDetectionResultData resultData, MobbScanAPIError error) {
// Your finished listener code here...
}
});
NOTE: The timeout should be between 1 and 5 minutes. Otherwise, the SDK will throw an
IllegalStateException
.
Customizing the recording UI
Customize default UI
You can customize the colors, sizes and font family of the default UI overriding the values of the following files:
colors.xml
:
<color name="unattended_spinner_color">#FF3D6B</color>
<color name="unattended_action_title_color">#FFFFFF</color>
<color name="unattended_countdown_color">#FFFFFF</color>
<color name="unattended_configure_background_color">#FFFFFF</color>
<color name="unattended_configure_title_color">#2C2B2B</color>
<color name="background_default_color">#95000000</color>
<color name="rectangle_default_color">#FFFFFF</color>
<color name="rectangle_detect_color">#3FC336</color>
<color name="text_color">#FFFFFF</color>
<color name="mrz_text_green">#ADFF2F</color>
<color name="face_overlay_color">#80FFFFFF</color>
<color name="face_outline_color">#FFFFFF</color>
<color name="face_progress_color">#55D672</color>
<color name="face_recording_color">#E0263B</color>
dimens.xml
:
<dimen name="unattended_action_text_size">18sp</dimen>
<dimen name="unattended_countdown_text_size">40sp</dimen>
<dimen name="unattended_configure_title_text_size">18sp</dimen>
<dimen name="rectangle_detector_border_size">4dp</dimen>
<dimen name="face_detector_border_size">10dp</dimen>
styles.xml
:
<style name="UnattendedVideoTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:fontFamily">sans-serif-light</item>
<item name="unattended_configure_service_bg">@color/unattended_configure_background_color</item>
<item name="unattended_configure_service_text_size">@dimen/unattended_configure_title_text_size</item>
<item name="unattended_configure_service_text_color">@color/unattended_configure_title_color</item>
<item name="unattended_detection_bg">@color/background_default_color</item>
<item name="unattended_detection_rectangle_base_color">@color/rectangle_default_color</item>
<item name="unattended_detection_rectangle_detected_color">@color/rectangle_detect_color</item>
<item name="unattended_detection_action_text_size">@dimen/unattended_action_text_size</item>
<item name="unattended_detection_action_text_color">@color/unattended_action_title_color</item>
<item name="unattended_detection_countdown_text_size">@dimen/unattended_countdown_text_size</item>
<item name="unattended_detection_countdown_text_color">@color/unattended_countdown_color</item>
</style>
Add a back arrow
In case you want to show a back arrow in the top left corner of the unattended video screen, MobbScan provides you with this option.
In order to activate it, you have to perform the next call to the MobbscanConfiguration
object you can pass to the initAPI method. If you do not know how to use this object, please refer to configure detection process for more information.
val mobbScanConfiguration = MobbScanConfiguration()
mobbScanConfiguration.activateUnattendedBackButton()
MobbScanAPI.getInstance().initAPI(YOUR_LICENSE, YOUR_CONTEXT, LICENSE_LISTENER, mobbScanConfiguration)
MobbScanConfiguration mobbScanConfiguration = new MobbScanConfiguration();
mobbScanConfiguration.activateUnattendedBackButton();
MobbScanAPI.getInstance().initAPI(YOUR_LICENSE, YOUR_CONTEXT, LICENSE_LISTENER, mobbScanConfiguration);
Making this method call will show an arrow in the default activity. When clicked, this button will make the exact same actions as the system's navbar back button. This action is not configurable at the moment.
Configure Back Button icon
If you want to change the icon of the newly added back button, you only have to create a drawable
resource in your app with the following name: unattended_back_button_image
.
This will override the default icon that the SDK shows and will place yours in its place.