chromecast

ChromeCasting in Node

npm install chromecast
1 downloads in the last day
17 downloads in the last week
57 downloads in the last month

ChromeCast

Initial chromecast work

API

Chromecast

var chromecast = require('chromecast')();

Initialize a new Chromecast object.

A Chromecast object is an event emitter.

Events:

device

Emits an event when a device is found. Receives a Device object.

chromecast.on('device', function(device){
  // device is the chromecast device
});

discover

Chromecast starts looking for devices.

chromecast.discover();

Device

A Chromecast Device object

launch

Device launches an app with given data.

chromecast.on('device', function(device){
  device.launch('YouTube', {
    v: 'cKG5HDyTW8o'
  });
});

appInfo

Device retrieves info about app.

chromecast.on('device', function(device){
  device.launch('ChromeCast', {
    v: 'release-9e8c585405ea9a5cecd82885e8e35d28a16609c6'
  }).then(function(){
    return device.appInfo();
  }).then(function(appInfo){
    console.log(appInfo);
  });
});

connectionUrl

Device retrieves the connection url for app.

chromecast.on('device', function(device){
  device.launch('ChromeCast', {
    v: 'release-9e8c585405ea9a5cecd82885e8e35d28a16609c6'
  }).then(function(){
    return device.appInfo();
  }).then(function(appInfo){
    return device.connectionUrl(appInfo);
  }).then(function(connectionUrl){
    console.log(connectionUrl);
  });
});

TODO:

  • More docs
npm loves you