Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cast-web-api

vervallsweg160GPL-3.01.2.1

Web API for Google Cast enabled devices.

chromecast, google-cast, cast, api

readme

cast-web-api

npm version Dependency Status npm

Web API for Google Cast enabled devices, based on the node-castv2 implementation by thibauts.

This API is only intended to be used on your local network not for hosting on the public internet.

Installation

You probably don't want to install the api directly. For a GUI install cast-web-api-desktop, for headless server installation use cast-web-api-cli.

Usage

Basics

cast-web-api tries to behave like the Google Home app. All available devices will be connected to, if a device goes down, it'll be removed. If it randomly disconnects, it'll try to reconnect. The autoConnect behavior can be turned of with the config parameter autoConnect. This can be helpful for large speaker groups.

Parameters

Every changed parameter will be saved in /config/config.json. This location will be changed in the next release.

Documentation

Online

Parse the swagger.json, in the online editor.

Local

Install the devDependencies for instance git clone this repo then npm install into the repo. Docs now available at /swagger.

Debugging //TODO: remove/edit

Every log output follows this format: {time} {device id} {function name}: {message}. For easy differentiation between those components, device id is inverted in color and function name underlined. Info messages appear in your standard terminal color. Error messages in red, warning messages in red and server related messages in blue.

2018-03-31T18:27:09.508Z a90824f40764eb5df1fccc4f5cb95dd3 reconnectionManagement(): reconnecting

By default only certain messages are logged, to enable all log-levels see the swagger documentation on /config.

Further information

thibauts wrote a great protocol description. I can only highly recommend reading it.

If you read the first sentences of this file it goes without saying that you should not run this API on the internet. Run it behind a firewall only in your local network!

If you find a bug or typo, feel free to contact me, open an issue, fork it, open prs, you name it.

changelog

Changelog

v1.2.1

  • Fixed: assistant integration #114

v1.2.0

  • Attention: command line usage and options changed, see README.md
  • Added: new command line interface #101
  • Added: built in process management (daemon) #63
  • Added: ES6 class definitions #74
  • Added: central configuration file /config/config.json #98
  • Added: callbacks saved in fs /config/callbacks.json #99
  • Added: callbacks with heartbeat support #100

v1.1.0

  • Attention: Requires node 7.0.0 or higher
  • Fixed: MDNS library, changed to own mdns-cast-browser #73
  • Added: ES6 class definitions #74
  • Added: GoogleTTS messages over 200 characters #70
  • Added: Google Assistant to broadcast messages
  • Added: API paths for Google Assistant auth
  • Added: Added /assistant/setup wizard for auth
  • Added: seek function
  • Added: global /callback
  • Added: unified /config that can be changed at runtime
  • Added: /swagger for better api documentation

v1.0.0

  • Updated: all API paths, see docs for more info
  • Added: GoogleTTS option for /playMedia
  • Added: auto reconnect to devices
  • Added: group recognition

v0.3

  • fixed issue where certain devices don't show up #59
  • all credit to @jg123

  • packages can now be installed through npm again globally
  • npm install cast-web-api -g #61
  • current version pulled from package.json now #62
  • all credit to @kevireilly

  • docker replaced debian with alpine to reduce size #60
  • all credit to @janwerner

v0.2.3

  • added /setMediaPlaybackShort #54
  • readme typ #57
  • package.json min node and dependency versions #53
  • added documentation discoveryTimeout #52
  • docker support #51
  • automatic ip discovery #50

v0.2.2

  • fixed /setMediaPlayback #43

v0.2.1

  • fixed package.json #41, #39

v0.2

  • get/set configuration values in JSON #32
  • added package.json and versioning #31
  • success message on / #30
  • removed mdns npm dependency #29
  • better api documentation #27

v0.1

  • Release