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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-camera-extended

v0.0.7

Published

A Camera component for React with extended features like switch camera interface.

Downloads

7

Readme

React Camera Extended Travis status build npm version

Original Credits & Source Code From - React Camera

Camera Module with ability to -

  1. Take Photos.
  2. Swap Camera Interface on Mobile Devices.

Getting started

npm install react-camera-extended

or

yarn add react-camera-extended

Source Code & Demo

Please it here here - React Camera Extended

Usage

import Camera from 'react-camera-extended';
// Use ExifOrientationImg to make sure image does not rotate due to Exif Rotation
import ExifOrientationImg from 'react-exif-orientation-img';

export default class CameraInterface extends Component {

  constructor(props) {
    super(props);
    this.takePicture = this.takePicture;
  }

  componentDidMount() {
    this.state = {
      cameraState: 'open'
    }
  }

  takePicture = () => {
    this.camera.src = this.camera.capture();
    this.setState(({cameraState: 'preview'}));
  };

  render() {
    if (this.state.cameraState ==- 'preview') {
      return(
        <div>
          <ExifOrientationImg className="camera-preview__image" src={this.props.src}/>
        </div>
      )
    } else {
      return (
        <div className="camera-interface">
          <Camera ref={(cam) => { this.camera = cam;}} tryRearCamera={true} />
          <footer className="camera-interface__footer" >
            <img src={RecordIcon}  className="camera-interface__footer__capture-button" onClick={this.takePicture} >
            </img>
          </footer>
        </div>
      );
    }
  }
}

Available Props

  • video - true if you just need any video source from device. You can set preference by referring here.

  • audio - true|false. False by default as we currently only support capture photo.

  • styles - To override default style use this prop. Default values -

    {
      video: {
        minWidth: '100%',
        minHeight: '100%',
        width: 'auto',
        height: 'auto',
        position: 'absolute',
        top: 0,
        left: 0
      },
      videoContainer: {
        position: 'absolute',
        top: 0,
        bottom: 0,
        width: '100%',
        height: '100%',
        overflow: 'hidden'
      }
    }
  • tryRearCamera - Set true if you intend to use this in mobile phone and want rear camera to load by default. Default - false

Methods

Make sure to set camera reference like given in the example. Once you have this.camera = ref, you can use following methods -

  • this.camera.capture() - Captures the and returns image in data url format.
  • this.camera.setVideoStream(tryRearCamera = true|false) - Call this to toggle between front and rear camera.

Contribution

Please fork the repository and open the pull request against master. Feel free to reach out to us at [email protected]