Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTPC setup with remote PHP based video control

Status
Not open for further replies.

CamaroLT

Programmer
Dec 16, 2002
159
0
0
CA
Currently I have a PC built with a video card to export SVideo to my TV. It has a TV tuner as well. The system works perfectly as is, except for one nagging pet-peeve.

The distro I'm using isn't important, but what is important is that the mechanism to select a video to watch doesn't allow to queue multiple videos. The kids enjoy watching short videos (Dorra and Diego) and its just too bothersome to have to go select the next video. On top of that, exposing the keyboard to a 3 and 4 year old is just BEGGING for trouble. heh

So what I'm trying to do is come up with a way to enqueue the videos via web interface from my machine via the web server on the HTPC, all coded in PHP, so the video comes out on my TV, not my web browser.

My kid is watching a video right now, and I'm looking at the process list:

Code:
mplayer -fs -zoom -quiet -vo xv /videos/Kids/TV Shows/Dora the Explorer/Season 2/204 - The Missing Piece.avi

Perfect sense.

I can also launch mplayer via a SSH session so long I execute:

Code:
export DISPLAY=:0
mplayer -fs -zoom -quiet -vo xv "/videos/Kids/TV Shows/Dora the Explorer/Season 2/204 - The Missing Piece.avi"

(Yes I got `yelled` at for restarting his show. heh)

I also found out (sort of) how to work with the -slave -load file={} options, and by using mkfifo (That was a new one to me) and I successfully managed to send a stream of information and managed to queue about 15 videos. Awesome.

However, Apache uses a different user account ( in this case) and shouldn't have access to start throwing video up to display 0. I would expect that. I also am not sure if even has access to the audio devices, but that should be just a simple change in groups and maybe a restart of the system. I just tried now as the user and mplayer was executable, but I get a whoooole lot of errors dealing with the audio device, so a viewing of the groups may be needed.

Code:
vo: couldn't open the X11 display (:0)!
E: client-conf-x11.c: XOpenDisplay() failed
E: authkey.c: Failed to open cookie file '/var/[URL unfurl="true"]www/.pulse-cookie':[/URL] No such file or directory
E: authkey.c: Failed to load authorization key '/var/[URL unfurl="true"]www/.pulse-cookie':[/URL] No such file or directory
AO: [pulse] Failed to connect to server: Connection refused

Security tossed aside, what do I have to do to get a very basic media queuing system that:
A> Launches mplayer if it isn't running, and throw it to display 0
B> Allows me to use the fifo file so that I can have rudimentary control of mplayer to pause, stop, or re-enqueue files.

I'm not looking for full working code of an entire media manager in this post, as I'm looking forward to doing this project on my own. I am, however, looking for help to get over the security boundaries to get video from Apache running on display 0.

Thanks.


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=
NEVER send the boss to do a techs job
 
I would set up a sudo rule allowing the www-data user to call a script as the user that does have access to the audio devices.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top