# the-peer

> Peer video chat component

Latest version **3.1.6** (published 2017-11-09) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.6 |
| Published | 2017-11-09 |
| First published | 2017-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 13 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Taka Okunishi |
| Maintainers | okunishinishi |
| Keywords | the, react-component |

## Links

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

## Dependencies (13)

- [debug](https://npm.io/package/debug.md) ^3.1.0
- [asleep](https://npm.io/package/asleep.md) ^1.0.3
- [peerjs](https://npm.io/package/peerjs.md) ^0.3.14
- [the-color](https://npm.io/package/the-color.md) ^1.0.2
- [the-style](https://npm.io/package/the-style.md) ^2.1.0
- [the-video](https://npm.io/package/the-video.md) ^2.0.4
- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0
- [the-button](https://npm.io/package/the-button.md) ^2.0.4
- [the-window](https://npm.io/package/the-window.md) ^5.2.4
- [the-condition](https://npm.io/package/the-condition.md) ^2.0.0
- [the-component-util](https://npm.io/package/the-component-util.md) ^2.1.0
- [peerjs_fork_firefox40](https://npm.io/package/peerjs_fork_firefox40.md) ^0.3.15

## 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

- 3.1.6 (latest) — 2017-11-09
- 3.1.5 — 2017-11-09
- 3.1.4 — 2017-11-09
- 3.1.3 — 2017-10-17
- 3.1.2 — 2017-10-17
- 3.1.1 — 2017-10-17
- 3.0.2 — 2017-09-29
- 3.0.1 — 2017-09-29
- 3.0.0 — 2017-09-29
- 2.2.0 — 2017-09-22
- 2.1.6 — 2017-09-22
- 2.1.5 — 2017-09-22
- 2.1.4 — 2017-09-19
- 2.1.3 — 2017-09-19
- 2.1.2 — 2017-09-19
- … 18 more at https://npm.io/package/the-peer/versions

## README

the-peer
==========

<!---
This file is generated by ape-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-peer
[bd_travis_url]: http://travis-ci.org/the-labo/the-peer
[bd_travis_shield_url]: http://img.shields.io/travis/the-labo/the-peer.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/the-labo/the-peer
[bd_travis_com_shield_url]: https://api.travis-ci.com/the-labo/the-peer.svg?token=
[bd_license_url]: https://github.com/the-labo/the-peer/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/the-labo/the-peer
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/the-labo/the-peer.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/the-labo/the-peer.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/the-labo/the-peer
[bd_gemnasium_shield_url]: https://gemnasium.com/the-labo/the-peer.svg
[bd_npm_url]: http://www.npmjs.org/package/the-peer
[bd_npm_shield_url]: http://img.shields.io/npm/v/the-peer.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>

Peer video chat 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-peer --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 React from 'react'
import { ThePeerSender, ThePeerReceiver, ThePeerStyle } from 'the-peer'
import { TheButton, TheButtonStyle } from 'the-button'
import { TheVideoStyle } from 'the-video'

class ExampleComponent extends React.PureComponent {
  constructor (props) {
    super(props)
    const s = this
    s.state = {
      peerId: 'hoge12345',
      ready: false,
      audioEnabled: true,
      videoEnabled: true
    }
  }

  render () {
    const s = this
    const {state} = s
    const peerOptions = {
      port: 9000,
      host: 'localhost',
      debug: 3
    }
    const {
      ready,
      peerId,
      audioEnabled,
      videoEnabled
    } = state
    return (
      <div>
        <ThePeerStyle/>
        <TheButtonStyle/>
        <TheVideoStyle/>

        <fieldset>
          <legend>Sender</legend>
          <div>
            <ThePeerSender {...{peerId, peerOptions, audioEnabled, videoEnabled}}
                           onReady={() => s.setState({ready: true})}
                           label='This is Me'
            />
          </div>
          <TheButton onClick={() => s.setState({peerId: 'hoge1234'})}>Start</TheButton>
          <TheButton onClick={() => s.setState({peerId: null})}>Stop</TheButton>
          <TheButton onClick={() => s.setState({audioEnabled: !s.state.audioEnabled})}>Toggle audio</TheButton>
          <TheButton onClick={() => s.setState({videoEnabled: !s.state.videoEnabled})}>Toggle video</TheButton>
        </fieldset>
        <br/>
        <fieldset>
          <legend>Receiver</legend>
          <div>
            {
              ready && (
                <div>
                  <ThePeerReceiver {...{peerId, peerOptions}}
                                   label='Some One Else'
                  />
                  <ThePeerReceiver {...{peerId, peerOptions}}
                  />
                </div>
              )
            }
          </div>
        </fieldset>
      </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
-----------

### ThePeerReceiver

Peer video chat component

**Props**

| Name | Type | Description | Default |
| --- | --- | ---- | ---- |
| `peerId` | string  | Id for peer | `null` |
| `peerOptions` | object  | Peer js options | `{}` |
| `volume` | number  | Volume | `0.9` |
| `width` | number  | Component width | `150` |
| `height` | number  | Component height | `150` |
| `reloadable` | bool  | Reloadable on click | `false` |
| `onError` | func  | Handler for error events | `null` |
| `label` | string  | Label text | `null` |
| `labelBaseColor` |   |  | `BASE_LABEL_COLOR` |

### ThePeerSender

Peer video chat component

**Props**

| Name | Type | Description | Default |
| --- | --- | ---- | ---- |
| `peerId` | string  | Id for peer | `null` |
| `peerOptions` | object  | Peer js options | `{}` |
| `volume` | number  | Volume | `0.9` |
| `videoEnabled` | bool  | Enable video | `true` |
| `audioEnabled` | bool  | Disable video | `false` |
| `width` | number  | Component width | `150` |
| `height` | number  | Component height | `150` |
| `reloadable` | bool  | Reloadable on click | `false` |
| `onReady` | func  | Handler for peer ready | `null` |
| `onConnection` | func  | Handler for connection | `null` |
| `onConnectionClose` | func  | Handler for connectionClose | `null` |
| `onError` | func  | Handler for error events | `null` |
| `label` | string  | Label text | `null` |
| `videoSize` |   |  | `{width: {ideal: 640, height: {ideal: 360}}}` |
| `labelBaseColor` |   |  | `BASE_LABEL_COLOR` |

### ThePeerStyle

Style for ThePeer

**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-peer/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-peer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
