H264 player with vlcj in a vision component

#1

Hello,
I try to embed a video player (h264 compliant) based on vlcj in a vision component.
I would like to modify the “ComponentExample_Client” provided with the SDK.

My start point :
Install VLC for windows : [url]http://www.videolan.org/vlc/index.html[url]
I use vlcj : http://www.capricasoftware.co.uk/vlcj/

I try to embed the following example which work very well in a java application,
into the “ComponentExample_Client” :

/*
* This file is part of VLCJ.
*
* VLCJ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VLCJ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2009, 2010, 2011, 2012 Caprica Software Limited.
*/

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;

/**
* Minimal quick-start example.
*/
public class Example1 {

    private final JFrame frame;
    
    private final EmbeddedMediaPlayerComponent mediaPlayerComponent;
    
    public static void main(String[] args) {
        final String mrl = args[0];
        
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Example1().start(mrl);
            }
        });
    }
    
    public Example1() {
        mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
        
        frame = new JFrame("vlcj quickstart");
        frame.setLocation(50, 50);
        frame.setSize(1400, 800);
        frame.setContentPane(mediaPlayerComponent);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
    
    private void start(String mrl) {
        mediaPlayerComponent.getMediaPlayer().playMedia(mrl);
    }
}

To test this example directly in Eclipse, we need to specify the path to the VLC dll as follow :
-Djna.library.path=“C:/Program Files/VideoLAN/VLC”
and to add the followinf jar to the build path : jna-3.4.0.jar, vlcj-2.1.0.jar, platform-3.4.0.jar

:scratch: Could you please help me to modify the HelloWorldComponent.java
May i override the paintComponent method ?
How to add the jna.library.path and external jar ?

0 Likes

#2

Any idea ?
is there a way to add this component into an abstractVisionComponent ?

0 Likes

#3

Hello,

Finally could you do this? how is the state of this tests?

We are in the same situation…

Thank you,

0 Likes