Saturday, June 29, 2013

Controlling VLC remotely. (using vlc on ubuntu 12.10 and remote for vlc on android, or a web browser)

This is simply another resource for anyone wanting to remote control vlc on their computer. Some of the info I got from here. And some from various other blogs/articles about the same thing. First things first.. you need to have vlc installed. Use "sudo apt-get install vlc" to install it if you don't have it already. While most of the sites I've seen have shown you how to enable vlc's web interface from the gui program, for using this as more of something like a daemon/service, I personally have found it much more useful to just have it run in the background since when you close the gui it stops the service as well. Press Alt-F2 to open up the run dialog and simply type:

vlc -I http

which just starts the vlc web (or http) interface. At this point you can access this interface by opening a browser and typing "localhost:8080" in the location entry.


 You can control and use vlc from here. Although this isn't particularly useful at this point since I can do everything this interface does and more by just opening up the vlc gui. To be able to control vlc remotely, you're going to need to edit a few lines of a file. It is most likely located here: /usr/share/vlc/lua/http/.hosts
Now, using vim(or another preffered text editor), and as root(or with sudo privileges) open the file:

vim /usr/share/vlc/lua/http/.hosts

There should be a private addresses section that is all commented out. If your network is like mine and the ip addresses of all your computers are 192.168.x.x, then uncomment the line with 192.168.0.0/16. If the ip addresses on your network don't look like mine then find the line that looks like your ip and uncomment the corresponding line. Also, another option is that if you know the ip(s) of the device(s) you will be using to control vlc you can simply add it/them to the file(right after the private addresses section is fine).
The reason for all of this is that by default vlc's web interface is only accessible from localhost, or the same computer you're running it on. (which isn't very useful)

Once you have this set up you should be able to connect and control it from another device. If you are trying to access it from another computer just open up a web browser and type in http://192.168.x.x:8080 (replacing the ip address with the address of the computer you have the vlc server running on). You should get the same interface as earlier.
Controlling it from another computer can be useful, but I find it even more useful to be able to control vlc from my android smartphone. I used Remote for VLC by Peter Baldwin. Available in the play store(free). There are various others and I tried most of them, but this one seemed to be the most stable and I liked the setup the best. To connect to your computer with your phone, start the Remote for VLC app. If it doesn't automatically give you the option to add a server then go to the settings:



Click on 'Add VLC server' then enter the ip address of your computer, then type 8080 into the port(unless you specified a different port). It will connect and you can then search your music library via the 'Library' tab (it is more of a file explorer). Find the song or folder you would like to play



After selecting Play or clicking on the mp3 go to the 'Playing' tab. There you can use the media controls. For some reason the playlist just shows about all of your music, and you can't really just clear it when you want to play something else which is for me the only real downside of this app.(but I still chose it because it worked the best for me for what I wanted to do)

No comments:

Post a Comment