Have you ever wanted to move between rooms while watching or listening to the same film or song? We often find ourselves switching from a phone or tablet to the desktop. There are some complicated setups you can use for this involving MythTV and various custom- built servers and receivers, but you can also do it with just one Raspberry Pi server and then many XBMC receivers with a lot less hassle.
Broadcasting your media over your network so that the clients can pick up the stream means that you can easily pick up where you left off in your track or film wherever you move to, without having to make a note of the track position and find the file again. Here’s how to get setup.
What you’ll need
Raspberry Pi Model B
Portable hard drive
Step by step
Step 01 Install storage drivers
You’ll likely be using a portable NTFS hard drive if you want to store a lot of media on your Raspberry Pi caster. This means you need to install the NTFS libraries on the Pi, which requires you to open the terminal and type:
$ sudo apt-get install ntfs-3g
Step 02 Create mounting folder
We’re going to have the Raspberry Pi automatically mount the hard drive for us whenever it boots up, and in order to do this it first needs to have a place where the files will be accessible. Let’s create a directory called mediadrive inside the Home folder. Keep the directory name to just one word to make your life easier later.
$ mkdir mediadrive
Step 03 Boot-time mount parameters
Your hard drive will likely be mounted as /dev/sda1, but do a fdisk -l if you want to double check. To make sure it mounts at boot, go to fstab with sudo nano /etc/fstab and write the following line below, with a tab between each bit of information:
/dev/sda1 /home/pi/mediadrive ntfs-3g defaults,noatime 0 0
Step 04 Install VLC on Pi
So all our media is now accessible, and now we need a way to broadcast it. For this we’ll use multi-functional media player VLC, which was originally designed to be the client for a casting server. You can install it with:
$ sudo apt-get install vlc
Step 05 XBMC stream receiver
This bit is dead simple – on any computer you can easily get files off of, create a file called Stream.strm, and add this line to it, with IP as the last two sets of Pi’s IP address:
Save it and move it to your XBMC clients that you want to receive the cast from.
Step 06 Custom VLC command
Here’s the really fun part. Go back to your Pi and right click on one of the files you’d like to play, go to Properties and click the down arrow next to Open with. Go to Customise and then Custom Command Line and type in the following, with IP as the last two sets on your IP address:
￼cvlc --sout udp:239.255.[IP].[IP]
Step 07 Test out casting
Here’s the big test: boot up XBMC, open your media on the Raspberry Pi and use the Stream file on XBMC to receive the cast. It might take a moment to load but it will start playing via XBMC in short time.
Step 08 Command line alternative
Your setup may not always be convenient for you to go to the Pi and start launching files from the desktop. You can always SSH into your Pi from another computer or an Android device and run the file using a similar custom command to the one we used earlier:
$ cvlc --sout udp:239.255.[IP].[IP] [file location]