🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

electron-chromecast

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-chromecast

An implementation of the chrome.cast API in electron

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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

Keywords

chromecast

FAQs

Package last updated on 16 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts