Casting media from terminal to Chromecast.

I would like to setup a cronjob to play RTHK hourly news to my Google Home in the morning, there are many many ways of doing this but here is a simple one.

I already had cronjob running to fetch current RTHK hourly news to a local archive as mp3 file from

By using node-castv2-client, task done in no time.

$ sudo npm install -g castv2-client

The sample code uses mdns to discover all Chromecast device, I am having issue install mdns for unknown reason, but well I already know my IP address of the Google Home anyway, so I comment the discovery part out, hard coded my Google Home IP address, change the URLs or media, title and cover image, then fire up the js file and it is done.

GitHub – A Chromecast client based on the new (CASTV2) protocol