Need help with VLC setup ( VLC on host + Homeassistant on docker)

I have the latest home-assistant docker container running on Ubuntu 16.04 LTS. So far I’m loving it. Now, I am trying to add a VLC player to the setup, but I am running into issues. Below are the steps I took and error. Any help is greatly appreciated!

1-> I installed VLC on host using the following command and I can confirm it works standalone

sudo apt-get install vlc

2-> Then, I updated the configuration.yaml to add vlc media bridge to the home-assistant (that is running on docker)

media_player:
-platform: vlc

3-> After, restarting the home-assistant docker container, I get the following error

Log Details (ERROR)

Error while setting up platform vlc

Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity_platform.py”, line 82, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 243, in result
raise self._exception
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/app/homeassistant/components/media_player/vlc.py”, line 41, in setup_platform
config.get(CONF_ARGUMENTS))])
File “/usr/src/app/homeassistant/components/media_player/vlc.py”, line 50, in init
self._instance = vlc.Instance(arguments)
File “/usr/local/lib/python3.6/site-packages/vlc.py”, line 1551, in new
return libvlc_new(len(args), args)
File “/usr/local/lib/python3.6/site-packages/vlc.py”, line 3903, in libvlc_new
ctypes.c_void_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p))
File “/usr/local/lib/python3.6/site-packages/vlc.py”, line 246, in _Cfunction
raise NameError(‘no function %r’ % (name,))
NameError: no function 'libvlc_new’

I have the same setup and I would like to do the same, that is use VLC (or another simple media player like Gstreamer) to play sound on the host.
I’m not sure it can be done though, or maybe it shouldn’t be done.
I have seen it is not possible for Hassio: How to add VLC into my Hassio?
I understand that maybe VLC should be installed in the Docker container running HA, but would that make sense?
Alternatively, what’s a lightweight way to play sound from the host running the HA Docker if I don’t have any other media player?

2 Likes

I have the same situation in my raspberry pi 3B before.Now i get it done .
the HA docker is basd on alpine linux ,go into the bash and use command apk add vlc (can not find vlc-nox)
btw i already download the vlc-nox on host before, and use Privileged mode to run docker
I don’t know if this can be solved on the ubuntu . you can try it

ok i find out the problem,you should add the alsa-utils in docker container.The HA on X86 is in debian9(latets).

apt-get install vlc-nox and alsa-utils .

attention! the alsa Mutes individual channels by default .

sudo alsamixer and make sounds available
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Select_the_default_PCM_via_environment_variable

Then the vlc on HA go back

The problem by adding dependencies in the container is that the container cant be deleted without loosing the installations of those components. Is there any way to extend for example the docker-compose with instructions to add those VLC dependencies?

You can do something like in a Dockerfile and build it yourself:

FROM homeassistant/raspberrypi3-homeassistant:0.84.6
COPY asoundrc.config /root/.asoundrc
RUN apk add vlc && apk add alsa-utils

1 Like

Like that I have my PI speaker working in the docker container.
I can play test WAV files successfully from the command prompt with aplay.
Also I can play some stream from media_player.play_media service.
However tts.google_say is somehow refusing to speak on this device.
While it does work on google cast devices.
A mp3 file from google IS created in the /config/tts folder but no sound at all.

Errors:
[01419e90] main tls client error: TLS client plugin not available
[0124c100] access stream error: HTTP connection failure
[01a3f630] main input error: Your input can’t be opened
[01a3f630] main input error: VLC is unable to open the MRL ‘https://my.domain.org/api/tts_proxy/fa26be19de6bff93f70bc234308434e4a440bbad02_en_-_google.mp3’.

Think I need to add some TLS client plugin to VLC installation.

Any ideas how to solve that?

if you use docker and homeassistant is running on docker, you need to install vlc inside docker, not on the host system.
you can access the docker bash with “docker exec -it homeassistant bash”.
and then run “apk add vlc && apk add alsa-utils” command on the bash of docker.
then the system will detect vlc and will be solved this problem after restart hassio.

2 Likes