Remote Control (from the webpage) for a Media Player on remote machine?
I just want a interface like a controller which can control "Play/Pause/Stop/ ..etc" for some kind of player (Flash or anything else) playing on a remote server, across "HTTP" under same domain.
With simple words, i just wanna control a video playing on a remote machine, but "controller" side must be on a webpage.
+++++++ Web Server ++++++++ <---<---< +++++++ Client Web Page +++++++++ +++++ PLAYING VIDEO ++++++++ .............. ++++ with REMOTE CONTROL +++++++ +++++++++++++++++++++++ ............... +++[ PLAY / STOP / NEXT / PREV ]+++++
- Is it possible?
- Player playing over server will be displaying on a "Web Page" normally but.. is it possible for some kind of "Desktop Player" ?
- For Webpage, which "Player" should i use, A Flash Player (like, Flowplayer) / A Plugin (like, VLC Plugin) ?
P.S: Prefer "PHP" for server side
Yes this can be done with VLC:
Click: View -> Add Interface -> Web Interface Then Visit http://127.0.0.1:8080 in your browser, the first page controls the playback of the binary player (Like a remote control).
Also a neat little feature is the flash player: http://127.0.0.1:8080/flash.html it will stream the video on the page with Flow Player, im pretty sure thats what your looking for. Visit the link below for more info about setting it up and the various options. wiki.videolan.org/Interface
Yes you can do this with the help of Ajax + jPlayer.
Essentially what you are going to want to do is set up jPlayer on page1 to keep calling a php file on your backend that checks for any new commands. Here it is a pseudo code, if you need more help I can write actual code that does it.
- calls api.php every 5 seconds and expects a JSON obj back
- has functions setup to pass commands received from the AJAX call to jPlayer
- Has buttons/links/whatever that call api.php and set
- 2 purposes, set and retrieve data
- When asked to set data it writes a command to the DB
- When asked to retrive data is queries the DB for all un-run queries (Field that is true/false) and then updates the DB to set those command to "ran" so that they are only executed once
Here is how it would look in practice
- page1 is loaded and video starts playing while checking api.php every 5 seconds via AJAX
- page2 calls api.php and tells it to pass on the command "pause"
- api updates the DB with the command "pause"
- page1's AJAX call hits api.php which in turn checks the DB, returns "pause", then updated the DB the mark "pause" as already ran
Of course know that you will need to protect against SQL injection via api.php as you don't want some attacker to send a fake command to api.php. To protect against this I would suggest whitelisting commands (play, pause, next, prev, skip to, etc) so that there is a limit to what your script is capable of.