Checking Liveness and Face Biometry

If you use our SDK just for capturing videos, omit this step.

To check liveness and face biometry, you need to upload media to our system and then analyze them.

To interpret the results of analyses, please refer to Types of Analyses.

Below, you'll see the example of performing a check and its description.

let analysisRequest = AnalysisRequestBuilder()
// create one or more analyses
let analysis = Analysis.init(
	media: mediaToAnalyze, // mediaToAnalyze is an array of OzMedia that were captured or otherwise created
	type: .quality, // check the analysis types in iOS methods
	mode: .serverBased) // or .onDevice if you want the on-device analysis
analysisRequest.uploadMedia(mediaToAnalyze)
analysisRequest.addAnalysis(analysis)
// initiate the analyses
analysisRequest.run(
	statusHandler: { state in }, // scenario steps progress handler
	errorHandler: { _ in }  
) { result in
    // receive and handle analyses results here 
}

To delete media files after the checks are finished, use the cleanTempDirectory method.

Adding Metadata

To add metadata to a folder, use AnalysisRequest.addFolderMeta.

let analysis = Analysis.init(media: mediaToAnalyze, type: .quality, mode: .serverBased)
var folderMeta: [String: Any] = ["key1": "value1"]
analysisRequest.addFolderMeta(folderMeta)
...

Extracting the Best Shot

In the params field of the Analysis structure, you can pass any additional parameters (key + value), for instance, to extract the best shot on the server side.

let analysis = Analysis.init(media: mediaToAnalyze, type: .quality, mode: .serverBased, params: [“extract_best_shot” : true])

Using Media from Another SDK

To use a media file that is captured with another SDK (not Oz iOS SDK), specify the path to it in the OzMedia structure (the bestShotURL property):

let referenceMedia = OZMedia.init(movement: .selfie,
                  mediaType: .movement,
                  metaData: ["meta":"data"],
                  videoURL: nil,
                  bestShotURL: imageUrl,
                  preferredMediaURL: nil,
                  timestamp: Date())

Adding Media to a Certain Folder

If you want to add your media to the existing folder, use the addFolderId method:

let analysis = Analysis.init(media: mediaToAnalyze, type: .quality, mode: .serverBased)
analysisRequest.addFolderId(IdRequired)

Last updated