Using a Raspberry Pi and VLC as a streaming music server for home or office

Configuring a Raspberry Pi and VLC to act as a streaming audio server for your home or office is inexpensive and relatively easy to do.

The tutorial below configures your Raspberry Pi to autorun VLC on boot and play a pre-configured playlist of streaming audio sites (or any audio content you wish). You control the VLC web instance using a browser on your cell phone or home computer.

 

  1. Begin by installing VLC on your Raspberry Pi.  Link to install VLC
  2. Download and extract this example playlist to your Pi desktop: Streaming-playlist or create one of your own.
  3. Open the terminal window interface in your Raspberry Pi and type in the following:
  4. This will tell you the local ip address of your Pi. Save it for later.

    hostname -I

  5. mkdir /home/pi/.config/autostart

  6. nano /home/pi/.config/autostart/autovlc.desktop

  7. Note: the entry below should be 3 lines only.  It may wrap depending on what you’re viewing this page on.

    [Desktop Entry]
    Type=Application
    Exec=vlc -I http –http-password . –one-instance file: /home/pi/Desktop/streaming.xspf

  8. Hit ctrl-O then <enter> to save the autovlc.desktop file
  9. Hit ctrl-X to exit nano
  10. reboot your Raspberry Pi by typing:

    sudo reboot

  11. Your Pi should reboot and begin playing music automatically.  One thing to note however this  launches VLC in the back ground with its only interface being the web interface so you wont see it come up on the desktop. 
  12. To switch between streaming stations, you will need to connect to the VLC web instance on the Pi by entering http://<raspberry-pi’s-ip-address>:8080  in a browser on your home computer or cell phone.

    A login prompt will come up. Leave the username blank and enter a “.” as the password (you can change to whatever you like).  You’ll see the VLC Lua web control interface come up.

    raspberry-pi-vlc-lua-interface

 

 

 

 

403 forbidden VLC 2.0.3 raspbian

2020-10-04 – Update as of version 2.1 VLC no longer uses hosts files to control access.

I’m enabling the VLC web interface on a Raspberry Pi 2 to interface with my Smartthings home automation system.  The project is called VLC Thing and it turns a Raspberry Pi 2 running VLC into an event sound renderer.  Once you get VLC installed on your Raspberry Pi 2 using:

Sudo apt-get update
sudo apt-get install vlc

You enable the web interface by following instructions here.  At this point however VLC only allows localhost to connect (for security reasons).  To enable access to the VLC web interface from other computers, smart phones etc on your local lan, you have to edit the .hosts file that was installed with VLC.  Open a terminal instance in Raspbian and enter:

gksu leafpad /etc/vlc/lua/http/.hosts

You should see something similar to:

#
# Access-list for VLC HTTP interface
# $Id$
#

# localhost
::1
127.0.0.1

# link-local addresses
#fe80::/64

# private addresses
#fc00::/7
#fec0::/10
#10.0.0.0/8
#172.16.0.0/12
#192.168.0.0/16
#169.254.0.0/16

# The world (uncommenting these 2 lines is not quite safe)
#::/0
#0.0.0.0/0

In most cases removing the “#” before the 192.168.0.0/16 entry will enable access on your local LAN.