Capture results
Every successful session returns one continuous video and a set of frames sampled from the same capture interval. The predefined UI delivers the result with EVENT_SUCCESS; the custom UI calls onFaceCaptureSuccess. Both receive the same MBCaptureSessionResult.
Result properties
All media is Base64 encoded.
| Property | Type | Contents |
|---|---|---|
videoData | string | Complete silent H.264 MP4. |
padData | string[] | Sampled image frames; three by default. |
image | string | Representative face image for recognition. |
sessionMetadata | string | Authenticated metadata for the sampled frames. Empty unless sessionId is set. |
sessionVideoMetadata | string | Authenticated metadata for the exact video bytes. Empty unless sessionId is set. |
The front-camera preview is mirrored for the user. Captured images and video are stored unmirrored.
Read the result
function onCaptureSuccess(result: MBCaptureSessionResult) {
const video = result.videoData;
const sampledFrames = result.padData;
const recognitionImage = result.image;
}
Base64 media is large. Send it to your backend directly instead of storing it in application state or logs.
Use authenticated session metadata
Pass a sessionId to generate session metadata, using the value agreed with your Mobai backend:
// Predefined UI
launch({ ...options, sessionId });
// Custom UI
const options = setCaptureSessionOptions({ ...captureOptions, sessionId });
After capture, send each metadata value with the media it authenticates:
sessionMetadatawith the sampled frames inpadDatasessionVideoMetadatawith the unchangedvideoData
Do not re-encode or modify the video before sending it, because the metadata authenticates the exact captured bytes.
With MBCaptureConstraints.V1, launch() on Android returns empty metadata even when sessionId is set. Use V2 or V3, or the custom UI.