Code Monkey home page Code Monkey logo

chromecast's Introduction

ChromeCast

Initial chromecast work

API

Chromecast

var chromecast = require('chromecast')();

Initialize a new Chromecast object.

A Chromecast object is an event emitter.

Events:

device

Emits an event when a device is found. Receives a Device object.

chromecast.on('device', function(device){
  // device is the chromecast device
});

discover

Chromecast starts looking for devices.

chromecast.discover();

Device

A Chromecast Device object

launch

Device launches an app with given data.

chromecast.on('device', function(device){
  device.launch('YouTube', {
    v: 'cKG5HDyTW8o'
  });
});

appInfo

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);
  });
});

connectionUrl

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);
  });
});

TODO:

  • More docs

chromecast's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chromecast's Issues

Video Player Controls

I'm assuming this is coming with the docs, but where all methods for play, pause, etc?

Cannot find module 'rest/interceptor/mime'

Hi,

I just checked out your module. And was having this error out of the box.

MacBook Pro with Mountain Lion

  1. mkdir chromecasttest
  2. cd chromecasttest
  3. npm install chromecast
  4. touch app.js
  5. edit app.js to include the following text:
var chromecast = require('chromecast')();


chromecast.on('device', function(device){
    // device contains device info
    console.log(device);
});

Then I ran this from the terminal

brassmonkey:chromecasttest francois$ node app.js 

Got these results:

module.js:340
    throw err;
          ^
Error: Cannot find module 'rest/interceptor/mime'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/francois/Dev/chromecasttest/node_modules/chromecast/index.js:4:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Any ideas what's up? I was curious to poke around more with this and saw your module mentioned this morning so I was checking it out.

ps. I'm the CTO at Brass Monkey and so obviously love this space.

Error: Could not locate the bindings file

Cant search of devices

node: v8.4.0
os: windows 10

$ node sender.js
D:\projects\chrome-dash\node_modules\bindings\bindings.js:96
  throw err
  ^

Error: Could not locate the bindings file. Tried:
 → D:\projects\chrome-dash\node_modules\node-expat\build\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\build\Debug\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\build\Release\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\out\Debug\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\Debug\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\out\Release\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\Release\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\build\default\node_expat.node
 → D:\projects\chrome-dash\node_modules\node-expat\compiled\8.4.0\win32\x64\node_expat.node
    at bindings (D:\projects\chrome-dash\node_modules\bindings\bindings.js:93:9)
    at Object.<anonymous> (D:\projects\chrome-dash\node_modules\node-expat\lib\node-expat.js:4:32)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\projects\chrome-dash\node_modules\xml2json\lib\xml2json.js:1:75)

my code

let chromecast = require('chromecast')()
const log = console.log

chromecast.discover()

chromecast.on('device', function (device) {
  log('discovered', device)
})

sample with playing a youtube video doesn't work

I have this code:

var chromecast = require('chromecast')();
chromecast.discover();

chromecast.on('device', function(device){
  // device is the chromecast device
  console.log('discovered', device)
  device.launch('YouTube', {
    v: 'cKG5HDyTW8o'
  });
});
discovered Device {
  location: 'http://172.20.10.5:8008/ssdp/device-desc.xml',
  applicationUrl: 'http://172.20.10.5:8008/apps/',
  name: 'Chromecast8565',
  model: 'Eureka Dongle',
  info: 
   { deviceType: 'urn:dial-multiscreen-org:device:dial:1',
     friendlyName: 'Chromecast8565',
     manufacturer: 'Google Inc.',
     modelName: 'Eureka Dongle',
     UDN: 'uuid:7d71fe6a-8d04-08dd-7a96-622d57b78c08',
     iconList: { icon: [Object] },
     serviceList: { service: [Object] } },
  connectionUrl: [Function: connectionUrl] }
rest.js: client.chain() is deprecated, use client.wrap() instead
Potentially unhandled rejection [3] {"request":{"path":"http://172.20.10.5:8008/apps/YouTube","method":"POST","entity":{"v":"cKG5HDyTW8o"},"headers":{"Content-Type":"application/x-www-form-urlencoded.js","Accept":"application/x-www-form-urlencoded.js, application/json;q=0.8, text/plain;q=0.5, */*;q=0.2"}},"error":"mime-unknown"} (WARNING: non-Error used)

Cant install

When i try installing the package it shows: command failed.

Console log:
`PS E:\Node\cast-dash> npm i chromecast
npm ERR! code 1
npm ERR! path E:\Node\cast-dash\node_modules\node-expat
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Users\emres\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (D:\Programmer\Node.JS\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at D:\Programmer\Node.JS\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\Programmer\Node.JS\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm ERR! gyp ERR! stack at D:\Programmer\Node.JS\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at D:\Programmer\Node.JS\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm ERR! gyp ERR! stack at D:\Programmer\Node.JS\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:406:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "D:\Programmer\Node.JS\node.exe" "D:\Programmer\Node.JS\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\Node\cast-dash\node_modules\node-expat
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\emres\AppData\Local\npm-cache_logs\2022-03-24T18_09_02_205Z-debug-0.log`

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.