Skip to content

Video stream settings#

In LUNA ID, you can configure the following parameters for video stream recording:

Setting Platform
Video stream quality
Timeout before starting recording
Video stream duration
Custom frame resolution
Autofocus

Video stream quality#

Applies to LUNA ID for Android only.

To configure the video stream quality, pass the videoQuality parameter to the LunaID.ShowCameraParams() method. The parameter has the following values:

  • VideoQuality.LOW - Default. Provides a lower resolution and smaller file size suitable for most use cases.
  • VideoQuality.HIGH - Increases the resolution, frame rate, and bitrate, resulting in better video quality but larger file sizes and potentially higher processing requirements.

Video stream quality is determined by the following parameters:

Parameter SD (Low quality) SD (High quality) HD 720p HD 1080p
Video resolution 320×240 px 720×480 px 1280×720 px 1920×1080 px
Video frame rate 20 fps 30 fps 30 fps 30 fps
Video bitrate 384 Kbps 2 Mbps 4 Mbps 20 Mbps

Timeout before starting recording#

Applies to LUNA ID for iOS only.

To configure a delay before starting video recording, use the LCLunaConfiguration.startDelay parameter. This parameter allows you to specify the duration (in seconds) to wait before initiating the recording process.

By default, the parameter value is set to 0.

Video stream duration#

In LUNA ID for Android#

To limit a video stream's duration, use the recordingTimeMillis parameter within the LunaID.ShowCameraParams configuration. This parameter defines the video stream duration in milliseconds. By default, this value is not set , meaning you must explicitly configure it when enabling video recording.

LunaID.showCamera(
    activity,
    LunaID.ShowCameraParams(
        recordVideo = true,
        recordingTimeMillis = 10000 // Sets the video recording duration to 10 seconds
    )
)

Important: The recordingTimeMillis parameter is mandatory if recordVideo is set to true. Failing to provide a valid positive value will result in the following exception:

IllegalStateException, when param recordVideo is true -> param recordingTimeMillis must be positive

In LUNA ID for iOS#

To limit the duration of a video stream:

  1. Enable face identity tracking
    Set the LCLunaConfiguration.trackFaceIdentity property to true to enable face identity tracking during the video stream.
  2. Set video stream length
    Use the LCLunaConfiguration::videoRecordLength parameter to specify the maximum duration of the video stream in seconds.
  3. Initialize the watchdog object
    Call LMCameraCaptureManager::createVideoRecordWatchDog(LunaCore::LCBestShotDetectorProtocol) in your ViewController.
    This initializes a watchdog object that monitors the primary face search and starts the video recording process. Once the time specified in videoRecordLength elapses, the recording automatically stops.
    The watchdog object lives inside the capture manager and is not available for public usage.

Custom frame resolution#

Applies to LUNA ID for Android only.

To specify precise resolution requirements for your application, use the customFrameResolution parameter of the ShowCameraParams class. The parameter consists of two fields:

  • resolution - Specifies the desired width (width) and height (height) of the camera frame.
  • strictModeEnabled- Specifies how LUNA ID handles the selection of a custom camera frame resolution. The parameter has the following values:
    • true - LUNA ID attempts to find an exact match for the specified resolution among the available resolutions on the device. If no exact match is found, an exception is thrown.
    • false - Default. LUNA ID searches for the closest available resolution that does not exceed the specified dimensions, that is, it selects the nearest lower resolution.

Autofocus#

Applies to LUNA ID for Android only.

To control whether the camera's autofocus feature will be enabled or disabled upon startup, use the disableAutoFocus parameter of the ShowCameraParams class. The parameter has the following values:

  • true - Disables the camera's autofocus functionality, allowing for a fixed focus setting regardless of device capabilities.
  • false - Default. Enabled the camera’s autofocus feature if the device supports it. This aligns with the default behavior of CameraX, which enables autofocus when supported by the hardware.