Adding a video step
MobbScan offers you the possibility of establishing a video conference as an extra step in your verification process.
Configuration
Before starting developing your video step, you need to add the following dependencies in your build.gradle file (dependencies section).
android {
...
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
...
}
dependencies {
...
implementation 'com.twilio:video-android:7.6.1'
...
}
Video step preparation
First, you need to configure the video component:
MobbScanVideoAPI mobbScanVideoAPI = MobbScanVideoAPI.getInstance();
mobbScanVideoAPI.setBaseURL("https://yourvideoinstance.yourcompany.com");
mobbScanVideoAPI.setLocalVideoContainer(this.localVideoViewContainer);
mobbScanVideoAPI.setRemoteVideoContainer(this.remoteVideoViewContainer);
Note:
localVideoContainerandremoteVideoContainerare instances of MobbScanVideoView. You can adjust how the video will be presented in your layout usingaspecModeattribute of each of these view (both in XML or programmatically).
If your layout will present both videos somehow overlapped, you need to specify which one should be on top of the other using setTopVideoView of MobbScanVideoView.
Define your listener to be reported of the changes during the video step.
mobbScanVideoAPI.setListener() { resut, resultData, error -> {
// Your code for the listener here...
}}
mobbScanVideoAPI.setListener(new MobbScanVideoListener() {
@Override
public void onVideoEvent(MobbScanVideoResult result, MobbScanVideoResultData resultData, MobbScanAPIError error) {
// your code for the listener here...
}
});
The listener call has 3 objects, that represent the following:
MobbScanVideoResult result: represents the state of the process. Can return one of the following values:value description comment WAITINGVideo step is still waiting for availability When this is the state of the video, you can use the MobbScanVideoResultData.waitTimeON_PROCESSVideo is stablished and being processed FINISHEDVideo step has already been done When this is the state of the video, you can use the MobbScanVideoResultData.finishedByClientERRORA problem occurs during the video step Error parameter gives you extra information of the problem MobbScanVideoResultData resultData: object that contains a boolean indicating if the call was finished by a the client or by the remote site and an estimation of the time needed to establish the video. Available when the result param is set toWAITINGorFINISHED.MobbScanAPIError error: object that specifies the error ocurred during the process. Contains the error code and extra information about the error.
Start the video conference
Note: To start the video conference process you should have done the
startScanmethod to get thescan idpreviously. If you don't know how to to this, please visit the getting started guide.
Having the scanId, you only need to do the following:
mobbScanVideoAPI.start("YOUR_SCAN_ID");
Allow the user to stop the video
If you need to give the user the posibility to finish the video process, you can use the stop method.
mobbScanVideoAPI.stop();
