navigating DVD menu from web interface

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
neilfred
New Cone
New Cone
Posts: 7
Joined: 31 Dec 2006 22:17

navigating DVD menu from web interface

Postby neilfred » 03 Feb 2007 12:22

I'm looking for a way to navigate DVD menus from VLC's web interface. Going through the appendix on customizing the web interface -- http://www.videolan.org/doc/play-howto/en/apb.html -- I couldn't find any way to do it, but it really seems like there should be a macro that would enable http access to all the actions for which hotkeys can be configured on the cmd-line...

Anyone know of a way to do it?

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Postby dionoea » 03 Feb 2007 12:53

I'm not aware of any direct method which can be used to navigate the DVD menus using the web interface.

I'm sure that you could doing using some var_set stuff on one of VLC_OBJECT_ROOT or VLC_OBJET_VLC (i don't know which one is the libvlc object... i'd say ROOT is) and set the "key-pressed" variable using values defined in include/vlc_keys.h . The only issue with this method is that it won't work if you change the default hotkeys. To work arround this issue you can use vlc_config_get on the "key-something" options to get the hotkey code before sending it to VLC using "key-pressed". (So basically you'll need to write a small wrapper which takes a "key-something" string as an argument, looks up the keycode using vlc_config_get and sets "key-pressed" to this value)

If that works and you write a small DVD controller interface (or even a small HTML remote control able to call most VLC keys using simple clicks) please do submit a patch so we can include it in future versions.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

neilfred
New Cone
New Cone
Posts: 7
Joined: 31 Dec 2006 22:17

Postby neilfred » 04 Feb 2007 01:31

Thanks dionoea -- I now have something reasonable working.

I couldn't get the vlc_config_get calls to work to get the right key to use, so for now I've just hard-coded the default keys (arrow keys and enter). I am able to vlc_config_get some of the other cmd-line flags, but none of the key-something config variables seem to exist for me. For example, I get "VLC_VAR_STRING" when I do "sout vlc_config_type", but I get "UNDEFINED" when I do "key-nav-left vlc_config_type" or "key-fullscreen vlc_config_type". I'm on MacOSX if that matters...

In any case, here's my hard-coded-keys solution. Here's the change to status.xml that allows ajax requests to in invoke the relevant key-presses:

Code: Select all

--- requests/status.xml.bak 2006-12-10 04:35:52.000000000 -0800 +++ requests/status.xml 2007-02-03 15:40:44.000000000 -0800 @@ -101,8 +101,27 @@ <vlc id="rpn" param1="val value vlc_seek" /> <vlc id="end"/> + <vlc id="if" param1="command value 'key' strcmp 0 =" /> + <vlc id="if" param1="val value 'nav-left' strcmp 0 =" /> + <vlc id="rpn" param1="keyid 65536 store" /> + <vlc id="end"/> + <vlc id="if" param1="val value 'nav-right' strcmp 0 =" /> + <vlc id="rpn" param1="keyid 131072 store" /> + <vlc id="end"/> + <vlc id="if" param1="val value 'nav-up' strcmp 0 =" /> + <vlc id="rpn" param1="keyid 196608 store" /> + <vlc id="end"/> + <vlc id="if" param1="val value 'nav-down' strcmp 0 =" /> + <vlc id="rpn" param1="keyid 262144 store" /> + <vlc id="end"/> + <vlc id="if" param1="val value 'nav-activate' strcmp 0 =" /> + <vlc id="rpn" param1="keyid 393216 store" /> + <vlc id="end"/> + <vlc id="rpn" param1="keyid value key-pressed 'VLC_OBJECT_VLC' vlc_var_set" /> + <vlc id="end"/> <vlc id="end" /> <root> + <debug><vlc id="value" param1="key-pressed 'VLC_OBJECT_VLC' vlc_var_get" /></debug> <volume><vlc id="value" param1="volume" /></volume> <length><vlc id="value" param1="stream_length" /></length> <time><vlc id="value" param1="stream_time" /></time>
Here's the javascript function to send those ajax requests, along with an unrelated function to enable easier seeking:

Code: Select all

--- js/functions.js.bak 2006-12-10 04:35:52.000000000 -0800 +++ js/functions.js 2007-02-03 16:10:52.000000000 -0800 @@ -1054,3 +1054,15 @@ setTimeout( 'loop_refresh_playlist()', 1 ); } + +function box_seek(seek_val) +{ + if (!seek_val) { seek_val = value('seek_val'); } + seek(seek_val.replace('+','%2B')); +} + +function dvd_nav(btn) +{ + var url = 'requests/status.xml?command=key&val=nav-' + btn; + loadXMLDoc(url, null); +}
And finally, here's the change to the "main" dialog, for both the dvd navigation and the seeking:

Code: Select all

--- dialogs/main.bak 2006-12-10 04:35:52.000000000 -0800 +++ dialogs/main 2007-02-03 16:11:05.000000000 -0800 @@ -95,6 +95,28 @@ <span class="btn_text">Increase Volume</span> </button> </div> + <div style="float:right; margin:5px; text-align:center;"> + <input type="button" value="^" onclick="dvd_nav('up');"/> + <br/> + <input type="button" value="<" onclick="dvd_nav('left');"/> + <input type="button" value="*" onclick="dvd_nav('activate');"/> + <input type="button" value=">" onclick="dvd_nav('right');"/> + <br/> + <input type="button" value="v" onclick="dvd_nav('down');"/> + </div> + <div style="margin:5px;"> + <input type="button" value="-10m" onclick="box_seek('-10m');"/> + <input type="button" value="-1m" onclick="box_seek('-1m');"/> + <input type="button" value="-10s" onclick="box_seek('-10s');"/> + <input type="button" value="+10s" onclick="box_seek('+10s');"/> + <input type="button" value="+1m" onclick="box_seek('+1m');"/> + <input type="button" value="+10m" onclick="box_seek('+10m');"/> + </div> + <div style="margin:5px;"> + <input type="text" size="6" id="seek_val" onkeypress="if( event.keyCode == 13 ) box_seek();" /> + <input type="button" value="seek" onclick="box_seek();"/> + <span style="font-size:67%;">( e.g. "-20sec", "12m42s", "01:13:43", "-12%" ... )</span> + </div> <div id="status"> <span id="state">(?)</span> -

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Postby dionoea » 04 Feb 2007 22:19

how did you try using the vlc_config_get function ? (you might want to try vlc_var_get on the ROOT or VLC object ... it's possible that it could work too)
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

neilfred
New Cone
New Cone
Posts: 7
Joined: 31 Dec 2006 22:17

Postby neilfred » 05 Feb 2007 01:45

Aha, nice. Okay, this is much cleaner, and should support all of the actions that can be customized with the --key-something cmd-line flags, instead of only accepting the DVD nav keys:

Code: Select all

--- requests/status.xml.bak 2006-12-10 04:35:52.000000000 -0800 +++ requests/status.xml 2007-02-04 16:29:20.000000000 -0800 @@ -101,6 +101,9 @@ <vlc id="rpn" param1="val value vlc_seek" /> <vlc id="end"/> + <vlc id="if" param1="command value 'key' strcmp 0 =" /> + <vlc id="rpn" param1="'key-' val value strcat 'VLC_OBJECT_VLC' vlc_var_get key-pressed 'VLC_OBJECT_VLC' vlc_var_set" /> + <vlc id="end"/> <vlc id="end" /> <root> <volume><vlc id="value" param1="volume" /></volume>
Thanks again!

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Postby dionoea » 07 Feb 2007 17:48

great, i'll make a small remote control like page for the http interface (unless someone volunteers to do it).
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Postby dionoea » 10 Feb 2007 00:58

Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

Dantheman2865
New Cone
New Cone
Posts: 1
Joined: 26 Dec 2008 20:50

Re: navigating DVD menu from web interface

Postby Dantheman2865 » 26 Dec 2008 21:07

Has there been any official work on this yet? I tried getting the patch from the trac and the link didn't work. Could we have an update on this please?

ooswald
New Cone
New Cone
Posts: 8
Joined: 09 Jul 2007 18:47

Re: navigating DVD menu from web interface

Postby ooswald » 28 Jan 2009 21:00

Somehow this doesn't work in VLC 0.9.8a... any ideas why?
http://localhost:8080/requests/status.x ... l=nav-left

neilfred
New Cone
New Cone
Posts: 7
Joined: 31 Dec 2006 22:17

Re: navigating DVD menu from web interface

Postby neilfred » 02 Feb 2009 09:31

Okay, finally got this working again. Here's the new patch for requests/status.xml --

Code: Select all

--- requests/status.xml.bak 2009-02-01 23:05:44.000000000 -0800 +++ requests/status.xml 2009-02-01 23:01:11.000000000 -0800 @@ -101,9 +101,8 @@ <vlc id="rpn" param1="val value vlc_seek" /> <vlc id="end"/> <vlc id="if" param1="command value 'key' strcmp 0 =" /> - <vlc id="rpn" param1="'key-' val value strcat 'VLC_OBJECT_VLC' vlc_var_get key-pressed 'VLC_OBJECT_VLC' vlc_var_set" /> + <vlc id="rpn" param1="'key-' val value strcat vlc_config_get key-pressed 'VLC_OBJECT_LIBVLC' vlc_var_set" /> <vlc id="end"/> - <vlc id="end" /> <root> <volume><vlc id="value" param1="volume" /></volume>
And for dialogs/main --

Code: Select all

--- dialogs/main.bak 2009-02-01 23:04:06.000000000 -0800 +++ dialogs/main 2009-02-02 00:24:47.000000000 -0800 @@ -95,6 +95,7 @@ <span class="btn_text">Increase Volume</span> </button> </div> + <div style="float:right; margin:5px; text-align:center;"><input type="button" value="^" onclick="hotkey('nav-up');"/><br/><input type="button" value="<" onclick="hotkey('nav-left');"/><input type="button" value="O" onclick="hotkey('nav-activate');"/><input type="button" value=">" onclick="hotkey('nav-right');"/><br/><input type="button" value="v" onclick="hotkey('nav-down');"/></div> <div id="status"> <span id="state">(?)</span> -

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: navigating DVD menu from web interface

Postby Jean-Baptiste Kempf » 02 Feb 2009 10:21

Can you send this to the main mailing list?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ooswald
New Cone
New Cone
Posts: 8
Joined: 09 Jul 2007 18:47

Re: navigating DVD menu from web interface

Postby ooswald » 02 Feb 2009 21:45

Thanx a lot!

This is now implemented in VLC Controller:
http://forums.slimdevices.com/showthread.php?p=391440

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: navigating DVD menu from web interface

Postby Jean-Baptiste Kempf » 03 Feb 2009 01:09

Can you send this to the main mailing list?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

sleazypornstar
New Cone
New Cone
Posts: 4
Joined: 08 Jan 2010 12:40

Re: navigating DVD menu from web interface

Postby sleazypornstar » 11 Jan 2010 12:56

I just realized this has been a year ago. It seems this change has never been realized, i.e. VLC_OBJECT_VLC is still being used instead of VLC_OBJECT_LIBVLC (I'm on Windows, VLC v1.0.3) Is there any plan on integrating this patch?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: navigating DVD menu from web interface

Postby Jean-Baptiste Kempf » 11 Jan 2010 16:21

Post it to mailing list!
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

neilfred
New Cone
New Cone
Posts: 7
Joined: 31 Dec 2006 22:17

Re: navigating DVD menu from web interface

Postby neilfred » 12 Jan 2010 06:20

Um ... I'm not really clear why you've gone to the effort three times of posting to this forum that someone else should send an email which as far as I can tell you could just as easily send yourself (and likely could have done more easily than posting that request three times). But whatever, I'm perfectly happy to perform a simple copy and paste into an email if it'll get the patch integrated.

However, all three times you've mentioned it, you've neglected to explain what list you mean when you say "the main mailing list". Since I'm not on any VLC-related mailing lists, I have no way of knowing which is the one that people commonly refer to as the "main" one. With a little bit of poking around, I found http://mailman.videolan.org/ which lists 23 mailing lists, and to my eye, not knowing anything more than what's on that page and a little common sense about mailing lists, there are at least 3 lists which seem quite believable candidates for the "main" one...

quu
Blank Cone
Blank Cone
Posts: 55
Joined: 14 Jul 2010 19:09

Re: navigating DVD menu from web interface

Postby quu » 03 Aug 2010 23:13

I am looking for a way to do this (control dvd through the web)

is this still the "best" way to do it, or would it be easier now that lua-http is the default http interface? and would any of these tricks work with a "skin" ie can i fake keyboard commands in a skin with buttons?


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 45 guests