I wrote this lib initially for use in Home Assistant, https://www.home-assistant.io
For Home Assistant I made a rule that all device drivers are stand-alone Home Assistant agnostic Python packages. That way more projects can use it.
Glad to see that strategy is working out and it powering projects like this
I know there's no real requirement but I wish projects like this would give attribution where it's due. This project benefits hugely from pychromecast but there's nothing in the readme mentioning that. Just seems a bit off.
Does the pychromecast project use semantic versioning? I've had to pin the library to a specific version after running into an API breaking change on what would be a minor or patch update to 7.X if the project used SemVer.
Here's some example code I wrote, in the form of a few ZSH shell scripts:
The logic should port nicely to other languages. In particular, it shows how to do things like playing a YouTube video using either the URL or just the hash, plus, of course, a way to play videos on the computer you're running the commands from.
(Note that it only listens on a Unix socket. With socat you can redirect that to a TCP socket though, preferably listening on a wireguard interface to keep the rest of your LAN from accessing it, since there's otherwise no security.)
Definitely not for everybody, but perhaps suitable for some.
Isn't a Chromecast very different than controlling locally stored media files, i.e. you can stream YouTube, Netflix, Spotify, mirror your devices (laptop), etc on Chromecast but not your solution?
As to why I don't want google devices on my LAN, I'm sure you could already guess that the answer is the usual privacy/political concerns, which I'll not bore you with since you obviously don't care. There are however some practical benefits to my arrangement, particularly being able to play media served up by NFS (DLNA never gave me anything but grief and unreliability.) Furthermore youtube-dl supports a very long tail of sites that Chromecast doesn't (at least not without the jank of screen mirroring, which AFAIK only works for as long as the laptop being mirrored is turned on.)
In the past I've used https://github.com/keredson/gnomecast which is a standalone simple media player that transcodes if needed and streams to my Chromecast. Thoughts on what this provides that's better?
$ export URL="http://ccmixter.org/content/gmz/gmz_-_Parametaphoriquement.mp3"
$ playerctl -p My_Chromecast open "$URL"
> Thoughts on what this provides that's better?
People tend to use catt or castnow to cast from the command-line. I wrote about using VLC to cast to the Chromecast, but I wouldn't recommend it unless you're watching something that you need VLC for.
Are there other ways to control chromecasts from Linux? I used to be able to cast straight from Chromium, but that hasn't worked for me in at least a couple years.
Edit: included since v3.0
Seeking is supported tho, as are audio-only files.
How would you expect the video bits to get from the machine running VLC to the chromecast if the network drops? Not sure what you mean by "regular chromecast", but if the network connection between the chromecast and the video source is lost, you lose playback. That's true if you're watching YouTube videos or Netflix, or if you're using any other app to cast something from your local network.
Speaking of which, the casting with VLC also has major buffering problems. Even casting a low-def video directly from an SSD to a Chromecast Ultra (over ethernet!) it will buffer for about 1-2 minutes for every 5 seconds of playback.
VLC could do that for network sources. Even for a local file source, it could copy the whole file over - the Chromecast has a decent amount of RAM.
Usually I'm interested in either casting a browser window, or even the whole screen usually, which I've been coming up short on.
If you redirect a tab which is mostly a single video file, it is smart enough to do the video decoding directly on the chromecast, so you get much better quality/framerate.
It doesn't support casting a browser tab or a desktop though (the latter isn't surprising as I'm under wayland which the parent says doesn't work, but I'd guess a browser tab should work? would be interested in other peoples experiences of this).
If opening a browser tab is all you need any tab syncing app / service will do. I use kdeconnect / gsconnect so I don't have to rely on a 3rd party service, Google and Mozilla included.
I have a fire stick that I believe supports miracast, and periodically check if there is linux software that will allow me to stream as a source.
Last time I checked miraclecast seemed to be somewhat broken. Has anyone had any luck?
At least the upcoming Chromecast with Google TV comes with a remote, so you should be able to interact with the captive portal and use it that way.
pip3 install catt
catt cast <any image/song/video/URL supported by youtube-dl>
You can install the Steam Link on a smart TV and your computer (including Linux), switch the Steam window and stream whatever you want to stream.
You'll probably want to avoid outputting the sound on the TV or you'll get a feedback loop.
And there's going to be a slight delay, which might be annoying with a realtime conversation.
So it might not be a great idea from the start.
How would this work on macOS?
Theoretically it should work if you're able to get D-Bus working on macOS. D-Bus is usually a Linux thing, but it's been ported to other platforms. macOS isn't included in the title because most macOS users don't have D-Bus installed.
I included instructions here with URLs to the macOS versions of D-Bus and PyGObject. I'd be interested in whether you're able get it working.