Comment on page
Checking Liveness and Face Biometry
To check liveness and face biometry, you need to upload media to our system and then analyze them.
Here’s an example of performing a check:
Kotlin
Java
analysisCancelable = AnalysisRequest.Builder()
// mediaToAnalyze is an array of OzAbstractMedia that were captured or otherwise created
.addAnalysis(Analysis(Analysis.Type.BIOMETRY, Analysis.Mode.SERVER_BASED, mediaToAnalyze))// or ON_DEVICE if you want the on-device analysis
.build()
//initiating the analyses and setting up a listener
.run(object : AnalysisRequest.AnalysisListener {
override fun onStatusChange(status: AnalysisRequest.AnalysisStatus) { handleStatus(status) // or your status handler
}
override fun onSuccess(result: RequestResult) {
handleResults(result) // or your result handler
}
override fun onError(error: OzException) { handleError(error) // or your error handler
}
})
analysisCancelable = new AnalysisRequest.Builder()
// mediaToAnalyze is an array of OzAbstractMedia that were captured or otherwise created
.addAnalysis(new Analysis(Analysis.Type.QUALITY, Analysis.Mode.SERVER_BASED, mediaToAnalyze)) // or ON_DEVICE if you want the on-device analysis
.build()
//initiating the analyses and setting up a listener
.run(new AnalysisRequest.AnalysisListener() {
@Override
public void onSuccess(@NonNull RequestResult list) { handleResults(list); } // or your result handler
@Override
public void onError(@NonNull OzException e) { handleError(e); } // or your error handler
@Override
public void onStatusChange(@NonNull AnalysisRequest.AnalysisStatus analysisStatus) { handleStatus(analysisStatus); } // or your status handler
})
To delete media files after the checks are finished, use the
clearActionVideos
method.To add metadata to a folder, use the
addFolderMeta
method.Kotlin
Java
.addFolderMeta(
mapOf(
"key1" to "value1",
"key2" to "value2"
)
)
.addFolderMeta(Collections.singletonMap("key", "value"))
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.mapOf("extract_best_shot" to true)
To use a media file that is captured with another SDK (not Oz Android SDK), specify the path to it in OzAbstractMedia:
val file = File(context.filesDir, "media.mp4") // use context.getExternalFilesDir(null) instead of context.filesDir for external app storage
val media = OzAbsractMedia.OzVideo(OzMediaTag.VideoSelfieSmile, file.absolutePath)
If you want to add your media to the existing folder, use the
setFolderId
method: .setFolderId(folderId)
Last modified 3mo ago