Skip to main content
Version: 12 Dec 2024

Eye Tracking

APIs for the Eye Tracking system. More...

Classes

Name
structMLEyeTrackingStaticData
Static information about the eye tracking.
structMLEyeTrackingStateEx
Information about the state of the eye tracking system.

Types

Name
typedef struct MLEyeTrackingStaticDataMLEyeTrackingStaticData
Static information about the eye tracking.
typedef struct MLEyeTrackingStateExMLEyeTrackingStateEx
Information about the state of the eye tracking system.

Enums

Name
enumMLEyeTrackingError
{
MLEyeTrackingError_None,
MLEyeTrackingError_Generic,
MLEyeTrackingError_Ensure32Bits = 0x7FFFFFFF
}

Functions

Name
voidMLEyeTrackingStateInit(MLEyeTrackingStateEx * inout_state)
Initialize MLEyeTrackingStateEx with version.
MLResultMLEyeTrackingCreate(MLHandle * out_handle)
Creates an eye tracker.
MLResultMLEyeTrackingDestroy(MLHandle eye_tracker)
Destroys an eye tracker.
MLResultMLEyeTrackingGetStaticData(MLHandle eye_tracker, MLEyeTrackingStaticData * out_data)
Gets static information about the eye tracker.
MLResultMLEyeTrackingGetStateEx(MLHandle eye_tracker, MLEyeTrackingStateEx * out_state)
Gets information about the user's eyes.

Detailed Description

APIs for the Eye Tracking system.

Shared Object:

  • perception.magicleap*

Enums Documentation

MLEyeTrackingError

EnumeratorValueDescription
MLEyeTrackingError_NoneNo error, tracking is nominal.
MLEyeTrackingError_GenericEye Tracker failed.
MLEyeTrackingError_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

A set of possible error codes that the Eye Tracking system can report.


Types Documentation

MLEyeTrackingStaticData

typedef struct MLEyeTrackingStaticData MLEyeTrackingStaticData;

Static information about the eye tracking.

Populate with MLEyeTrackingGetStaticData().

More Info

API Level:

  • 20

MLEyeTrackingStateEx

typedef struct MLEyeTrackingStateEx MLEyeTrackingStateEx;

Information about the state of the eye tracking system.

This structure must be initialized by calling MLEyeTrackingStateInit() before use.

More Info

API Level:

  • 26

Functions Documentation

MLEyeTrackingStateInit

static inline void MLEyeTrackingStateInit(
MLEyeTrackingStateEx * inout_state
)

Initialize MLEyeTrackingStateEx with version.

Parameters

MLEyeTrackingStateEx *inout_stateSet up the version for inout_state and zero all other fields.

API Level:

  • 26

MLEyeTrackingCreate

MLResult MLEyeTrackingCreate(
MLHandle * out_handle
)

Creates an eye tracker.

Parameters

MLHandle *out_handleA pointer to an MLHandle which will contain the handle of the eye tracker. If this operation fails, out_handle will be ML_INVALID_HANDLE.

Returns

MLResultMLResult_InvalidParamFailed to create eye tracker due to an invalid input parameter.
MLResultMLResult_OkSuccessfully created eye tracker.
MLResultMLResult_UnspecifiedFaiureFailed to create eye tracker due to an unknown failure.
MLResultMLResult_PermissionDeniedThe application lacks permission.

Required Permissions:

  • com.magicleap.permission.EYE_TRACKING (protection level: dangerous)

MLEyeTrackingDestroy

MLResult MLEyeTrackingDestroy(
MLHandle eye_tracker
)

Destroys an eye tracker.

Parameters

MLHandleeye_trackerA handle to an Eye Tracker created by MLEyeTrackingCreate().

Returns

MLResultMLResult_OkSuccessfully destroyed eye tracker.
MLResultMLResult_UnspecifiedFaiureFailed to destroy eye tracker due to an unknown failure.

Required Permissions:

  • None

MLEyeTrackingGetStaticData

MLResult MLEyeTrackingGetStaticData(
MLHandle eye_tracker,
MLEyeTrackingStaticData * out_data
)

Gets static information about the eye tracker.

Parameters

MLHandleeye_trackerA handle to an Eye Tracker created by MLEyeTrackingCreate().
MLEyeTrackingStaticData *out_dataTarget to populate the data about the eye tracker.

Returns

MLResultMLResult_InvalidParamThe out_data parameter was not valid (null).
MLResultMLResult_OkEye tracking static data was successfully received.
MLResultMLResult_UnspecifiedFailureFailed to receive eye tracking static data.

Required Permissions:

  • None

API Level:

  • 20

MLEyeTrackingGetStateEx

MLResult MLEyeTrackingGetStateEx(
MLHandle eye_tracker,
MLEyeTrackingStateEx * out_state
)

Gets information about the user's eyes.

Parameters

MLHandleeye_trackerA handle to an Eye Tracker created by MLEyeTrackingCreate().
MLEyeTrackingStateEx *out_stateInformation about the eyes.

Returns

MLResultMLResult_InvalidParamFailed to receive eye tracking state due to an invalid input parameter.
MLResultMLResult_OkSuccessfully received eye tracking state.
MLResultMLResult_UnspecifiedFailureFailed to receive eye tracking state due to an unknown failure.

Required Permissions:

  • None

NOTE: To ensure a clean trace of any eye state, it is important to monitor the confidence value of that eye to reject frames where confidence is 0 (or employ another fallback strategy like propagating the last high confidence value).

API Level:

  • 9