# chromecasts

> Query your local network for Chromecasts and have them play media

Latest version **1.10.2** (published 2021-10-04) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.10.2 |
| Published | 2021-10-04 |
| First published | 2015-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1448 |
| Author | Mathias Buus |
| Maintainers | beaugunderson, mafintosh, feross, ivogeorgiev, alxhotel |

## Links

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

## Dependencies (9)

- [mime](https://npm.io/package/mime.md) ^1.3.4
- [debug](https://npm.io/package/debug.md) ^2.1.3
- [thunky](https://npm.io/package/thunky.md) ^0.1.0
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.8
- [dns-txt](https://npm.io/package/dns-txt.md) ^2.0.2
- [node-ssdp](https://npm.io/package/node-ssdp.md) ^2.2.0
- [simple-get](https://npm.io/package/simple-get.md) ^2.0.0
- [castv2-client](https://npm.io/package/castv2-client.md) ^1.1.0
- [multicast-dns](https://npm.io/package/multicast-dns.md) ^7.2.4

## Recent versions

- 1.10.2 (latest) — 2021-10-04
- 1.10.1 — 2021-09-17
- 1.10.0 — 2021-06-14
- 1.9.1 — 2017-10-17
- 1.9.0 — 2016-05-11
- 1.8.0 — 2016-02-14
- 1.7.1 — 2015-12-16
- 1.7.0 — 2015-12-16
- 1.6.0 — 2015-12-15
- 1.5.4 — 2015-12-12
- 1.5.3 — 2015-07-20
- 1.5.2 — 2015-07-19
- 1.5.1 — 2015-06-11
- 1.5.0 — 2015-05-04
- 1.4.0 — 2015-05-02
- … 9 more at https://npm.io/package/chromecasts/versions

## README

# chromecasts

Query your local network for Chromecasts and have them play media

```bash
npm install chromecasts --save
```

## Usage

```js
const chromecasts = require('chromecasts')()

chromecasts.on('update', players => {
  console.log('all players: ', players)
  player.play('http://example.com/my-video.mp4', {title: 'my video', type: 'video/mp4'})
})
```

## API

#### `var list = chromecasts()`

Creates a chromecast list.
When creating a new list it will call `list.update()` once.
It is up to you to call afterwards incase you want to update the list.

#### `list.update()`

Updates the player list by querying the local network for chromecast instances.

#### `list.on('update', player)`

Emitted when a new player is found on the local network

#### `player.play(url, [opts], cb)`

Make the player play a url. Options include:

```js
{
  title: 'My movie',
  type: 'video/mp4',
  seek: seconds, // start by seeking to this offset
  subtitles: ['http://example.com/sub.vtt'], // subtitle track 1,
  autoSubtitles: true // enable first track if you provide subs
}
```

#### `player.subtitles(track, [cb])`

Enable subtitle track. Use `player.subtitles(false)` to disable subtitles

#### `player.pause([cb])`

Make the player pause playback

#### `player.resume([cb])`

Resume playback

#### `player.stop([cb])`

Stop the playback

#### `player.seek(seconds, [cb])`

Seek the video

#### `player.status(cb)`

Get a status object of the current played video.

#### `player.on('status', status)`

Emitted when a status object is received.

## License

MIT

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