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.5.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:
localVideoContainer
andremoteVideoContainer
are instances of MobbScanVideoView. You can adjust how the video will be presented in your layout usingaspecMode
attribute 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 WAITING
Video step is still waiting for availability When this is the state of the video, you can use the MobbScanVideoResultData.waitTime
ON_PROCESS
Video is stablished and being processed FINISHED
Video step has already been done When this is the state of the video, you can use the MobbScanVideoResultData.finishedByClient
ERROR
A 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 toWAITING
orFINISHED
.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
startScan
method to get thescan id
previously. 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();