Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-media-devices

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-media-devices

React hooks for capture video and screen. Powered by navigator.mediaDevices API.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

use-media-devices

React hooks for capture video and screen. Powered by navigator.mediaDevices API.

Install

use npm:

npm install use-media-devices

use yarn:

yarn add use-media-devices

use pnpm:

pnpm i use-media-devices

Usage

useUserMedia:

import { useUserMedia } from 'use-media-devices';

function App() {
  const previewRef = useUserMedia({
    onStream: (stream) => {
      //
    },
    onError: (error) => {
      //
    }
  });

  return (
    <video ref={previewRef} width={300}></video>
  );
}

useDeviceMedia:

import { useDeviceMedia } from 'use-media-devices';

function App() {
  const previewRef = useDeviceMedia({
    onStream: (stream) => {
      //
    },
    onError: (error) => {
      //
    }
  }, { audio: true });

  return (
    <video ref={previewRef} width={300}></video>
  );
}

Keywords

FAQs

Package last updated on 13 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc