I use squeezelite to play audio streams on my laptop. The laptop has a built-in Intel sound card, but I use the HDMI connection to my monitor to play the sound on my monitor speakers. This works well and I can use the media buttons on my keyboard.
However, this only works when I execute squeezelite as a background job. Things go wrong when I try to run squeezelite as a service. Then, the sound is played on the laptop speakers. However, I can specify which sound device I want squeezelite to use. Some options are: "default", "front" and "hdmi". "default" and "front" go to the laptop speakers, and "hdmi" goes to the monitor speakers but bypasses the media keys. When run manually, the media keys work and both "default" and "hdmi" go to the monitor speakers.
My question is: how can I run squeezelite as a service, with the output sent to the HDMI speakers, and with the media keys working?
Could it be that because I am running squeezelite as a service (as root), "default" has a different meaning and the media keys are bypassed? I tried to run the start-stop-daemon
as my user, but that didn't work.
This is a list of my sound devices:
Output devices:
default - Playback/recording through the PulseAudio sound server
null - Discard all samples (playback) or generate zero samples (capture)
pulse - PulseAudio Sound Server
sysdefault:CARD=Intel - HDA Intel, ALC272 Analog - Default Audio Device
front:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - Front speakers
surround40:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - 4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
dmix:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - Direct sample mixing device
dsnoop:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - Direct sample snooping device
hw:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - Direct hardware device without any conversions
plughw:CARD=Intel,DEV=0 - HDA Intel, ALC272 Analog - Hardware device with all software conversions
hdmi:CARD=HDMI,DEV=0 - HDA ATI HDMI, HDMI 0 - HDMI Audio Output
dmix:CARD=HDMI,DEV=3 - HDA ATI HDMI, HDMI 0 - Direct sample mixing device
dsnoop:CARD=HDMI,DEV=3 - HDA ATI HDMI, HDMI 0 - Direct sample snooping device
hw:CARD=HDMI,DEV=3 - HDA ATI HDMI, HDMI 0 - Direct hardware device without any conversions
plughw:CARD=HDMI,DEV=3 - HDA ATI HDMI, HDMI 0 - Hardware device with all software conversions
Any ideas?
We don't have any experience with squeezelite emulator but it appears that it makes direct use of ALSA.
To control ALSA with media keys we can define keyboard shortcuts for the user running sqeezelite (in your case
root
):Desktop user keyboard settings, or other per-user audio settings (e.g. default audio devices) will only work after we run squeezlite from a user session (e.g. on login).