Skip to main content
Version: 20 Jan 2025

MLCamera Overview

The Magic Leap 2 MLCamera API allows developers to capture real and virtual content inside their applications.

Logical Cameras

Magic Leap 2 allows developers to access two logical cameras from the same physical camera. The camera streams are accessed as devices in the Unity API and have the following identifiers: Main Camera and CV Camera.

You can use the same stream to capture different types of content. For example, you can capture video, images, and a preview from the Main Camera stream while also using the CV Camera at the same time.

Learn More About the ML Camera API

See the ML Camera Feature Overview for more information about supported configurations, resolutions, and outputs.

caution

This features requires the CAMERA permission to be requested at runtime and enabled in your project's Manifest Settings (Edit > Project Settings > Magic Leap > Manifest Settings).

Capture Output

FormatCameraModeCapture Type
YUVMainRealPreview/Video/Image
YUVCVRealVideo/Image
RGBAMainMR/VirtualVideo/Image
RGBACVRealVideo
JPEGMainReal/MR/VirtualImage
  • MLCameraCaptureType_Image - Capture an Image
  • MLCameraCaptureType_Video - Capture Video
  • MLCameraCaptureType_Preview - Capture a video and and access the raw buffer of the frames

Guides