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

@bsonntag/react-user-media

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bsonntag/react-user-media

A react component that wraps getUserMedia.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@bsonntag/react-user-media

A react component that wraps getUserMedia.

Installation

Using npm:

$ npm install --save @bsonntag/react-user-media

Using yarn:

$ yarn add @bsonntag/react-user-media

This module uses react's createContext API, so make sure you have at least version 16.3.0 installed.

Example usage

import UserMedia from '@bsonntag/react-user-media';
import React from 'react';

const constraints = { video: true };

const App = () => (
  <UserMedia constraints={constraints}>
    {stream => (
      <video
        autoPlay
        src={URL.createObjectURL(stream)}
      />
    )}
  </UserMedia>
);

Props

  • children - A function that receives the MediaStream and renders something.
  • constraints - A MediaStreamConstraints.
  • onError - A function that is called when getUserMedia throws.
  • onMediaStream - A function that receives the MediaStream.
  • placeholder - An element that is rendered while getUserMedia is being called.
  • renderError - A function that receives the error thrown by getUserMedia and renders something.

Contributing

Please feel free to submit any issues or pull requests.

License

MIT

Keywords

FAQs

Package last updated on 08 Jun 2019

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