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

@meeeetup/camera-web

v0.9.0

Published

Web SDK for meeeetup-cam — MediaPipe BlazeFace + React hooks

Readme

@meeeetup/camera-web

Browser face-capture SDK. Detects faces with MediaPipe BlazeFace, tracks each one, picks the best-quality frame per person, and hands you the images through a callback. No network, no credentials, no vendor lock-in — the SDK runs entirely on the device and the transport is yours.

  • Headless-first. The data surface (CameraProvider, useCamera) is the package default. Pre-built UI (viewport, overlay, face grid) is a separate entry under /ui — import it only if you want the stock visuals.
  • BYOT (bring your own transport). The SDK calls onBatchCapture (passive) or onCapture (single, interactive) with base64 JPEG data URLs. Sending them is your code — any backend, any auth scheme, any retry strategy.
  • Pre-GA. Breaking API changes land without deprecation shims; version bumps document them in CHANGELOG.md.

Requires React 18 or 19. ESM-only. Served over HTTPS or localhost — getUserMedia is a secure-context API.


Install

npm i @meeeetup/camera-web react react-dom

Optional (only if you use the stock components):

import "@meeeetup/camera-web/styles.css";

@meeeetup/camera-core arrives as a transitive dependency — add it explicitly only if you import from it directly (SelectedFace, LiveFacePreview, PersonResult, TrackSnapshot are already re-exported here).


The two entry points

// Headless API — Provider, hook, types. ~zero visual bytes.
import { CameraProvider, useCamera } from "@meeeetup/camera-web";

// Pre-built components — only if you want our visuals. Opt-in bundle cost.
import { CameraViewport, FaceGrid, FaceCounter } from "@meeeetup/camera-web/ui";

Everything renders inside a single <CameraProvider>. Children — stock components or your own — read live state through useCamera().


Three capture modes

| Mode | Trigger | Output | When to use | |---|---|---|---| | passive | Continuous — SDK picks best shots as faces appear | Batched onBatchCapture(faces[]) | Walk-by cameras, kiosks that watch a space | | single | Automatic — one best-shot per trigger() call | One onCapture(crop, _, meta) | Checkout-style self-serve ID | | interactive | Manual — user presses the capture button | One onCapture(crop, fullCircleImage) | Guided enrollment flow |

Passive — continuous, batched

import { CameraProvider, useCamera, type SelectedFace } from "@meeeetup/camera-web";
import { CameraViewport, FaceCounter, FaceGrid } from "@meeeetup/camera-web/ui";

export function PassiveCamera({ captureKey }: { captureKey: string }) {
  const handleBatch = async (faces: SelectedFace[]) => {
    const res = await fetch("https://api.example.com/capture", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${captureKey}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        images: faces.map((f) => ({
          image: f.dataUrl,
          capturedAt: new Date(f.createdAt).toISOString(),
        })),
      }),
    });
    // Throw to report failure. The SDK re-queues on throw; a 4xx would
    // livelock a retry, so swallow those at the sink.
    if (!res.ok && res.status >= 500) throw new Error(`send failed: ${res.status}`);
  };

  return (
    <CameraProvider mode="passive" onBatchCapture={handleBatch}>
      <CameraViewport />
      <FaceCounter />
      <FaceGrid />
    </CameraProvider>
  );
}

Faces flush every 10 s or when the buffer reaches the key's maxFacesPerRequest cap. A face is handed over once per selection event — if a better frame arrives later the SDK commits again. On the default settle path every selection is final: true; set captureWindowMs and tracks publish with final: false intermediate updates until the window expires.

Interactive — user-triggered

import { CameraProvider } from "@meeeetup/camera-web";
import { CameraViewport, AlignmentRing, CaptureButton } from "@meeeetup/camera-web/ui";

export function KioskCamera() {
  return (
    <CameraProvider
      mode="interactive"
      onCapture={async (faceImage, fullCircleImage) => {
        await upload(faceImage, fullCircleImage);
      }}
    >
      <CameraViewport />
      <AlignmentRing />
      <CaptureButton />
    </CameraProvider>
  );
}

Single — automatic one-shot

import { CameraProvider } from "@meeeetup/camera-web";
import { CameraViewport } from "@meeeetup/camera-web/ui";

export function EnrollCamera() {
  return (
    <CameraProvider
      mode="single"
      onCapture={async (faceImage, _fullCircleImage, meta) => {
        console.log("frontalness", meta.frontalness, "face size", meta.faceSize);
        await upload(faceImage);
      }}
    >
      <CameraViewport />
    </CameraProvider>
  );
}

Custom UI (useCamera)

useCamera() is the data surface. Narrow on cam.mode first; the hook throws if used outside a provider.

import { useCamera } from "@meeeetup/camera-web";

function Status() {
  const cam = useCamera();
  if (cam.mode !== "passive") return null;
  return (
    <p>
      {cam.trackedCount} in frame — {cam.capturedFaces.length} captured
    </p>
  );
}

Shared across modes

ready, error, videoRef, devices, currentDeviceId, setDeviceId, currentFacingMode, toggleCamera.

Passive mode (cam.mode === "passive")

| Field | Shape | What it is | |---|---|---| | activeTracks | TrackSnapshot[] | Per-frame snapshot of every live track — cx/cy/width/height in normalised 0–1 coords, plus smoothedFrontalness / selectedFrontalness / lastSeenAt / lastSentAt. Drive custom overlays off this | | liveFaces | LiveFacePreview[] | Tracks currently in frame that have NOT yet been committed — your "watching" row | | capturedFaces | SelectedFace[] | Everything committed this session, newest first — your "captured" row | | livePreviews | LiveFacePreview[] | Raw: all tracked faces that have a best crop yet | | selectedFaces | SelectedFace[] | Raw: SDK's committed buffer, order defined by the pipeline | | trackedCount / totalCount | number | Faces in frame now / unique faces seen this session | | flushBatch | () => Promise<void> | Drive the batch flush yourself instead of waiting 10 s | | rearm | () => void | Re-open every track's capture window (no-op without captureWindowMs) | | overlayRef | RefObject<HTMLCanvasElement> | Where the stock green-box overlay draws — attach to your own <canvas> to let the SDK render into it |

Interactive mode (cam.mode === "interactive")

| Field | Shape | What it is | |---|---|---| | videoStream | MediaStream \| null | Raw camera stream — attach to secondary <video> elements for picture-in-picture | | isLoading / isCapturing / isSwitchingCamera / isFlipped / isFaceAligned | boolean | Pipeline state | | captureProgress / alignmentCountdown | number | 0–1 progress for the alignment ring and auto-capture countdown | | faceBoundingBox | { originX, originY, width, height } \| null | Current face box in video coords | | captureImage() / toggleFlip() | () => void | Trigger capture / mirror the preview | | canvasRef | RefObject<HTMLCanvasElement> | Full-circle framing canvas |

Single mode (cam.mode === "single")

| Field | Shape | What it is | |---|---|---| | state | SingleCaptureState | idle / tracking / capturing / locked | | bbox | SingleCaptureBox \| null | Current face box | | isAligned / locked | boolean | Alignment / lock state | | captureProgress / faceSize / frontalness / score | number | Per-frame readings | | result | SingleCaptureResult \| null | Published best-shot + meta | | trigger() / rearm() | () => void | Open a fresh capture window / restart search |


Declarative overlays (CameraViewport children)

<CameraViewport> passes any children through to a pointer-events: none layer on top of the camera. Anything that reads useCamera() can position itself over the video — Mapbox-style composition.

<CameraProvider mode="passive" overlayEnabled={false} onBatchCapture={handleBatch}>
  <CameraViewport>
    <TrackBoxes />        {/* reads activeTracks, draws DOM boxes */}
    <ThresholdLine />
    <DebugHud />
  </CameraViewport>
</CameraProvider>

function TrackBoxes() {
  const cam = useCamera();
  if (cam.mode !== "passive") return null;
  return (
    <>
      {cam.activeTracks.map((t) => (
        <div
          key={t.trackId}
          style={{
            position: "absolute",
            left: `${(t.cx - t.width / 2) * 100}%`,
            top: `${(t.cy - t.height / 2) * 100}%`,
            width: `${t.width * 100}%`,
            height: `${t.height * 100}%`,
            border: `2px solid ${t.smoothedFrontalness > 50 ? "lime" : "red"}`,
          }}
        />
      ))}
    </>
  );
}

overlayEnabled={false} turns off the SDK's green-box canvas so your DOM boxes are the only overlay. Omit it (or set true) to layer custom children on top of the stock overlay.


Pre-built components (@meeeetup/camera-web/ui)

| Component | Mode | Renders | |---|---|---| | CameraViewport | both | <video> + overlay canvas (passive) / circular viewport (interactive) | | FaceCounter | passive | Tracked + total badge | | FaceGrid | passive | Grid of selected face crops (live / committed / ready) | | DevicePicker | both | Camera dropdown | | CameraToggle | both | Front/back switch | | AlignmentRing | interactive | Alignment ring, progress, countdown | | CaptureButton | interactive | Manual capture trigger |

Every component accepts className. The skin is CSS custom properties (--mfc-*) with dark defaults — re-theme by setting them on any ancestor.


Provider props

Every mode: children, mediapipeWasmUrl, deviceId, onDeviceChange, overlayEnabled. Mode-specific props below. Capture gates (cooldownMs, minFrontalness, captureWindowMs, …) are passive-only.

| Prop | Mode | Type | Default | |---|---|---|---| | onBatchCapture | passive | (faces: SelectedFace[]) => void \| Promise<void> | required | | onCapture | single, interactive | mode-specific signature | required | | deviceId | all | string | unset — browser picks a default camera | | onDeviceChange | all | (id: string \| undefined) => void | — fires when a child picker changes the device | | overlayEnabled | passive | boolean | true — set false to disable the SDK's green boxes and render custom overlays | | cooldownMs | passive | number | 10000 — minimum ms between sends for the same face | | captureWindowMs | passive | number | 0 — per-track best-shot window; 0 keeps settle-based capture | | minDetectionScore | passive | number | 0.5 — detector confidence floor, applied before pose analysis | | minFaceHeight | passive | number | 0 — minimum face-box height as a fraction of frame height (0–1); off by default | | minFrontalness | passive | number | 50 — minimum pose score (0–100) a frame must reach to be captured | | mediapipeWasmUrl | all | string | jsDelivr CDN — override to self-host MediaPipe WASM | | alignmentCaptureDelayMs | interactive | number | 2000 — how long a face must stay aligned before auto-capture |

With captureWindowMs > 0, each tracked face is searched for that long and the best frame is published as final at expiry. useCamera() in passive mode returns rearm(), which starts every window's search again.


Runtime network access

MediaPipe assets are fetched on demand, so the browser must reach:

  • https://cdn.jsdelivr.net — WASM runtime (override with mediapipeWasmUrl)
  • https://storage.googleapis.com — the .tflite detection model

The SDK itself makes no other requests. A strict CSP needs the two asset origins in connect-src, plus script-src 'wasm-unsafe-eval'.


Licence

Proprietary — see LICENSE. Use requires a current agreement with MeeeetUp1120.