- Notifications
You must be signed in to change notification settings - Fork20
A multiroom audio player setup, based on snapcast and mopidy.
License
mariolukas/HydraPlay
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
HydraPlay is an easy to use multiroom audio player. HydraPlay provides an integrated web interface to multipleMopidy instances and oneSnapcast server. It generatesall the complex configurations under the hood. Only one configuration file is needed to define what the user needs.
The server part is written in Python and provides a webserver for the frontend delivery. Besides that the servergenerates all configurations and cares about starting Mopidies and Snapcast.
The Frontend is written in TypeScript with the usage of Angular. It connects to the Mopidy and Snapcast web API's tocombine all the fancy functions in one user interface.
HydraPlay was inspired by a project i have found onYoutubeby Ryan Detzel.
This project is still under development, some things might be unstable
The scnreenshots below show two connected players and a configuration with two (default value) Mopidy instances.
The following steps require Docker and Docker Compose to be installed on your system.
Make a copy of the filehydra.example.json
and rename it tohydra.private.json
. This file contains all needed configurations for the setup.
Open the file in an editor and make your changes. If you want to enable Spotify you need a client_id and client_secret. Just follow the instructions of theMopidy Spotify extension. Add the cliendId, client secret and your Spotify login credentials to the config. Enable Spotify and save all changes.
Now you are able to start the server with:
platform: linux/amd64
in the docker-compose.yml file.
docker-compose up
Connect a SnapClient to the server.
The fastest way is by using the integrated webclient. Open a browser and go to
http://<your_server_ip>:<port_in_configuration>/client/
Click on the play button on the top right corner in the window.
Your client should be connected to the server ( you can proceed with the next step)
Alternatively use a more stable generic client on your client-side systems (e.g Raspberry Pi)
snapclient -h <server_ip>
Detailed information can be found on the officalSnapcast GitHub project documentation.
Or even install the official android client on your mobile phone
https://github.com/badaix/snapdroid/releases/tag/v0.24.0
Finally open a Browser and goto:
http://<your_server_ip>:<port_in_configuration>
If you like my work and want to support it, feel free to leave a donation.

This section describes the HydraPlay cofiguration filehydra.example.conf
port: defines the web port on which hydraplay will be available in the browser. Defaults is8080
source_type: Defines which type of audio source should be used between mopidy and snapcast. Possible values arefifo
andtcp
. Defaults istcp
.
config_path: Defines the path to the generated Snapserver config file. Default for Docker usage is/tmp/
,
server_port: Default is1704
remote_port: Default is1705
additional_fifos: Will be used for additional sources but is not implemented yet. Default is[]
,
codec: Defines Snapcsats audio codec. Possible values areflac, opus, ogg, pcm
Default isflac
mpd_base_port: Default is6600
web_base_port: Defines the web API port for Mopidy. This port is used by HydraPlay for connecting to the Mopidy web API. The first instance equals to this port. For all further instances the port is increased by a count of one. Default is6680
instances: Defines the number of stated Mopidy instances. Each instance represents one stream in HydraPlay. A goodstarting point would be number of instances equals number of clients. Defualt is2
config_path: Defines the folder where HydraPlay generates the Mopidy configurations. Default is/tmp/
,
TODO
If you want to do some development on the ui you can use a local docker devimage for keeping things easy. The dev image is almost the same as the production image but it does not contain a pre-compiled version of the ui. Therefore the image build process is much faster. Just run
docker-compose -f docker-compose.dev.yml build
platform: linux/amd64
in the docker-compose.yml file.
Afterwards you can fire up the development environmentby
docker-compose -f docker-compse.dev.yml up
Now you can proceed whit "Build the Angular Frontend"
nodejs is required before you can proceed.After you've installed nodejs you can build the ui by using:
cd src/uinpm install -g @angular/cli -gnpm installng build
You can runng build
with the additional argument--watch
for livere-compiling while you are working on your code.
The build folder is located at/src/hydraplay/server/static/player
You can build a production image instead downloading by using:
docker build -f docker/Dockerfile -t mariolukas/hydraplay --build-arg SNAPCASTVERSION=0.26.0 .
platform: linux/amd64
in the docker-compose.yml file.
You can find ablog post. which i wrote a couple of years ago when i started the project. A lot of things changed since the first setup. But it will give you and idea on how it works under the hood.( the blog post describes the very first prototype! )
- mdns/avahi does not work within docker. You need to start your clients with the -h <ip_address_of_server> parameter.
Play/Pause button will not change back after a track was completed. Somehow there is no Mopidy event incomming for EndOfTrack.(works with tcp sources)
- add debian package config and make file
- add build script for raspberry pi image
- add more documentation ( for Raspberry Pi, MacOS with m1, run without docker, configuration etc. )
- provide ready to use pre-build docker images
This project would not have been possible without all the work onSnapcast andMopidy! Special thanks to Ryan Detzel for the inspiration.
Join us at Discord (https://discord.gg/xs9CKfbpuY).
About
A multiroom audio player setup, based on snapcast and mopidy.