# staging-brytecam-sdk-js

> A js sdk for brytecam sfu

Latest version **0.2.0** (published 2020-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install staging-brytecam-sdk-js
pnpm add staging-brytecam-sdk-js
yarn add staging-brytecam-sdk-js
bun add staging-brytecam-sdk-js
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-09-28 |
| First published | 2020-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 30.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | aniketb |
| Keywords | brytecam, sfu, webrtc, js |

## Links

- npm: https://www.npmjs.com/package/staging-brytecam-sdk-js
- npm.io page: https://npm.io/package/staging-brytecam-sdk-js

## Dependencies (6)

- [uuid](https://npm.io/package/uuid.md) ^8.0.0
- [events](https://npm.io/package/events.md) ^3.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [loglevel](https://npm.io/package/loglevel.md) ^1.6.7
- [protoo-client](https://npm.io/package/protoo-client.md) ^4.0.3
- [sdp-transform](https://npm.io/package/sdp-transform.md) ^2.13.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.0 (latest) — 2020-09-28
- 0.1.0 — 2020-09-28

## README

# brytecam-sdk-js

Frontend sdk for the brytecam backend..

## Installation

`npm install brytecam-sdk-js`

## Usage

```ts
import { Client, LocalStream, RemoteStream } from 'brytecam-sdk-js';
const client = new Client({ url: 'wss://endpoint' });

// Setup handlers
client.on('peer-join', (uid: string, info: any) => {});
client.on('peer-leave', (uid: string) => {});
client.on('transport-open', () => {}));
client.on('transport-closed', () => {});
client.on('stream-add', (uid: string, info: any) => {});
client.on('stream-remove', (stream: RemoteStream) => {});
client.on('broadcast', (uid: string, info: any) => {});

// Join a room
client.join(rid, {
    name: "name"
});

// Leave current room
client.leave();

// Get a local stream
const local = await LocalStream.getUserMedia({
    audio: true,
    video: true
});

// Publish local stream
client.publish(local);

// Unpublish local stream
local.unpublish();

// Subscribe to a remote stream
const remote = client.subscribe(mid);

// Unsubscribe from a stream
remote.unsubscribe();

// Broadcast a payload to the room
client.broadcast(payload);

// Close client connection
client.close();
```

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