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.
Developing your video integration
First, you need to configure the video component:
// define a property to keep the reference to MobbScanVideoAPI
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 ofMobbScanVideoView
. You can adjust how the video will be presented in your layout using thecontentMode
attribute of each of these views. Keep in mind thatUIViewContentModeScaleToFill
,UIViewContentModeScaleAspectFill
andUIViewContentModeScaleAspectFit
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: scanId)
[self.mobbScanVideoAPI startWithScanId: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];