Note: This node has no relation to node-red-contrib-cast
I released a 3.x version of the node-red-contrib-castv2 node this week, and figured I'd post this here for anyone with questions when they upgrade it and find their nodes broken.
Connection management has been completely reworked. The node now exposes a configuration node for connections.
THIS WILL BREAK YOUR CURRENT NODES. To fix, just edit the node, and setup the connection again.
port are no longer settable on the incoming message, since its now a long lived, configured connection instead.
This allows for the following
- Connections are now shared between node instances instead of each node opening and closing connections on every request.
- Connections are now long lived, which allows the node to subscribe to and publish live updates from the cast device, i.e., it's now viable to actually respond to unsolicited state changes on the cast device.
- Nodes will automatically join active sessions launched from other nodes, phones, etc. to start subscribing to events, etc., you shouldn't have to do anything
- You can now send in a message, sans-app name (see docs) for any supported app's active session, to control media commands without it causing the cast app to close, restart, etc. That is, if YouTube is currently playing on the cast device, and you send in a media "STOP" command, the node will attempt to send that to the active YouTube session.
The entire node has basically been overhauled architecturally to allow for controlling more than just the DefaultMediaReceiver on the cast devices. The node can still only control platform and media events for applications it actually SUPPORTS, but now people asking for it to be able to control app X can submit PR's to ADD such support!
Out of the box, it now supports DefaultMediaReceiver (default), YouTube, and has a (basically currently useless) Spotify implementation that I'd love someone with an actual Spotify account to expand (see ticket on the Github).
Any issues, please feel free to ask on the github issues.
Note: The cast API is rather chatty on published updates, e.g., when playing media it actually spits out a message or two every second to reflect media state (i.e., current timestamp on the current media). Near as I can tell this is expected behavior, but keep it in mind that if you start using the output of this node you might get more messages than you're expecting.