Adding a video step
MobbScan offers you the possibility of establishing a video conference as an extra step in your verification process.
Extra project configuration
Before starting developing your video step, you need you configure some extra things in your project
Add TwilioVideo.xcframework
from libraries/third-party
folder of the SDK to your project.
Twilio framework is a dynamic framework, and then needs to be added also to the Embed Frameworks
section on the General tab of your project.
Note: As of its version 3.0.0, TwilioVideo does not support 32 bit architectures, such as i386 and armv7, so you must remove them from your project in the
Build Settings
tag. Its minimum version was also raised to iOS 11.0. Therefore, if you are going to use the unattended process, you must eliminate these architectures from your project and raise your minimum version to iOS 11.0.
Note: In older versions of the MobbScan SDK, previous to 2.18.4, the TwilioVideo framework includes simulator binaries (x86_64) that must be stripped out before uploading your app to App Store. In order to do this, take a look on this section
Developing your video integration
First, you need to configure the video component:
self.mobbScanVideoAPI = MobbScanVideoAPI.getInstance()
self.mobbScanVideoAPI.localVideoContainer.baseURL = "https://yourvideoinstance.yourcompany.com"
self.mobbScanVideoAPI.localVideoContainer = self.yourLocalViewContainer;
self.mobbScanVideoAPI.remoteVideoContainer = self.yourRemoteViewContainer;
// define a property to keep the reference to MobbScanVideoAPI
self.mobbScanVideoAPI = [MobbScanVideoAPI getInstance];
[self.mobbScanVideoAPI setBaseURL:@"https://yourvideoinstance.yourcompany.com"];
self.mobbScanVideoAPI.localVideoContainer = self.yourLocalViewContainer;
self.mobbScanVideoAPI.remoteVideoContainer = self.yourRemoteViewContainer;
Note:
localVideoContainer
andremoteVideoContainer
are instances of MobbScanVideoView. You can adjust how the video will be presented in your layout using thecontentMode
attribute of each of these views. Keep in mind that UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFill and UIViewContentModeScaleAspectFit are the only supported content modes.
Define your listener to be reported of changes during video step.
self.mobbScanVideoAPI.listener = { result, resultData, error in
// your code for the listener here...
}
[self.mobbScanVideoAPI setListener:^(MobbScanVideoResult result, MobbScanVideoResultData * _Nullable resultData, NSError * _Nullable error) {
// your code for the listener here...
}];
MobbScanVideoResult
has the following values:
value | description | comment |
---|---|---|
WAITING | Video step is still waiting for availability | MobbScanVideoResultData.waitTime gives you the estimated time for establishing the video |
ON_PROCESS | Video is stablished and being processed | |
FINISHED | Video step has already been done | MobbScanVideoResultData.finishedByClient tells you if the call was finished by client or by remote site |
ERROR | A problem happened during the video step | Error parameter gives you extra information of the problem |
Then, start the video conference using your scanId
:
self.mobbScanVideoAPI.start(withScanId:self.scanId!)
[self.mobbScanVideoAPI startWithScanId:self.scanId];
If you need to give the user the possibility of finishing the video process, you can use the stop
method.
self.mobbScanVideoAPI.stop()
[self.mobbScanVideoAPI stop];