9

I'm setting up a computer running OpenBSD that I wish to play all the music I will ever want. I want it to basically set in a corner and do it's thing. The problem with that is that I want to control it from wherever I am. I can do that (though not extremely easily) with ssh from my computer. I think it'd be really cool to control(as in, choose songs, skip, pause, volume control, etc) it from a simple web page so I could access it from my phone, as well as my computer.

So, I'd prefer to use mplayer for this. Is there any way of controlling mplayer from say a PHP script or something similar?

Earlz
  • 62,085
  • 98
  • 303
  • 499
  • If all else fails, use `exec`. – Rafe Kettler Feb 12 '11 at 04:17
  • @Rafe, well, the problem I'm seeing is controlling things like volume from within my script. Things where you can't just simply kill the process and restart it – Earlz Feb 12 '11 at 04:19
  • You can use `mplayer -slave` and set up a fifo node, which in turn could be feeded from a socket handler (inetd script) which could be called remotely by php. – mario Feb 12 '11 at 04:23

2 Answers2

14

http://www.mplayerhq.hu/DOCS/tech/slave.txt

You can start up mplayer in command receival mode. Create a named pipe first:

mkfifo /tmp/mplayercontrol
mplayer -slave -input file=/tmp/mplayercontrol

Which in turn can be controlled via PHP easily:

file_put_contents("/tmp/mplayercontrol", "pause");

If you run mplayer and PHP on the same server, that should already do it.

mario
  • 144,265
  • 20
  • 237
  • 291
6

mplayer has a remote control (slave) interface.

http://www.mplayerhq.hu/DOCS/tech/slave.txt

SpliFF
  • 38,186
  • 16
  • 91
  • 120