gmrender-resurrect icon indicating copy to clipboard operation
gmrender-resurrect copied to clipboard

Requiring pulseaudio.service or pulseaudio.socket with in systemd gmediarender.service

Open stormwatch opened this issue 6 years ago • 4 comments

Hi all:

I'd like to know if there is a way for gmediarender.service running with user name 'gmediarender' to require pulseaudio (service or socket) as opposed to running pulseaudio as a system-wide daemon.

Would it be better to run gmediarender.service with systemctl --user since pulseaudio is defined as a user service too?

Thanks

stormwatch avatar Aug 29 '18 03:08 stormwatch

Yes, you can start gmediarender as any user.

hzeller avatar Aug 29 '18 05:08 hzeller

For the record, I ended up with the original provided systemd unit service but then configured pulseaudio unix sockets as described in https://wiki.archlinux.org/index.php/PulseAudio/Examples#Allowing_multiple_users_to_use_PulseAudio_at_the_same_time

in /etc/pulse/default.pa: load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-socket

and in /etc/pulse/client.conf: default-server = unix:/tmp/pulse-socket

stormwatch avatar Aug 29 '18 20:08 stormwatch

I just spent hours trying to achieve this before I saw your post. Thanks!

There should be a word about this in the doc...

phpbg avatar Jun 06 '20 22:06 phpbg

I didn't need to reconfigure Pulseaudio with using

/etc/systemd/user/gmrender-resurrect.service
[Unit]
Description=gmrender-resurrect service
After=network.target sound.target

[Service]
Type=simple
Restart=always
PIDFile=/run/user/%U/gmrenderer.pid
EnvironmentFile=/etc/default/gmediarender
ExecStart=/bin/bash -c ' \
                       /usr/local/bin/gmediarender \
                           -f "`hostname`" \
                           -u "`cat /etc/machine-id`" \
                           -P /run/user/%U/gmrenderer.pid \
                           --gstout-initial-volume-db=$INITIAL_VOLUME_DB \
                           $DAEMON_EXTRA_ARGS \
                       '

[Install]
WantedBy=multi-user.target

and with

/etc/default/gmediarender
INITIAL_VOLUME_DB=-10
DAEMON_EXTRA_ARGS="--gstout-audiosink=alsasink --gstout-audiodevice=pulse"

almereyda avatar May 01 '21 23:05 almereyda