Skip to content

Events

You can listen for the following events that the component emits

const idliveFaceCapture = document.querySelector('idlive-face-capture');

idliveFaceCapture.addEventListener('initialize', () => {});

initialize

The component is initialized and ready to open camera

beforeOpen

The camera starts to open

open

The camera is open and element is ready to show video

Returns an HTMLVideoElement

idliveFaceCapture.addEventListener('open', (event) => {
    const { video } = event.detail[0];
});

faceDetection

A face detection result

Returns an array with the strings described in the "Detection Errors" section if a face detection error occurred, or an empty array if the face was detected correctly

idliveFaceCapture.addEventListener('faceDetection', (event) => {
    const { errors } = event.detail[0];
});

detection

A detection result

Returns an array with the strings described in the "Detection Errors" section if a detection error occurred, or an empty array if there are no detection errors

idliveFaceCapture.addEventListener('detection', (event) => {
    const { errors } = event.detail[0];
});

beforeCapture

The capture process started

capture

The capture process completed

Returns a photo and an encrypted file for verification

idliveFaceCapture.addEventListener('capture', (event) => {
    const { photo, encryptedFile } = event.detail[0];
});

close

The camera was closed

error

A critical error occurred

Returns a string with the text of the error

idliveFaceCapture.addEventListener('error', (event) => {
    const { message } = event.detail[0];
});