Got Chromecast playback working

Hi dresdner353, I do hope you found a solution for this? Because I tried your solution the last couple of days, but it claims the python3.5 issue. So I wonder, how did you solve this issue? Because it would really be great to have this working in my environment.

So, any hints would be very much appreciated!
Regards! Haringstad

Suggestion: why don’t you do a volumio plugin?
This nodejs module looks promising:

@michelangelo, I would love to do that, but I am not a programmer… So, any help on that, would be appreciated? Is there documentation on how to build a plugin? (NOOB Questions, I know!)

Regards, Haringstad

1 Like

Unfortunately I failed miserably to solve this and attempts to try and update Python3 on the image didn’t work.

I think what would help here if Volumio went and upgrade the reference Raspbian image to a latest available to get us past the version gaps in Python. Then we should be able to get all components talking again.

Sorry to hear that! And I appreciate your efforts! I’m surely not the only one with a Google Audio, hooked up to a soundsystem… And it surely would be great if we could fix this, or, as previously mentioned, use a plugin?

To be honest, I dunno where to start with the plugin, so any help would be welcome!

An update… I got it working again but only using a beta Raspian Buster image for Volumio.

So you would need to install the latest Pi image from here:
Volumio Debian Buster Beta - Raspi images debugging and then, reinstall volumio2chromecast based on the updated instructions here… Mileage will vary on well this images works and just FYI it has none of the premium services in case you use any.

I will try to get a UI plugin working at some point to let that Chromecast selection be better integrated. But I’m not going to pursue getting all this working via NodeJS. Someone a lot more node-experienced than me would be a better bet.

To be honest, the problem here is Volumio using an ancient Jesse base stack for the product. Thats from 2015. That’s too old and the Python version fell out of support as have various dependencies.

I tried all kinds of tricks to recompile a later python and some related underlying libraries but it was not getting me anywhere. So the beta image seemed the only alternative.

1 Like

I’ll get a new SD Card to try this out, as soon as time allows. Would be great to have a working and easy to install/manage plugin.

Just committed seek support this morning. So now you can use the progress bar on Volumio to jump to various parts of the track or click he previous track control to go back to the start and it will cue up the Chromecast to match. That was an issue earlier on due to way it had to sync playback between the two.

Very clever!
This can be further extended when the new salsa playback pipeline will be ready :wink:

The code doesn’t interact with the audio DSP in any way whatsoever.

It only checks the API playlist (http://localhost:3000/api/v1/getstate) to determine the current track file path, play/stopped/pause states, seek position & volume values and uses that to ensure that the configured chromecast is engaged and served up a URL for the current track. This works for both music files and even web radio where it serves the radio station URL directly to the chromecast.

The Chromecasts are perfectly suited to play an mp3, flac, m4a and many other formats directly including web streams. They stream the files from the Pi and use on-board hardware to perform the decode and also DAC function in the case of a Chromecast Audio or speaker variants.

Same applies to multi-room playback. The Pi is serving the file URL to just one device in the cast group and they automatically co-ordinate multi-room playback between them. That feature alone is killer IMHO.

In that respect, Volumio is only being used as a management layer for the tracks in terms of controlling playback and organising the music, playlists etc.

I don’t ever see any need to dig deeper into the DSP unless there was some on-the-fly transcoding in play.

Some updates:

  • Updated internal design to leverage python-mpd2 to communicate with the playlist directly via MPD rather than directly to the Volumio API. Seems to respond a lot better this way.

  • The Volumio API is however still used to get album artwork which is important for the default media receiver on normal chromecasts as you get to see it on screen along with the title of the current track/radio station.

  • Also added support for moOde over several days using a separate script and eventually evolved the lot into a single script ( as the generic one-for-all script that works with both Volumio and moOde and potentially any MPD-based platform. As with Volumio, the script still uses the moOde API to similarly get the current tracks artwork when initiating the cast.

  • Updated install steps as there are subtle differences when installing it on either variant.

See the github link for more details…

Some significant rework on the code in the last week.

  • It now runs a web server on http://[your ip]:8080/cast
    You get a drop-down with all discovered Chromecast devices and you can select the desired one or ‘Disabled’ and then click apply. Makes for a very easy means of casting on demand.

  • The device discovery model is redesigned to use a single discovery loop with zeroconf
    This solves problems being observed after long periods where pychromecast/zeroconf would experience socket resource issues. Somehow the mode that had been used was leaking descriptors or something in that regard in zeroconf.

  • Albumart is now served to the cast device direct from album directory
    The code no longer tries to extract albumart from the Volumio API (same for moOde). Instead it checks the files directory for cover.(jpg|png|tiff|bmp|gif) and serves a URL for that to the chromecast. I also added a script to assist in extracting that albumart in case like me, your music collection is mostly made up of embedded albumart.

  • Lastly, the project is renamed to mpd2chromecast (formerly volumio2chromecast)
    So if you have an existing install, you might want to delete the volumio2chromecast directory and follow the install steps again just to get things all synced up to the latest incarnation of this script.

1 Like

Thanks for doing this! I was looking for a way to do it. This seems rather advanced for me, but if I do get a Chromecast speaker, I will try it. I’m looking to buy a HK Citation 500.

Would it be easier to install LMS plugin and the inside LMS installing Castbridge? Can this be done?

Any device that supports Google Cast for audio streaming should just work here. The pychromecast module I used is designed to work that way.

As for LMS, at this stage, IMO it’s not time well spent to keep using it. I was a Squeezebox lover way back but its long-abandoned software now and while it’s a true labour of love for some to keep using it and repackaging it into various modern media streamers, it’s just dragging legacy Perl code around the place with all it’s baggage.

Bear in mind a normal chromecast popped into an AVR or a chromecast audio (if you can find one) via jack RCA/optical might deliver a more optimum experience into better amp hardware than a standalone speaker.

1 Like

I know, it’s not for my main system, or the second one, it’s for my bedroom, I don’t have the space to setup an amplifier/receiver, or speakers.

I have a dedicated stereo system and an AVR, both have their own RPi with Volumio and an external DAC.

But I’m searching for a solution for my bedroom.

I just installed LMS yesterday and the player. I never knew it existed and what it was for. But I find it remarkable, is the only way to send music to my iPad and iPhone, something that Volumio doesn’t do. And connecting a Dragonfly Red to them I get pretty good sound. It beats having a portable RPi and hauling it around the house!
And also like the iPeng player and remote a whole lot more than Volumio, it gives you the ability to shuffle your library without taking 4 minutes to do it, and gives you an actual queue, something I was hoping Volumio did.

So, for me it’s either LMS or going the Roon way.

Thanks, if I buy that chromecast speaker, I’ll give your solution a shot. Even though I find it rather complex to do. I’ve just been using RPi’s and Volumio for less than a month. Never have used Linux or something similar.

Thank you for this thread!

Unfortunately I have not gotten around to packaging my approach yet into something that could be added like a plugin for Volumio

But bear in mind, even if I could get that plugin written, the latest Volumio releases will just not work with my solution because they are using a Linux release over 5 years old (Raspian Jesse). This causes too many conflicts with versions of the required components.

So my solution only works now on the beta images for Volumio or on moOde or any recent Linux distro running MPD as it’s underlying media layer. I’m hoping Volumio will get their Raspian Buster images on the stable route sooner than later but I can see from a dev thread on this that this will take time.

1 Like

My chromecast enabled speaker got here today, and I can use Castbridge inside LMS Volumio plugin to cast to it without a problem, I just had to use transcode to FLAC.

It’s a nice alternative to everyone wanting to use chromecast on Volumio current version.

Hi Pablo,

I’m curious if you can stream to both the chromecast speaker and volumio at the same time? Can you setup a zones in Volumio?

Love the conversation going on here.

Stop posting the same thing several times! Please remove your post and keep only one. TY

Yes, but not inside Volumio. I use iPeng player and then you can play to whichever zone you like. You can even link all of them to play the same thing. But that’s a an iPeng feature.

It’s also a much better player, you can shuffle all your music a lot faster and better than inside Volumio, you can even choose genres and shuffle them or shuffle entire albums.

1 Like