Skip to content

Events

You can listen for the following events that the component emits

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

idliveDocCapture.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

idliveDocCapture.addEventListener('open', (event) => {
    const { video } = 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

idliveDocCapture.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

idliveDocCapture.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

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