Containerized Casting to Chromecast devices
I have several screens with embedded or attached Chromecast receivers in my home office which I've always felt have had the potential for displaying ambient information.
Chromecast devices have an embedded recent but low-powered browser that can be pointed to an arbitrary URL. There are some neat solutions like Dashkiosk that can control multiple devices with different playlists for each. Cast All The Things is versatile too. However, for a lot of the sites I wanted to render, the Chromecast device just couldn't handle the page complexity.
My solution was to run a headless Chrome instance on a server instead, render the content there, and Cast it to the receiver devices. This solution has a few nice characteristics:
- anything that can be loaded in regular desktop Chrome will render
- the server CPU is able to easily render complex websites (Grafana dashboards, dynamic websites like exchanges and stock viewers, WebRTC video, and more)
- the browser can be controlled through a simple Python script via Selenium (e.g. for cycling between URLs, refreshing, or even running arbitrary javascript!)
- it runs in my small Kubernetes setup
It's working really well!
Code on Github: github.com/andyoakley/cast-from-container