# the-cam

> Embed camera component

Latest version **1.0.18** (published 2019-02-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install the-cam
pnpm add the-cam
yarn add the-cam
bun add the-cam
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.18 |
| Published | 2019-02-05 |
| First published | 2018-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 10 |
| Unpacked size | 5.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | okunishinishi |
| Maintainers | okunishinishi |
| Keywords | react-component, the |

## Links

- npm: https://www.npmjs.com/package/the-cam
- Repository: https://github.com/the-labo/the-cam
- Homepage: https://github.com/the-labo/the-cam#readme
- Issues: https://github.com/the-labo/the-cam/issues
- npm.io page: https://npm.io/package/the-cam

## Dependencies (10)

- [asleep](https://npm.io/package/asleep.md) ^1.0.3
- [the-icon](https://npm.io/package/the-icon.md) ^4.0.10
- [the-spin](https://npm.io/package/the-spin.md) ^3.1.12
- [the-check](https://npm.io/package/the-check.md) ^2.0.18
- [the-media](https://npm.io/package/the-media.md) ^1.0.13
- [the-style](https://npm.io/package/the-style.md) ^2.2.4
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.2
- [the-window](https://npm.io/package/the-window.md) ^7.0.2
- [the-component-util](https://npm.io/package/the-component-util.md) ^3.0.20

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 1.0.18 (latest) — 2019-02-05
- 1.0.17 — 2019-02-01
- 1.0.16 — 2019-02-01
- 1.0.15 — 2019-02-01
- 1.0.14 — 2019-02-01
- 1.0.13 — 2019-01-31
- 1.0.12 — 2019-01-31
- 1.0.11 — 2019-01-31
- 1.0.10 — 2019-01-31
- 1.0.9 — 2019-01-31
- 1.0.8 — 2019-01-30
- 1.0.7 — 2019-01-30
- 1.0.6 — 2019-01-30
- 1.0.5 — 2019-01-20
- 1.0.3 — 2018-12-14
- … 3 more at https://npm.io/package/the-cam/versions

## README

the-cam
==========

<!---
This file is generated by the-tmpl. Do not update manually.
--->

<!-- Badge Start -->
<a name="badges"></a>

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/the-labo/the-cam
[bd_travis_url]: http://travis-ci.org/the-labo/the-cam
[bd_travis_shield_url]: http://img.shields.io/travis/the-labo/the-cam.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/the-labo/the-cam
[bd_travis_com_shield_url]: https://api.travis-ci.com/the-labo/the-cam.svg?token=
[bd_license_url]: https://github.com/the-labo/the-cam/blob/master/LICENSE
[bd_npm_url]: http://www.npmjs.org/package/the-cam
[bd_npm_shield_url]: http://img.shields.io/npm/v/the-cam.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

<!-- Badge End -->


<!-- Description Start -->
<a name="description"></a>

Embed camera component

<!-- Description End -->


<!-- Overview Start -->
<a name="overview"></a>



<!-- Overview End -->


<!-- Sections Start -->
<a name="sections"></a>

<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->

<a name="section-doc-guides-01-installation-md"></a>

Installation
-----

```bash
$ npm install the-cam --save
```


<!-- Section from "doc/guides/01.Installation.md.hbs" End -->

<!-- Section from "doc/guides/02.Usage.md.hbs" Start -->

<a name="section-doc-guides-02-usage-md"></a>

Usage
---------

```javascript
'use strict'

import 'the-polyfill/apply' // Some browser needs polyfill for ImageCapture API
import React from 'react'
import { TheCam, TheCamStyle, TheCamInput } from 'the-cam'
import { TheSpinStyle } from 'the-spin'

class ExampleComponent extends React.Component {
  state = {
    disabled: false,
    photo01: null,
  }
  start = () => {
    this.setState({ disabled: false })
  }
  stop = () => {
    this.setState({ disabled: true })
  }

  handleUpdate = (v) => this.setState(v)

  render () {
    return (
      <div>
        <TheCamStyle/>
        <TheSpinStyle/>
        <TheCam onStrat={() => console.log('camera started')}
                onStop={() => console.log('camera stopped')}
                disabled={this.state.disabled}
        >
        </TheCam>

        <br/>
        <button onClick={this.start}>Start</button>
        <button onClick={this.stop}>Stop</button>

        <br/>
        <hr/>
        <br/>
        <br/>
        <br/>
        <br/>
        <br/>
        <section>
          <h1>As Input</h1>
          <TheCamInput value={this.state.photo01}
                       name={'photo01'}
                       onUpdate={this.handleUpdate}
          >
          </TheCamInput>
        </section>
      </div>

    )
  }
}

export default ExampleComponent

```


<!-- Section from "doc/guides/02.Usage.md.hbs" End -->

<!-- Section from "doc/guides/03.Components.md.hbs" Start -->

<a name="section-doc-guides-03-components-md"></a>

Components
-----------

### TheCam

Embed camera component

**Props**

| Name | Type | Description | Default |
| --- | --- | ---- | ---- |
| `audio` | union  | Audio media constraint | `false` |
| `disabled` | bool  | Camera disabled | `false` |
| `height` | union  |  | `150` |
| `onStream` | func  | Handle for stream | `null` |
| `rejectedMessage` | node  | Message to show when camera access rejected | `'Failed to access camera'` |
| `video` | union  | Video media constraint | `true` |
| `width` | union  |  | `'100%'` |
| `onReject` |   |  | `null` |
| `spinning` |   |  | `false` |

### TheCamInput

Embed camera component

**Props**

| Name | Type | Description | Default |
| --- | --- | ---- | ---- |
| `audio` | custom  |  | `TheCam.defaultProps.audio` |
| `convertFile` | func  |  | `(file) => readFileAsDataURL(file)` |
| `height` | custom  |  | `TheCam.defaultProps.height` |
| `onReject` | func  |  | `null` |
| `onUpdate` | func  |  | `null` |
| `video` | custom  |  | `TheCam.defaultProps.video` |
| `width` | custom  |  | `TheCam.defaultProps.width` |
| `value` |   |  | `null` |

### TheCamStyle

Style for TheCam

**Props**

| Name | Type | Description | Default |
| --- | --- | ---- | ---- |
| `options` | object  | Style options | `{}` |



<!-- Section from "doc/guides/03.Components.md.hbs" End -->


<!-- Sections Start -->


<!-- LICENSE Start -->
<a name="license"></a>

License
-------
This software is released under the [MIT License](https://github.com/the-labo/the-cam/blob/master/LICENSE).

<!-- LICENSE End -->


<!-- Links Start -->
<a name="links"></a>

Links
------

+ [THE Labo][t_h_e_labo_url]

[t_h_e_labo_url]: https://github.com/the-labo

<!-- Links End -->

---
_Source: https://npm.io/package/the-cam · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
