I have a service running, which should play audio for me.
[Unit]
Description=My script to monitor the shutdown button
After=multi-user.target
[Service]
ExecStart=/usr/bin/python /home/pi/Radio/Radio/main.py
User=root
Group=root
[Install]
WantedBy=multi-user.target
But I always get the following error:
Oct 10 18:22:57 raspberrypiradio python[4180]: [755aa250] main audio output error: Audio output failed
Oct 10 18:22:57 raspberrypiradio python[4180]: [755aa250] main audio output error: The audio device "default" could not be used:
Oct 10 18:22:57 raspberrypiradio python[4180]: Connection refused.
Oct 10 18:22:57 raspberrypiradio python[4180]: [755aa250] main audio output error: module not functional
Oct 10 18:22:57 raspberrypiradio python[4180]: [7312c1f0] main decoder error: failed to create audio output
Oct 10 18:24:00 raspberrypiradio python[4180]: [75591ca8] vlcpulse audio output error: PulseAudio server connection failure: Access denied
Oct 10 18:24:01 raspberrypiradio python[4180]: [75588cb0] vlcpulse audio output error: PulseAudio server connection failure: Access denied
Oct 10 18:24:01 raspberrypiradio python[4180]: [73d01830] http stream error: cannot resolve stream.rockantenne.de: System error
Oct 10 18:24:01 raspberrypiradio python[4180]: [73d01830] access stream error: HTTP connection failure
Oct 10 18:24:01 raspberrypiradio python[4180]: [73d01830] http stream error: cannot connect to stream.rockantenne.de:80
When I am playing the main.py
file directly via terminal, everything is working.
I am playing the sound in the python file via vlc.