Skip to content

About

Command line interface for Google Chromecast

Resources

Stars

61 stars

Watchers

4 watching

Forks

Latest commit

 

History

41 Commits

Folders and files

Repository files navigation

chromecast-cli

Command line interface for Google Chromecast

Installation

npm install -g chromecast-cli

Usage

Type the following to get a list of all commands and options:

chromecast
Usage: chromecast-cli [options] [command]

Options:
  -V, --version                output the version number
  -H, --host <host>            IP address or hostname of Chromecast (required)
  -h, --help                   output usage information

Commands:
  play [options] <src...>      Play file(s) at <src>
  volume <volume>              Set the volume to <volume>
  volumeStepUp <volumeStep>    Set the volume <volumeStep> higher
  volumeStepDown <volumeStep>  Set the volume <volumeStep> lower
  mute                         Mute
  unmute                       Unmute
  stop                         Stop playback
  pause                        Pause playback
  unpause                      Unpause playback
  status                       Get Chromecast status
  sessions                     Get current playback sessions
  sessionDetails               Get current playback session details (e. g. title, application, image URLs, etc.) of first session

Please note that this tool does not discover Chromecast devices on your network for performance reasons. You have to specify an IP address via the --host option. Consider configuring your DHCP server to assign a fixed IP address to your Chromecast devices.

Examples

The IP address 192.168.1.100 is just an example. Use the IP address of your Chromecast device instead.

Display the device status as JSON

chromecast --host 192.168.1.100 status

Play a song from a DLNA/UPnP source at IP address 192.168.1.1 (e. g. a router or a NAS)

chromecast --host 192.168.1.100 play http://192.168.1.1/media/song.mp3

Play a Youtube video (courtesy of youtube-dl package)

chromecast --host 192.168.1.100 play $(youtube-dl --format bestaudio --get-url "https://youtu.be/dQw4w9WgXcQ")

Publishing

Configure chromecast-cli on npm to trust GitHub Actions for the erkstruwe/chromecast-cli repository and the publish.yml workflow, allowing staged publishing (npm trust github chromecast-cli --repository erkstruwe/chromecast-cli --file publish.yml --allow-stage-publish). No npm access token is needed.

Running npm version patch (or minor/major) pushes the version tag. The workflow tests and stages the package with npm stage publish using OIDC; it does not publish the package publicly. Review and approve it manually with npm stage list, then npm stage approve <stage-id> (npm requires 2FA for approval).

Changelog

  • Version 1 required a Node.js version of at least 5. Version 2 requires a Node.js version of at least 8. Version 3 requires a Node.js version of at least 18.

About

Command line interface for Google Chromecast

Resources

Stars

61 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages