Payload size¶
The capture library supports two payload size options: Normal and Small. Normal is used by default.
Use Small when payload transfer size matters more than preserving the full normal payload content. The exact binary structure of the payload is an SDK implementation detail, but the small payload is intended to reduce the generated payload size.
Set the payload size¶
You can set the payload size when creating DocumentIadOptions and pass those options to DocumentIadCameraController.
val iadOptions = DocumentIadOptions.createIadOptions(
DocumentIadOptions.PayloadSize.Small
)
val cameraController = DocumentIadCameraController(
documentDetector = documentDetector,
previewView = findViewById(R.id.previewView),
lifecycleOwner = this,
iadOptions = iadOptions
)
Change payload size between captures¶
Use PayloadOptions with DocumentIadCameraController.setPayloadOptions() when the payload size must change for an existing controller.
val payloadOptions = PayloadOptions.createPayloadOptions(
DocumentIadOptions.PayloadSize.Small
)
cameraController.setPayloadOptions(payloadOptions)
cameraController.takePhoto()
Payload options set through setPayloadOptions() are used for the current and following captures. To use a different payload size for another capture, call setPayloadOptions() again before takePhoto().
If setPayloadOptions() is called while a payload is already being formed, the new options are applied only to the next payload.