Fandom

Music Player Daemon Community Wiki

Built-in HTTP streaming part 2

525pages on
this wiki
Add New Page
Talk2 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Use mpd to connect to the stream Edit

MPD can both output and play streams. You can have one mpd session on the server stream your music to another mpd session where you want to output the sound (client). For example, your desktop computer at the opposite end of the room has fast, reliable and big hard disks with lots of excellent music whilst your laptop beside you has one slower, prone to overheating and smaller hard disk with less or no good music.

MethodEdit

1. Set up an mpd session on the server to stream the output. This is done by editing the mpd.conf file (see above in part 1) [No link to part 1 :-( ]
2. Restart mpd and there will be an output that steams your music on the specified port (default: 8000)
vlc -I ncurses http://192.168.0.1:8000 & #
3. On the client (mpd or any other client that plays streams IE- VLC etc,,) add http://IP:PORT to the playlist.
3.1 another easy way to play a radio stream (in my case, my older mpd version client did not support mp3 stream radio) is to use VLC, I run the following command on the client
For example, to use the mpd command line utility "mpc" to add a remote mpd stream from "192.169.0.1" on port "8000" to your local mpd playlist use the following command in a terminal:
mpc add http://192.169.0.1:8000
4. To play songs with your client computer from your remote mpd session (server) you must either use a mpd client (such as "gmpc") or connect via ssh and fill your playlist from there.
For a remote session to work in any mpd client that can't use a preconfigured ssh you must allow the client to connect to the configured control port on your remote mpd instance (default: 6600) by disabling or configuring any firewalls between them.

TroubleshootingEdit

If you have mpd and mpc installed on the client and can't get it to play the remote stream or the stream breaks up after a few seconds, create an executable shell script called something like "plaympd.sh" on the client computer with the following contents and run it from a terminal:
#!/bin/bash
#Contributed by Kitrule 22:17, February 24, 2010 (UTC)

host=192.169.0.1
port=8000

if [ ! -r "/var/run/mpd/pid" ] || [ -r "/var/run/mpd/pid" -a -z "`ps p \`cat /var/run/mpd/pid\` | grep \`cat /var/run/mpd/pid\``" ]; then
    echo "MPD Offline!"
    sudo /etc/init.d/mpd start
fi

if [ -z "`mpc playlist`" ]; then
    echo "Playlist empty!"
    echo " * Adding: http://$host:$port"
    mpc add "http://$host:$port"
fi

echo "Playing Stream! Testing mpd status (~10 seconds)"
mpc -q play
sleep 1

for (( i=1; i<=5; i++ )); do
    sleep 1.1
    if [ -z "$step1" ]; then step1=`mpc play | grep "\[playing\]"`
    elif [ -z "$step2" ]; then step2=`mpc play | grep "\[playing\]"`
    else step1="$step2"; step2=`mpc play | grep "\[playing\]"`; fi
    if [ -n "$step2" -a "$step1" == "$step2" ]; then echo "Bug! ($step1 / $step2)"; sudo /etc/init.d/mpd restart; sleep 1; i=1; fi
done
Notes: Replace the host and port at the beginning of the script with those for your remote mpd server.
Replace "sudo" with "gksudo" if you would prefer to execute the script directly from within the Gnome Desktop.

Also on Fandom

Random Wiki