Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including chromecasts with all npm packages installed. Try it out:

var chromecasts = require("chromecasts")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

chromecasts v1.9.1

Query your local network for Chromecasts and have them play media


Query your local network for Chromecasts and have them play media

npm install chromecasts


var chromecasts = require('chromecasts')()

chromecasts.on('update', function (player) {
  console.log('all players: ', chromecasts.players)'', {title: 'my video', type: 'video/mp4'})


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.


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, [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: [''], // 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


Make the player pause playback


Resume playback


Stop the playback, [cb])

Seek the video


Get a status object of the current played video.

player.on('status', status)

Emitted when a status object is received.



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free