Chromecast (device, protocol, libraries, firmware) are Google’s most user-hostile and restrictive project so far.
After some time it bothered me that I had a machine plugged in 24/7 connected to both my local LAN and Internet, owned by Google. So, every night I unplug the chromecast and then plug it again whenever I want to cast something.
How about creating a firewall rule and then toggling that instead of physically disconnecting the Chromecast? I found a likely configuration: https://blog.g3rt.nl/allow-google-chromecast-host-firewall-i...
Some useful links:
https://github.com/vincentbernat/nodecastor // one of the earliest attempts of figuring out CASTv2
https://github.com/thibauts/node-castv2 // one of the first libraries to support chromecast streaming based on the works of vincentbernat.