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

@microblink/camera-manager

v8.1.0

Published

Manages cameras and stream, provides both a headless component and a UI component

Readme

@microblink/camera-manager

This package provides camera management for web applications. It handles camera selection, permissions, video stream management, and provides access to video frames for further processing. It is framework-agnostic and can be used with or without a UI.

Bundle size

Production consumer bundle sizes for @microblink/camera-manager:

| Entrypoint | Minified | Gzip | | ---------- | -------- | -------- | | root | 92.41 kB | 26.20 kB | | /core | 41.72 kB | 12.78 kB | | /ui | 59.81 kB | 16.48 kB |

External packages and runtime assets such as workers, WASM, and models are excluded. Shared code is included in each entrypoint that loads it.

Generated automatically. Do not edit manually.

Overview

See the custom UI example for a custom interface built with the /core entrypoint.

  • Handles camera selection, permissions, and video stream lifecycle.
  • Provides access to video frames for downstream processing.
  • Can be used standalone or with the included UI components.

Browser Support

The package exports support these browser versions and newer:

| Browser | Root | /core | /ui | | --------------------------- | ---- | ------- | ----- | | Chrome / Chromium (desktop) | 91 | 91 | 91 | | Chrome / Chromium (Android) | 91 | 91 | 91 | | Edge | 91 | 91 | 91 | | Opera | 84 | 84 | 84 | | Firefox (desktop) | 132 | 132 | 132 | | Safari (macOS) | 15.4 | 15.4 | 15.4 | | iOS Safari | 15.4 | 15.4 | 15.4 |

The package must run in a secure context because browsers only expose camera APIs such as getUserMedia() on HTTPS or localhost.

Firefox for Android

Firefox for Android is not supported for camera-based flows. Its navigator.mediaDevices.enumerateDevices() behavior can hide video input devices before an active camera capture, which makes camera device discovery and permission handling unreliable for this package. Mozilla tracks this behavior as intentional and resolved it as WONTFIX because exposing device information before camera access has fingerprinting implications: Bugzilla 1611998.

Installation

Install from npm using your preferred package manager:

npm install @microblink/camera-manager
# or
yarn add @microblink/camera-manager
# or
pnpm add @microblink/camera-manager

Usage

Use /core for framework-independent camera management and /ui for the built-in interface. The package root still exports both entrypoints for compatibility until the next major release.

Core API

import { CameraManager } from "@microblink/camera-manager/core";

const cameraManager = new CameraManager();

// Start the camera stream (auto-selects the best camera)
await cameraManager.startCameraStream();

// Optionally, attach the video to a DOM element
const video = document.getElementById("video");
cameraManager.initVideoElement(video);

// Capture frames for processing
const removeCallback = cameraManager.addFrameCaptureCallback((imageData) => {
  // Process imageData (instance of ImageData)
});

// Stop the camera when done
cameraManager.stopStream();

See the camera-manager example for more usage details.

API

CameraManager class

  • startCameraStream(options?): Starts the camera stream. Options allow selecting a specific camera or facing mode.
  • initVideoElement(videoElement): Attaches a video element for preview.
  • addFrameCaptureCallback(callback): Registers a callback to receive frames as ImageData during capture. Returns a cleanup function.
  • startFrameCapture(): Starts capturing frames for processing.
  • stopFrameCapture(): Stops capturing frames but keeps the stream active.
  • stopStream(): Stops the camera stream and video playback.
  • setResolution(resolution): Sets the desired video resolution (e.g., "1080p").
  • setFacingFilter(facingModes): Filters available cameras by facing mode ("front" or "back").
  • setExcludedCameraNamePatterns(patterns): Sets parts of camera names to exclude from available camera lists.
  • getCameraDevices(): Returns available camera devices.
  • selectCamera(camera): Selects a specific camera device.
  • setCameraMirrorX(mirrorX): Mirrors the video horizontally if needed.
  • reset(): Resets the camera manager and stops all streams.

Camera name filtering

By default, some commonly undesired cameras are excluded. To exclude more cameras while keeping the defaults:

import { CameraManager, defaultExcludedCameraPatterns } from "@microblink/camera-manager/core";

const cameraManager = new CameraManager();
cameraManager.setExcludedCameraNamePatterns([...defaultExcludedCameraPatterns, "other camera name"]);

To include all cameras, call cameraManager.setExcludedCameraNamePatterns([]).

UI Integration

The root and /ui entries require the UI peer dependencies. Install them explicitly; they are optional package peers only so /core consumers do not install a Solid runtime:

npm install solid-js @ark-ui/solid solid-zustand @solid-primitives/keyed

To use the built-in UI, use:

import { CameraManager } from "@microblink/camera-manager/core";
import { createCameraManagerUi } from "@microblink/camera-manager/ui";

const cameraUi = await createCameraManagerUi(cameraManager, document.body);
// Optionally, add cleanup:
cameraUi.dismount();

Camera selector visibility can be configured without changing automatic camera selection or the preferredCameraDeviceId behavior:

const cameraUi = await createCameraManagerUi(cameraManager, document.body, {
  showCameraSelector: false,
});

showCameraSelector defaults to true. The selector appears when the user can choose another camera.

Styling

The Camera Manager UI can be branded by setting these CSS custom properties on its host element:

  • --mb-ui-font
  • --color-primary
  • --color-success
  • --color-error
  • --color-warning

The semantic color properties accept space-separated RGB channel values, such as --color-primary: 0 98 242.

The following Shadow Parts are supported customization seams:

  • capture-screen-part
  • video-element-part
  • camera-select-part
  • mirror-camera-button-part
  • torch-button-part
  • close-button-part

For example:

#mb-camera-host {
  --mb-ui-font: "Inter", sans-serif;
  --color-primary: 32 94 224;
}

#mb-camera-host::part(camera-select-part) {
  max-width: 20rem;
}

Internationalization

You can customize UI strings either when creating the camera UI or at runtime:

const cameraUi = await createCameraManagerUi(cameraManager, undefined, {
  localizationStrings: {
    selected_camera: "My Updated String",
  },
});

At runtime:

cameraUi.updateLocalization({
  select_camera: "My updated string",
});

Provided Translations


You can import any of these files directly or use them as a starting point for your own localization.