caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.13k stars 260 forks source link

Is possible open lua funtions? #510

Closed jmanuel1609 closed 8 years ago

jmanuel1609 commented 8 years ago

Hi: Is possible set the vlc instance for lua files? i need run some lua scripts in java. i can open and run Lua functions using luaj. but i create a file into vlc/lua/extensions but i need set vlc instance.. that is possible? Lua file

for example i need to run this test
function getTime()
   local input=vlc.object.input()
   if input then 
     return vlc.var.get(input,"time") 
   else return 0
end

vlc instance is null. In java

 private void test() {
             String path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\lua\\extensions\\test.lua";
             LuaValue _G = JsePlatform.standardGlobals();
             _G.get("dofile").call( LuaValue.valueOf(path));

             LuaValue MyAdd = _G.get("getTime");
             try {
                 LuaValue retvals = MyAdd.call();
                 System.out.println(retvals.tojstring(1));
            } catch (Exception e) {
                // TODO: handle exception
                logger.error(e);
            }

        }
jmanuel1609 commented 8 years ago

can I initialize LUA plugins using " --lua-intf" example:

 mediaPlayerComponent = new EmbeddedMediaPlayerComponent() {
            @Override
            protected String[] onGetMediaPlayerFactoryExtraArgs() {
                return new String[] {"--no-osd","--lua-intf:plugin.lua"};
            }
        };
caprica commented 8 years ago

In your first question you're asking me about luaj and why the vlc reference is null - that is outside the scope of this project, ask the luaj people.

On your second question, yes you can initialise the LUA plugin interface, but you can not interact with them through LibVLC/vlcj. LUA scripts are used e.g. to parse the YouTube web page looking for the real streaming link. All of that happens behind the scenes and you can not interact with it explicitly from your own program.

caprica commented 8 years ago

I may be wrong, but I have to say something so that you do not waste any more time, it looks to me like you may still be flogging this dead horse regarding jumping to a specific frame.

You can NOT do it. VLC does NOT support it.

If VLC fundamentally does not support it, why do you think using the LUA interface to VLC will work. It clearly can not, it's just an interface.