Skip to content

Events

You can listen for the following events that the component emits

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

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

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

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

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

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

licenseInfo

Event that occurs after requesting license information using getLicenseInfo action

Returns an expiration date

idliveDocumentCapture.addEventListener('licenseInfo', (event) => {
    const { expirationDate } = event.detail[0];
});