You are not logged in.

#1 2011-12-29 23:44:13

SquirrelCZECH
Member
Registered: 2011-12-28
Posts: 12

PHP, Chromium and VLC [Solved]

Hello
I made little web based (PHP) library of my multimedia files, but i need one thing to fulfill it
is there anyway to launch my vlc player?

I know there is way how to launch Ubuntu Software Center in Ubuntu via web-link, so i think there must be a way to do the same with VLC....

Thanks for suggestions :-)

SOLUTION:

Squirrel wrote:

oh, i founded it, FINALLY, so thanks from all that they helped me, there is final solution:

at first, you must allow to apache (for me user "http") to access your x-server, so I used this:

xhost +local:http

xhost is utility to set access rules to x-server, local means that it will only acept localhost and http is obviously the user.

and now we can choose:
1) pure PHP:

<?php exec("vlc"); ?>

2) cgi script:
test.html

<object data="./cgi-bin/runVLC.cgi"></object>

./cgi-bin/runVLC.cgi

 #!/bin/bash
vlc

both ways worked for me and launched my VLC player, thanks for help

Last edited by SquirrelCZECH (2012-01-04 19:58:45)

Offline

#2 2012-01-01 14:16:57

dist0rted
Member
Registered: 2011-07-15
Posts: 4

Re: PHP, Chromium and VLC [Solved]

Typing 'vlc' at the command line should start it if you can get to a terminal emulator like xterm.  I don't know what window manager you're using, but most of them allow you to create shortcuts by right-clicking on the desktop.  In KDE it would be Right Click -> Create New -> Link to Application -> Click on the Application Tab -> Enter 'vlc' into the Text Box labelled 'Command:'.  Others like Fluxbox you'd have to look up how to edit your Menu on its official site or Google.  In Fluxbox you have to edit the 'menu' file in the '/home/<username>/.fluxbox' directory.

If you're referring to how to start VLC player with it loading your web-based files automatically or something similar to that, I don't know lol.  I hope this helps!

Last edited by dist0rted (2012-01-01 14:26:21)

Offline

#3 2012-01-01 22:04:14

RichAustin
Member
From: Wakefield, Yorkshire, England
Registered: 2011-07-27
Posts: 186

Re: PHP, Chromium and VLC [Solved]

There is this http://wiki.videolan.org/Documentation: … /http_intf but not sure if it will help, never tried it myself, but it does mean you can have a browser as the interface.

Last edited by RichAustin (2012-01-01 22:04:36)

Offline

#4 2012-01-02 11:35:39

SquirrelCZECH
Member
Registered: 2011-12-28
Posts: 12

Re: PHP, Chromium and VLC [Solved]

ouch,.... sorry, i am not native english speaker so i wrote it bad...

my idea is that:

"i click on <a> on my localhost web page and it launch vlc on my computer with movie"

i tried to use <?php exec("DISPLAY=:0,0 vlc");?> but nothing happened

i have web-based movie library and only thing to finish it is to have possibility to launch vlc from web interface

P.S: vlc's web interface is not exactly the thing... but thanks anyway

Offline

#5 2012-01-02 13:37:10

SquirrelCZECH
Member
Registered: 2011-12-28
Posts: 12

Re: PHP, Chromium and VLC [Solved]

http://pastebin.com/VBHdXgZF here is the script's code, external .js only contains scripts for animation which are not necessary

Offline

#6 2012-01-04 00:05:29

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,804
Website

Re: PHP, Chromium and VLC [Solved]

Squirrel,

I'm no good with PHP, but I have tinkered with some other server-side scripting.  If this all on the same machine you should be able to use a bash cgi-script to launch VLC.

the HTML tag

<object data="./cgi-bin/runVLC.cgi"

and the script

#!/bin/bash
vlc

work on my system so that when I navigate to the html page with that object VLC runs.  I have not tried passing parameters, but that should be easy enough.

Of course this would only work on your own machine - ie the server is on the same computer you wish to run vlc on.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#7 2012-01-04 18:51:37

SquirrelCZECH
Member
Registered: 2011-12-28
Posts: 12

Re: PHP, Chromium and VLC [Solved]

thanks for advice, but it didn't worked..... that html page just displayed what is in runVLC.cgi
test.php:

<object data="./runVLC.cgi"></object>

runVLC.cgi

#!/bin/bash
vlc

but to be honest i never heard about cgi-scripts before, is there something i should set on http.conf?

P.S: when i treid that .cgi in command line, vlc starts just fine

Last edited by SquirrelCZECH (2012-01-04 18:51:59)

Offline

#8 2012-01-04 19:01:02

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,804
Website

Re: PHP, Chromium and VLC [Solved]

Oops ... how'd I not finish that tag.  Friends don't let friends code drunk.

There are many good sites out there for cgi-scripting.  I'm a *complete* noob on this stuff though.  I just recently set up a LAMP on my home computer just to tinker and learn.  I followed the arch wiki to the letter and it went pretty smoothly.  I haven't had much time to experiment or learn much yet - but when I saw this thread I figured I'd give it a shot.  It did work on my system, but as they say, even a blind mouse will find the cheese once and a while.

I can't really give much guidance except to say it can be done.  One thing that may be relevant is that (I believe) the server needs to be restarted before the cgi script will run.

I'm sure there are many experienced people here who can give better insights into exactly what configs to check and what needs to be running.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#9 2012-01-04 19:13:27

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,804
Website

Re: PHP, Chromium and VLC [Solved]

I know there is a line in a http.conf or something similar that defines where the scripts are stored ... I don't remember details though.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#10 2012-01-04 19:36:16

SquirrelCZECH
Member
Registered: 2011-12-28
Posts: 12

Re: PHP, Chromium and VLC [Solved]

It works now... cgi script was executed, i hope so because this time test.php didn't show a thing big_smile
but, vlc do not showed up, i think the reason may be same as with command();

the script/command is launched by daemon which is "http"... and i am different user...
i tried to setup in command(); screen before but still nothing, and i can't find a way how to test runnig something as user "http"... (for some reason "su" do not helped)....

Last edited by SquirrelCZECH (2012-01-04 19:41:39)

Offline

#11 2012-01-04 19:57:02

SquirrelCZECH
Member
Registered: 2011-12-28
Posts: 12

Re: PHP, Chromium and VLC [Solved]

oh, i founded it, FINALLY, so thanks from all that they helped me, there is final solution:

at first, you must allow to apache (for me user "http") to access your x-server, so I used this:

xhost +local:http

xhost is utility to set access rules to x-server, local means that it will only acept localhost and http is obviously the user.

and now we can choose:
1) pure PHP:

<?php exec("vlc"); ?>

2) cgi script:
test.html

<object data="./cgi-bin/runVLC.cgi"></object>

./cgi-bin/runVLC.cgi

 #!/bin/bash
vlc

both ways worked for me and launched my VLC player, thanks for help

Offline

#12 2013-12-16 18:39:59

bimapanduw
Member
Registered: 2013-12-16
Posts: 1

Re: PHP, Chromium and VLC [Solved]

it's didn't works for me.. sad

and i tried :

echo exec("vlc");

result : > Shutting down.

i need suggestions.. thanx..

Offline

Board footer

Powered by FluxBB