Open warren-bank opened 1 month ago
I quite like this idea. I don't know much about WASM and using it with Go, but this seems like something that could be possible.
Actually, I made a bad assumption. I thought that WebAssembly would support TCP sockets, which client-side javascript does not. But I was wrong.
As such, there's no advantage in going down the rabbit hole that I proposed.. and all of the work that it would involve. There are already javascript libraries that could be used, with the assistance of a proxy to bridge between websockets (from the browser) and tcp sockets (to the chromecast). After commenting here, I actually played around with some and made working browser builds:
I should also note that fx_cast, which is the currently accepted workaround for casting from Firefox, requires using a native "bridge" application for this same purpose. This app allows the addon to use mDNS for device discovery and TCP sockets for communication, neither of which can be done by client-side javascript from within the addon using the APIs provided by the browser.
Unfortunately, it doesn't seem that WebAssembly provides any additional capabilities.
The reason for my asking is that Firefox desktop doesn't support Chromecast. Presumably, this is also the case for all non-Chromium browsers. If the following (example) API could be run from a WebExtension.. then it would be easy to write a very capable replacement for Chrome's built-in integration.
Note that because there is currently no browser API to use mDNS discovery, a static (stateless) "ip" parameter is explicitly passed to each method.
These methods would be equivalent to the following functionality, which is already available from the command-line: