[How to] Adapt the UX to the state of the VTO module?

The VTO module provides several callbacks which correspond to changes of state of the module. All the callbacks are listed in the API Reference > Callbacks.

In order to adapt the user experience you want to provide, find the appropriate callback and pass on the callback function you want to invoke (see related How-to guide).

Two main callbacks can be listened to adapt the user experience to the state of the VTO module: `onIssue` and `onLiveStatus`.

onIssue

The `onIssue` callback is triggered whenever an issue happens, impairing the user experience. Here is a list of tracked issues and their interpretation:

cameraAccessDenied VTO is denied access to the camera
detectionFailed User has not been detected in the last detection attempt
frameNotFound Requested frame is not available for VTO (see corresponding How-to guide to prevent this issue)
highLatency VTO has pending requests with abnormally long latency
licenseNotFound License is not valid
liveIncompatibleBrowser Browser is not compatible with a Live experience (see Compatibility)
liveIncompatibleOS OS is on a deprecated version and needs to be updated (see Compatibility)
noCameraFound VTO does not find cameras from `getUserMedia` API
poseInvalid User is detected but in an invalid position (not sufficiently centered and facing the camera)
protocoleFailed User detection failed after too many attemps, leading to a failure of the starting protocol
removalLowPerformances Performances of the device are too low to enable Frame Removal experience
serverNotResponding A server has not responded for one of the VTO's necessary request
trackingLost Tracking of the user has been temporarily lost

onLiveStatus

The `onLiveStatus` callback is triggered on various state changes of the Live experience:

faceTracking True while the face of the user is tracked in the camera stream
glassesReady True when the frame is ready to be displayed (which still requires that the user is properly detected and tracked to complete the VTO)
hasStream True while the camera stream is captured
removalActive True while the Frame Removal mask is applied
userHasGlasses True while a digital frame is virtually tried-on by the user