npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ugx-face-liveness

v0.0.5

Published

Angular library for blink/smile liveness checks with snapshot/video capture.

Readme

UGX Face Liveness

Angular library for blink/smile liveness checks with snapshot/video capture.

Install

  • Angular 16+ with Ivy; peer deps: @angular/core and @angular/common.
  • Add the package:
    npm i ugx-face-liveness

Asset setup (required)

The library loads models from /assets/face-liveness/models. Add the assets block to your app (and test) builds in angular.json: Also, load the face-api js file from https://cdn.jsdelivr.net/npm/[email protected]/dist/face-api.min.js ideally in your index.html file Models are gotten from https://github.com/justadudewhohacks/face-api.js-models

{
  "glob": "**/*",
  "input": "projects/face-liveness/src/lib/assets",
  "output": "assets/face-liveness"
}

Basic usage (standalone)

import { Component } from "@angular/core";
import { FaceLivenessComponent } from "ugx-face-liveness";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [FaceLivenessComponent],
  template: `<fl-face-liveness (livenessCompleted)="onDone($event)"></fl-face-liveness>`,
})
export class AppComponent {
  onDone(result: { snapshot: Blob; video: Blob | null }) {
    // handle result
  }
}

Basic usage (NgModule)

import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FaceLivenessModule } from "ugx-face-liveness";
import { AppComponent } from "./app.component";

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, FaceLivenessModule],
  bootstrap: [AppComponent],
})
export class AppModule {}

Then drop <fl-face-liveness></fl-face-liveness> in your templates.

Inputs

  • showDebug: boolean – overlay debug info; defaults to false.
  • faceDetectionOptions?: { detectionInterval?: number; scoreThreshold?: number; minConfidence?: number; maxFaceAngle?: number; singleAction?: 'blink' | 'smile'; singleActionMode?: boolean; } – tune detection cadence/thresholds and optionally force a single action flow. Prefer singleAction; singleActionMode is the deprecated equivalent of singleAction: 'smile'.

Single-action flow

Skip the full look-straight → blink → smile sequence and require only one action:

<fl-face-liveness
  [faceDetectionOptions]="{ singleAction: 'blink' }"
  (livenessCompleted)="onDone($event)"
></fl-face-liveness>

Valid actions: 'blink' or 'smile'. Legacy singleActionMode: true maps to singleAction: 'smile'.

Outputs

  • (faceDetectionStatusChange)="onFaceStatusChange(isValid: boolean)" – alignment/validation status.
  • (errorOccurred)="onError(message: string)" – user-facing error messages.
  • (livenessCompleted)="onDone({ snapshot: Blob, video: Blob | null })" – final media payload.

Snapshot/Video handling

Snapshot is image/jpeg; video (when available) is video/webm (vp8/vp9). Convert to base64 if needed:

const toBase64 = async (blob: Blob) => `data:${blob.type};base64,${btoa(String.fromCharCode(...new Uint8Array(await blob.arrayBuffer())))}`;

Common gotchas

  • Camera permission + HTTPS/localhost required.
  • Ensure assets are copied (see Asset setup); missing models will block detection.
  • Blink/smile stages depend on lighting and frame rate; defaults use detectionInterval 120ms and blink EAR threshold 0.25.
  • If video blob is null, check MediaRecorder support and MIME type (falls back to vp8).

Local development

  • Build library: npm run build:lib (alias for ng build face-liveness).
  • Serve demo app: npm start.
  • Path alias is configured: "ugx-face-liveness": ["projects/face-liveness/src/public-api.ts", "dist/ugx-face-liveness"].

Publishing

After building, publish from the dist folder:

cd dist/face-liveness
npm publish

Contributions

If you will love to contribute, follow the git link and raise a pr