Skip to content

Instantly share code, notes, and snippets.

@kaiquewdev
Created February 12, 2018 17:10
Show Gist options
  • Save kaiquewdev/38ddfd3d970da0fb49473c8fc6836c57 to your computer and use it in GitHub Desktop.
Save kaiquewdev/38ddfd3d970da0fb49473c8fc6836c57 to your computer and use it in GitHub Desktop.
play a list with projection
'use strict'
const Browser = require('nodecast-js');
const timestamp = 60; // in seconds
const browser = new Browser();
let args = process.argv.slice(2);
let url = args[0];
if (args.length === 0) url = 'https://www.youtube.com/watch?v=JN6H4rQvwgY&list=PLtBw6njQRU-rwp5__7C0oIVt26ZgjG9NI';
browser.onDevice(device => {
device.onError(err => console.log(err));
console.log(browser.getList()); // list of currently discovered devices
device.play(url, timestamp);
});
browser.start();
setTimeout(() => {
browser.destroy(); // destroy your browser
}, 20000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment