Skip to content

Instantly share code, notes, and snippets.

@blacklight
Last active July 7, 2020 18:21
Show Gist options
  • Save blacklight/fc8085c57ff3d9bcdb885d2f2dbec7c1 to your computer and use it in GitHub Desktop.
Save blacklight/fc8085c57ff3d9bcdb885d2f2dbec7c1 to your computer and use it in GitHub Desktop.
// Platypush user script to play the current URL
// on the Chromecast if it is a YouTube URL.
async (app, args) => {
const url = await app.getURL();
if (!url.startsWith('https://www.youtube.com/watch?v=')) {
return;
}
const response = await app.run({
action: 'media.chromecast.play',
args: {
resource: url,
},
}, args.host);
if (response.success) {
app.notify('YouTube video now playing on Chromecast');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment