chromecasts

Query your local network for Chromecasts and have them play media

  • Owner: mafintosh/chromecasts
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

chromecasts

Query your local network for Chromecasts and have them play media

npm install chromecasts

Usage

var chromecasts = require('chromecasts')()

chromecasts.on('update', function (player) {
  console.log('all players: ', chromecasts.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:

{
  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

Main metrics

Overview
Name With Ownermafintosh/chromecasts
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2015-04-12 06:04:00
Pushed At2021-10-04 14:15:31
Last Commit At2021-10-04 16:15:21
Release Count19
Last Release Namev1.9.1 (Posted on 2017-10-17 23:51:08)
First Release Namev1.0.0 (Posted on 2015-04-11 23:04:07)
用户参与
Stargazers Count1.5k
Watchers Count34
Fork Count68
Commits Count77
Has Issues Enabled
Issues Count17
Issue Open Count10
Pull Requests Count16
Pull Requests Open Count4
Pull Requests Close Count3
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private