Quite useful react snippet for automatic photo capture with check of correct face position (KYC document face liveness)
It uses FaceWASM - face detection implementation based on Haar-cascades. This method is performant and can be trained instead of programmed
Important
Made by using react-declarative to solve your problems. ⭐Star and 💻Fork It on github will be appreciated
npm install
npm startexport const verifyCompleteEmitter = Source.multicast(() =>
    Source
        .join([
            stateEmitter,
            Source.fromInterval(1_000),
        ])
        .reduce((acm, [{ state: isValid }]) => {
            if (isValid) {
                return acm + 1;
            }
            return 0;
        }, 0)
        .tap((ticker) => {
            if (ticker === 1) {
                recorder.beginRecord();
            }
        })
        .filter((ticker) => ticker === CC_SECONDS_TO_VERIFY)
        .tap(() => {
            recorder.endRecord();
        })
);