Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to control mplayer from another program easily?

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?

like image 243
Earlz Avatar asked Feb 12 '11 04:02

Earlz


2 Answers

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.

like image 161
mario Avatar answered Oct 19 '22 11:10

mario


mplayer has a remote control (slave) interface.

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

like image 24
SpliFF Avatar answered Oct 19 '22 11:10

SpliFF