GithubHelp home page GithubHelp logo

vujita / electron-chromecast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gpmdp/electron-chromecast

0.0 2.0 0.0 89 KB

Chromecast API wrapper for Electron applications

License: MIT License

JavaScript 100.00%

electron-chromecast's Introduction

Electron Chromecast

Join the chat at https://gitter.im/GPMDP/electron-chromecast Build Status

An implementation of the chrome.cast API in electron

Usage

Basic

You must consume electron-chromecast from within your renderer process, preferably in a preload script.

// ES5
require('electron-chromecast');

// ES6
import 'electron-chromecast';

This will inject the chrome.cast variables and the associated methods globally automatically.
By default when requesting a new Session through chrome.cast.requestSession you will be provided an active Session with the first Chromecast Device we find. To change this behaviour read the Advanced section.

Advanced

// ES5
var chromecast = require('electron-chromecast');

chromecast(function (receivers) {
    return new Promise(function (resolve, reject) {
        // Do some logic to choose a receiver, possibly ask the user through a UI
        var chosenReceiver = receivers[0];
        resolve(chosenReceiver);
    });
});

// ES6
import chromecast from 'electron-chromecast';

chromecast(async (receivers) => {
    // Do some logic to choose a receiver, possibly ask the user through a UI
    const chosenReceiver = receivers[0];
    return chosenReceiver;
});

The function returned from electron-chromecast should be called with a single parameter; a function that returns a promise that will eventually resolve with a single receiver. This receiver is the one that will be used by chrome.cast.

Installation

Note: Behind the scenes we use MDNS which has some system requirements, make sure your system has the required dependencies.

TODO

  • All the TODO's in code (We only implemented the functionality required by Google Play Music, however this should be sufficient for MOST applications)

TODO (But totally not needed): The chrome.cast.games API

electron-chromecast's People

Contributors

marshallofsound avatar jostrander avatar greenkeeperio-bot avatar gitter-badger avatar

Watchers

James Cloos avatar Vu Nguyen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.