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

@onamfc/video-transcoder

v1.1.0

Published

Backend-agnostic video recording and transcoding module with AWS integration

Readme

Video Recorder Studio

A production-ready, backend-agnostic video recording and transcoding library that enables websites to capture webcam video and automatically convert it to HLS format using AWS services.

Features

  • Universal Recording: Works across all modern browsers and devices
  • AWS-Powered: Leverages S3, MediaConvert, and CloudFront for scalable processing
  • Backend Agnostic: Integrates with any server technology
  • Mobile Optimized: Responsive design with mobile-specific optimizations
  • Production Ready: Built-in error handling, retry logic, and monitoring
  • Customizable: Flexible configuration and styling options
  • Progress Tracking: Real-time upload and processing progress
  • Secure: Presigned URLs and proper authentication handling

Quick Start

1. Install the Package

npm install @onamfc/video-transcoder

2. Basic Usage

import { VideoRecorder } from '@onamfc/video-transcoder';

const recorder = new VideoRecorder({
  apiEndpoint: 'https://your-api.com/api/video',
  maxDuration: 300,
  videoQuality: 'medium'
});

// Initialize camera
await recorder.initialize();

// Start recording
await recorder.startRecording();

// Stop and upload
const recording = await recorder.stopRecording();
const upload = await recorder.uploadRecording(recording.blob);

// Track progress
recorder.onComplete((result) => {
  console.log('HLS URL:', result.hlsUrl);
  console.log('MP4 URL:', result.mp4Url);
});

3. React Hook

import { useVideoRecorder } from '@onamfc/video-transcoder/react';

function VideoRecorderComponent() {
  const {
    initialize,
    startRecording,
    stopRecording,
    isRecording,
    duration,
    status
  } = useVideoRecorder({
    config: {
      apiEndpoint: 'https://your-api.com/api/video',
      maxDuration: 300
    },
    onComplete: (result) => {
      console.log('Video processed:', result.hlsUrl);
    }
  });

  return (
    <div>
      <button onClick={initialize}>Initialize Camera</button>
      <button onClick={startRecording} disabled={!isInitialized || isRecording}>
        Start Recording
      </button>
      <button onClick={stopRecording} disabled={!isRecording}>
        Stop Recording
      </button>
      <p>Status: {status}</p>
      <p>Duration: {duration}s</p>
    </div>
  );
}

API Reference

VideoRecorder Class

Constructor

new VideoRecorder(config: RecorderConfig)

Methods

  • initialize(): Promise<void> - Initialize camera access
  • startRecording(): Promise<void> - Start video recording
  • stopRecording(): Promise<RecordingResult> - Stop recording and get result
  • pauseRecording(): void - Pause current recording
  • resumeRecording(): void - Resume paused recording
  • uploadRecording(blob: Blob, metadata?: object): Promise<UploadResult> - Upload recorded video
  • getUploadStatus(trackingId: string): Promise<StatusResult> - Check upload status
  • cleanup(): void - Clean up resources

Event Handlers

  • onProgress(callback: (progress: ProgressEvent) => void): void
  • onComplete(callback: (result: ProcessingResult) => void): void
  • onError(callback: (error: ErrorEvent) => void): void

Configuration

interface RecorderConfig {
  // Required
  apiEndpoint: 'https://your-api.com/api/video',
  
  // Recording Settings
  maxDuration: 300, // 5 minutes
  videoQuality: 'medium', // 'low' | 'medium' | 'high' | 'auto'
  audioEnabled: true,
  
  // Upload Settings
  chunkSize: 5 * 1024 * 1024, // 5MB chunks
  maxRetries: 3,
  parallelUploads: 3,
  
  // Output Options
  outputFormats: ['hls', 'mp4'],
  thumbnailCount: 3,
  
  // UI Options
  showPreview: true,
  customStyles: { /* CSS styles */ }
}

Backend Integration

Your backend needs to implement these endpoints:

  • POST /api/video/upload-token - Generate presigned upload URLs
  • GET /api/video/status/:trackingId - Get processing status
  • GET /api/video/recordings - List recordings (optional)

See the GitHub repository for complete backend examples and AWS infrastructure setup.

Browser Support

| Browser | Version | Support Level | |---------|---------|---------------| | Chrome | 47+ | ✅ Full | | Firefox | 29+ | ✅ Full | | Safari | 14+ | ✅ Full | | Edge | 79+ | ✅ Full | | Mobile Safari | 14+ | ✅ Full | | Chrome Mobile | 47+ | ✅ Full |

TypeScript Support

This package includes TypeScript definitions out of the box.

Examples

Check the GitHub repository for complete examples:

  • Vanilla JavaScript
  • React with hooks
  • Vue.js composition API
  • Angular components
  • Backend integrations (Express, Django, Laravel, Serverless)

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.

License

MIT License - see LICENSE file for details.

Support


Note: This package requires a backend implementation to handle video uploads and processing. See the GitHub repository for complete setup instructions including AWS infrastructure deployment.

Run tests

npm test

Build module

npm run build

Run examples

npm run dev:examples


## License

MIT License - see [LICENSE](./LICENSE) file for details.

## Support

- **Documentation**: View the Docs directory
- **Issues**: [GitHub Issues](https://github.com/onamfc/video-transcoder/issues)
- **Discussions**: [GitHub Discussions](https://github.com/onamfc/video-transcoder/discussions)

## Acknowledgments

- AWS MediaConvert team for excellent transcoding capabilities
- WebRTC community for browser API standards
- Open source contributors and early adopters
---