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

@face-auth/face-id-video

v0.0.3

Published

Utility library for capturing photos from webcam video streams in the browser. Handles camera selection, image formatting, and output for face authentication APIs.

Downloads

519

Readme

@face-auth/face-id-video

Browser-only webcam utilities for starting video streams and capturing still images. Current package version: 0.0.3.

Installation

npm install @face-auth/face-id-video

License

Proprietary runtime-only license. You may execute unmodified copies of the package, but modification, redistribution, sublicensing, and other reuse are not permitted. See LICENSE.

Public API

Import from the package root only. Deep imports into dist/ or dist/src/ are not part of the public contract.

Class

  • FaceVideo

Exported types

  • CameraError
  • CameraOptions
  • CaptureOptions
  • CaptureResult
  • FaceVideoElement
  • OvalDimensions

FaceVideo

Creates a camera/capture manager over an HTMLVideoElement.

import { FaceVideo } from "@face-auth/face-id-video";

const videoElement = document.getElementById("videoRef") as HTMLVideoElement;
const faceVideo = new FaceVideo(videoElement);

Methods

  • getDevices(): Promise<MediaDeviceInfo[]>
  • start(options?: CameraOptions, deviceId?: string): Promise<void>
  • capture(options: CaptureOptions): Promise<CaptureResult>
  • stop(): void
  • onCameraStarted(callback): void
  • offCameraStarted(callback): void

Camera selection

You can ask the browser for available video inputs:

const devices = await faceVideo.getDevices();

devices.forEach((device) => {
  console.log(device.deviceId, device.label);
});

To start the stream, either provide preferredFacingMode or pass a specific deviceId as the second argument.

await faceVideo.start({
  preferredFacingMode: "user",
  idealResolution: { width: 1280, height: 720 }
});
const devices = await faceVideo.getDevices();
const selectedDeviceId = devices[0]?.deviceId;

await faceVideo.start(
  {
    preferredFacingMode: "environment",
    idealResolution: { width: 1280, height: 720 }
  },
  selectedDeviceId
);

Capture output

capture() returns a CaptureResult with a blob and the resolved imageType.

const result = await faceVideo.capture({
  imageType: "image/jpeg"
});

console.log(result.blob);
console.log(result.imageType);

If imageType is omitted, the package uses image/png by default.

Camera started event

const handleCameraStarted = () => {
  console.log("Camera is ready");
};

faceVideo.onCameraStarted(handleCameraStarted);

await faceVideo.start({
  preferredFacingMode: "user"
});

faceVideo.offCameraStarted(handleCameraStarted);

Runtime contracts

CameraOptions

interface CameraOptions {
  preferredFacingMode?: "user" | "environment";
  idealResolution?: { width: number; height: number };
}

CaptureOptions

interface CaptureOptions {
  imageType?: string;
}

CaptureResult

interface CaptureResult {
  blob: Blob;
  imageType: string;
}

Camera errors

When start() fails, the thrown error may include one of these code values:

  • PERMISSION_DENIED
  • NO_DEVICES
  • OVERCONSTRAINED
  • UNKNOWN

Notes

  • capture() must be called after start().
  • The package currently returns captured images as Blob. It does not return Base64 directly.
  • The target environment is the browser.