Skip to main content

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.

PropertyTypeContents
videoDatastringComplete silent H.264 MP4.
padDatastring[]Sampled image frames; three by default.
imagestringRepresentative face image for recognition.
sessionMetadatastringAuthenticated metadata for the sampled frames. Empty unless sessionId is set.
sessionVideoMetadatastringAuthenticated 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:

  • sessionMetadata with the sampled frames in padData
  • sessionVideoMetadata with the unchanged videoData

Do not re-encode or modify the video before sending it, because the metadata authenticates the exact captured bytes.

Android predefined UI with V1

With MBCaptureConstraints.V1, launch() on Android returns empty metadata even when sessionId is set. Use V2 or V3, or the custom UI.