Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Instruction Guide Getting playback via Chromecast devices
#1
Hi Folks,
   a couple of years back I wrote a little hack script for Volumio that could be used to stream the current playing file to a selected Chromecast device or group. 

The idea was to be able to play music from the Pi through to any Chromecast device or device group within the house. It actually works quite well.

Anyway, I hacked the script around a bit last night as one does during lockdown and came up with a variation of the script that will now work with moOde. Both players use mpd and have similarish internal APIs. So the rework was not too complicated.

The script is written in Python and designed to run in the background. It monitors the current MPD playing state and file on moOde and then ensures that a URL for this file is sent to the configured Chromecast.

It then plays synchronisation smarts between the two ensuring that the local moOde playback is about 1-2 seconds behind the Chromecast allowing moOde to operate as the playlist and direct the switch to the next track etc.

You have a lot of control.. pause, play, skip and seek, volume and mute on moOde will all be passed to the Chromecast. A simple web server URL makes it easy to select the desired chromecast device, device group or disable the casting.

So to me it really is a great way to free up the limitations of having the setup play audio in one place. Also given Chromecasts support multi-room streaming, all that just works out of the box and you can play the music simultaneously all over the house.

Full instructions below if you want to try this out if only to under the concept that the script is using. 
 
https://github.com/dresdner353/mpd2chrom.../README.md
Reply
#2
I have tried it and it works very well, the installation has been very simple, error-free.
It would be great to get the opposite route, and for Moode to work like a chromecast receiver, but I don't think that's an easy thing.

Congratulations, good job,
thank you
Reply
#3
(12-05-2020, 06:31 PM)Edues Wrote: I have tried it and it works very well, the installation has been very simple, error-free.  
It would be great to get the opposite route, and for Moode to work like a chromecast receiver, but I don't think that's an easy thing.

Congratulations, good job,
thank you

Cool.. delighted you like it Smile
Reply
#4
Hi folks,
    I've just released an update to my mpd2chromecast "plugin" with some improvements:
  • The plugin now runs via a systemd service (use sudo systemctl to start/stop/enable/disable)
  • It has a first stab at supporting streaming the MPD output stream (should work for gapless playback)

Full instructions here: https://github.com/dresdner353/mpd2chrom.../README.md

Quick guide:
To install or upgrade an existing setup on moOde, you need only do the following:

Code:
ssh pi@moode.local
curl -s https://raw.githubusercontent.com/dresdner353/mpd2chromecast/master/install.sh | sudo bash

This will download/install the script and related python modules it requires. It may take some time.

If it works, then you can browse to http://[your device ip]:8090 and should get a control panel web page like the attached screenshot. That control panel lets you select a desired Google cast device on your network and should then be able to stream any current playback to that selected device. By setting the cast device to "Disabled", it will disable the functionality. This then lets you use your moOde streamer for local playback or casting to any cast device or cast group you have in your home. It's a great convenience to have.

Note: You can't really enjoy both local and cast playback at the same time. It will work but there are interruptions to local playback as it syncs it with the playback on the cast device. So the ideal usage is to listen to one or the other.

Streaming the file vs MPD Output Stream
The 2nd combo box (with play icon) can be used to toggle between two playback modes:
  • Cast file URL (Default)
    This is the default mode which serves the playing track file as a URL to the cast device. The end device will stream the selected file directly and perform all decoding.
  • Cast MPD Output Stream (experimental)
    This is experimental at present. To use this mode you need to navigate to Moode -> Configure -> Audio -> MPD Options -> HTTP streaming. Then enable the HTTP streaming on port 8000 with FLAC encoding (for lossless). When you select this streaming mode in mpd2chromecast, it passes the fixed URL http://<IP>:8000 to the selected cast device. The end result is that the stream being played is the output stream from MPD and not the original file. This allows for integration of DSP modes in MPD, crossfade and even gapless playback. It's not perfect and mileage may vary depending on how well your network works. But it is a first stab.

Appreciate any feedback from those looking to try this out.


Attached Files Thumbnail(s)
   
Reply


Forum Jump: