Raspberry Pi Zero audio playback: vlcpulse audio output error: PulseAudio server connection failure: Connection refused
Posted: 28 Jan 2019 20:37
I am checking if VLC Python bindings (https://wiki.videolan.org/Python_bindings) could serve for my project (media player on Raspberry Pi Zero).
By default, the RasPi Zero does not have audio output, and there are several standard ways to implement one. I chose to go the I2S audio path and set up the system accordingly.
I am running Raspbian Stretch Lite, so no GUI. Maybe some of the problems described below are related to this fact.
Testing the mp3 playback from commandline I get the sound, but there are several errors at start:
When using the VLC Python bindings, only one of those errors remains, but twice:
By default, the RasPi Zero does not have audio output, and there are several standard ways to implement one. I chose to go the I2S audio path and set up the system accordingly.
Code: Select all
$ aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
Testing the mp3 playback from commandline I get the sound, but there are several errors at start:
Code: Select all
$ cvlc song.mp3
VLC media player 3.0.3 Vetinari (revision 3.0.3-1-0-gc2bb759264)
[00ed3650] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[00f00f70] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[00f00f70] main interface error: no suitable interface module
[00e79420] main libvlc error: interface "dbus,none" initialization failed
[00ef5ee8] main interface error: no suitable interface module
[00e79420] main libvlc error: interface "globalhotkeys,none" initialization failed
[00ef6198] dummy interface: using the dummy interface module...
Code: Select all
import vlc
from time import sleep
dir_path = os.path.dirname(os.path.realpath(__file__))
file_name = 'song.mp3'
p = vlc.MediaPlayer(dir_path + '/' + file_name)
p.play()
sleep(5)
p.stop()
Code: Select all
$ python test.py
[0202c9c8] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[0203d000] vlcpulse audio output error: PulseAudio server connection failure: Connection refused