# getscreenmedia

> A browser module for attempting to get access to a MediaStream of a user's screen. With a nice node-like API.

Latest version **5.1.2** (published 2019-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install getscreenmedia
pnpm add getscreenmedia
yarn add getscreenmedia
bun add getscreenmedia
```

## 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 | 5.1.2 |
| Published | 2019-02-27 |
| First published | 2013-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 154 |
| Author | Henrik Joreteg |
| Maintainers | andyet-ops, fippo, henrikjoreteg, lancestout, tgabi333, xdumaine |
| Keywords | browser, getUserMedia, screen sharing, WebRTC |

## Links

- npm: https://www.npmjs.com/package/getscreenmedia
- Repository: https://github.com/otalk/getScreenMedia
- Homepage: https://github.com/otalk/getScreenMedia#readme
- Issues: https://github.com/otalk/getScreenMedia/issues
- npm.io page: https://npm.io/package/getscreenmedia

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 5.1.2 (latest) — 2019-02-27
- 5.1.1 — 2019-02-27
- 5.1.0 — 2019-02-27
- 5.0.2 — 2018-07-28
- 5.0.1 — 2018-06-22
- 5.0.0 — 2018-05-31
- 4.1.1 — 2018-04-12
- 4.1.0 — 2018-04-12
- 4.0.1 — 2017-06-06
- 4.0.0 — 2017-05-23
- 3.0.0 — 2017-03-03
- 2.0.0 — 2017-01-19
- 1.5.6 — 2017-01-19
- 1.5.5 — 2016-08-25
- 1.5.4 — 2016-05-14
- … 21 more at https://npm.io/package/getscreenmedia/versions

## README

# getScreenMedia

## What is this?

A tiny browser module that gives us a simple API for getting access to a user's screen.

It gives us a cleaner node.js-style, error-first API and cross-browser handling. No browser support checking necessary; lack of support is treated in the same way as when the user rejects the request: the callback gets passed an error as the first argument.

Suitable for use with browserify/CommonJS on the client.

## Installing

```
npm install getscreenmedia
```

## How to use it

First build and install a domain-specific extension for [Chrome](https://github.com/otalk/getScreenMedia/tree/master/chrome-extension-sample). Firefox and Microsoft Edge will work out of the box.

Use the snippet below to get a screen stream, similar to [getUserMedia](https://github.com/otalk/getUserMedia).
```js
var getScreenMedia = require('getscreenmedia');

getScreenMedia(function (err, stream) {
    // if the browser doesn't support user media
    // or the user says "no" the error gets passed
    // as the first argument.
    if (err) {
       console.log('failed');
    } else {
       console.log('got a stream', stream);  
    }
});
```


## Why?

All supported browsers require the use of an extension and don't offer an cross-browser API which is annoying and error-prone. Node-style (error-first) APIs that are cross-browser, installable with npm and runnable on the client === win!

## Error handling

Error handling (denied requests, etc) are handled mostly by the underlying [getUserMedia lib](https://github.com/HenrikJoreteg/getUserMedia). However this adds one more error type:

- `"HTTPS_REQUIRED"`

Because that's a current requirement of Chrome.

See the [handling errors section of the getUserMedia lib](https://github.com/HenrikJoreteg/getUserMedia#handling-errors-summary) for details about how errors are handled.


## License

MIT
The Firefox sample extension is licensed under MPL 2.0

## Created By

If you like this, follow: [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on twitter.

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