Initial chromecast work
var chromecast = require('chromecast')();
Initialize a new Chromecast object.
A Chromecast object is an event emitter.
Emits an event when a device is found. Receives a Device object.
chromecast.on('device', function(device){
// device is the chromecast device
});
Chromecast starts looking for devices.
chromecast.discover();
A Chromecast Device object
Device launches an app with given data.
chromecast.on('device', function(device){
device.launch('YouTube', {
v: 'cKG5HDyTW8o'
});
});
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);
});
});
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);
});
});
- More docs