Two more things I discovered.
This is my setup: the raspberry pi 2 is connected to the TV over HDMI but also to an analogue amp over, you guessed it, analogue output, to be able to get louder, better sound (with the caveat of some noise and distorsion at low volume).
When playing music with Spotify through spotify-connect-web, the sound was always coming out of the TV and not the analogue amp, no matter what output I chose when starting spotify-connect-web with --device ALSADEVICENAME
. Even --device hw:CARD=ALSA,DEV=0
(bcm2835 ALSA, bcm2835 ALSA, Direct hardware device without any conversions) was outputting to HDMI.
It turns out Raspberri Pis will automatically output sound to HDMI if that’s detected.
To change that, run amixer -c 0 cset numid=3 1
to force the sound of the default alsa device to go through analogue, even when a receiver that can play sound is detected over HDMI. (amixer -c 0 cset numid=3 0
will set it back to the original setting, letting the raspberry pi choose automatically).
Furthermore, if like me you don’t like having your login and password show up in the spotify-connect-web arguments and in the systemd unit (and thus visible to anyone who can ssh into your OSMC box… who changes the password on their media centre honestly?) you might like to know that you can login with your credentials on the command line once and then leave them out.
Spotify-connect-web will store them in /usr/src/app/credentials.json and use them every time it starts. And if need be, you can always enter them on the webpage at osmc.lan:4000. You can probable even never enter them on the command line and just through the web interface actually.