# media-recorder-stream

> The Media Recorder API in the browser as a readable stream

Latest version **3.0.0** (published 2024-07-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install media-recorder-stream
pnpm add media-recorder-stream
yarn add media-recorder-stream
bun add media-recorder-stream
```

## 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.0.0 |
| Published | 2024-07-04 |
| First published | 2016-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/media-recorder-stream
- Repository: https://github.com/mafintosh/media-recorder-stream
- Issues: https://github.com/mafintosh/media-recorder-stream/issues
- npm.io page: https://npm.io/package/media-recorder-stream

## Dependencies (3)

- [b4a](https://npm.io/package/b4a.md) ^1.6.6
- [streamx](https://npm.io/package/streamx.md) ^2.18.0
- [fast-fifo](https://npm.io/package/fast-fifo.md) ^1.3.2

## Recent versions

- 3.0.0 (latest) — 2024-07-04
- 2.2.0 — 2019-08-27
- 2.1.1 — 2016-10-20
- 2.1.0 — 2016-10-07
- 2.0.0 — 2016-09-17
- 1.0.1 — 2016-06-26
- 1.0.0 — 2016-05-18

## README

# media-recorder-stream

The [Media Recorder API](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder) in the browser as a readable stream

```
npm install media-recorder-stream
```

## Usage

``` js
const getMedia = require('getusermedia')
const Recorder = require('media-recorder-stream')

getMedia({video: true, audio: true}, function (err, media) {
  if (err) throw err

  const stream = new Recorder(media, {interval: 1000})

  stream.on('data', function (data) {
    console.log('recorded video data:', data)
  })

  // lets display the recorded video as well
  video.src = URL.createObjectURL(stream.media)
  video.autoplay = true
  document.body.appendChild(video)
})
```

## API

#### `const stream = new Recorder(media, options)`

`media` is a [`MediaStream` object](https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API)
from the `getUserMedia` API.

Options include

``` js
{
  interval: 1000, // at which ms interval you want to capture video (defaults to 1s)
}
```

All other options are passed to the Media Recorder constructor

#### `stream.destroy()`

Will destroy the recording stream

#### `stream.media`

The media source stream associated with this stream. You can create a blob url from this and pass it to a video tag to play the recorded video locally.

#### `stream.recorder`

The associated Media Recorder instance.

## License

MIT

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