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

@cherryblossomdevelopment/foto-video-component

v1.0.1

Published

A self contained Web Component for video and photos

Readme

Foto Video Web Component

A self contained Web Component for video and photos

Having run into multiple issues with most of features listed below, I've developed this self contained, drop in web component. It is cross browser, cross device, cross framework compatible

  • Noise reduction using RNNoise WASM
  • Normalization to MP4 in all browsers, because Apple, using FFMPEG WASM
  • Pause and resume video recording (hello all other recorders I could find that do not have this)
  • Captioning (with recording audio at same time, if needed)

Features

  • Video recording with pause/resume functionality
  • Photo capture mode
  • Camera switching (front/back)
  • Zoom controls with pinch-to-zoom support
  • Noise filtering integration
  • Mobile-responsive design
  • Touch-friendly interface

Dependencies

  • RecordRTC: For video/audio recording
  • fix-webm-duration: For fixing WebM video duration metadata
  • Noise Filter Component: Custom web component for audio noise suppression

Project Structure

src/
├── foto-video.ts          # Main web component class
├── foto-video.css         # Component styles
├── main.ts               # Demo application
├── style.css             # Demo page styles
├── noisefilter/          # Noise filter web component
│   ├── noise-filter.js
│   ├── noise-filter.umd.cjs
│   └── assets/
└── vite-env.d.ts         # TypeScript environment definitions

Usage

Basic HTML Usage

<!DOCTYPE html>
<html>
<head>
    <script type="module" src="./dist/foto-video.js"></script>
</head>
<body>
    <foto-video id="my-video-component"></foto-video>
    
    <script>
        const component = document.getElementById('my-video-component');
        
        // Show video recorder
        component.show();
        
        // Enable photo mode
        component.setTakePhoto(true);
        
        // Listen for events
        component.addEventListener('video-recorded', (event) => {
            console.log('Video recorded:', event.detail);
        });
        
        component.addEventListener('photo-taken', (event) => {
            console.log('Photo taken:', event.detail);
        });
    </script>
</body>
</html>

Attributes

  • take-photo: Boolean attribute to enable photo capture mode
  • display: Boolean attribute to show/hide the component

Methods

  • show(): Display the component
  • hide(): Hide the component
  • setTakePhoto(boolean): Enable/disable photo capture mode

Events

  • close: Fired when the component is closed
  • video-recorded: Fired when a video is recorded (detail contains blob)
  • photo-taken: Fired when a photo is captured (detail contains blob and thumbnail)

Development

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation

cd foto-video-component
npm install

Development Server

npm run dev

This will start the Vite development server with hot reload.

Build

npm run build

This will create a production build in the dist folder.

Preview Production Build

npm run preview

Browser Support

  • Modern browsers with WebRTC support
  • Mobile browsers (iOS Safari, Chrome Mobile, etc.)
  • Desktop browsers (Chrome, Firefox, Safari, Edge)

Permissions Required

  • Camera access (navigator.mediaDevices.getUserMedia)
  • Microphone access (for video recording with audio)

Notes

  • The component uses Shadow DOM for style encapsulation
  • Mobile devices require HTTPS for camera access
  • The noise filter component is included as a separate web component
  • Zoom functionality requires devices with zoom capabilities, but will use digital zoom on unsupported devices.
  • The component handles mobile orientation changes automatically

Files Overview

  • src/foto-video.ts: The main web component class with all functionality
  • demo.html: A standalone demo page for testing the component
  • vite.config.ts: Configuration for building the component as a library
  • DEPLOYMENT.md: Comprehensive deployment and integration guide

API Usage

const component = document.querySelector('foto-video');

// Show video recorder
component.setTakePhoto(false);

// Show photo capture
component.setTakePhoto(true);

// Hide component
component.hide();

// Listen for events
component.addEventListener('video-recorded', (event) => {
  console.log('Video blob:', event.detail.blob);
});

component.addEventListener('photo-taken', (event) => {
  console.log('Photo blob:', event.detail.blob);
});