Search code examples
javavlcj

VLCJ-Pro Java returned: -57005


My task is to play multiple videos with a linked time scrubber in a grid, and I've gotten it to work (WITH VLCJ NOT VLCJ-PRO), but it is VERY finicky.

So I decided to give VLCJ-Pro a try, but I'm getting an error on the first line.

22:25:25.614 [main] INFO  u.c.c.vlcj.discovery.NativeDiscovery - Discovery 
found libvlc at 'D:\VLC'
C:\Users\trans\AppData\Local\NetBeans\Cache\8.2\executor-
snippets\run.xml:53: Java returned: -57005
BUILD FAILED (total time: 0 seconds)

VLCJ-Pro is supposed to help with VLCJ's multi-video problems (native library crashes happen alot). So I figured I'd see if it helped with stability, but I can't even get it to run.

VLCJ-Pro Download Location

Here is my entire code I'm using to test the library. I'm using Netbeans as my IDE and I've added ALL the JAR libraries in the example code.

If you have any experience with VLCJ-Pro I would greatly appreciate any feedback on how I'm going wrong.

package vlcjprodemo;

import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
import uk.co.caprica.vlcj.version.LibVlcVersion;
import uk.co.caprica.vlcjpro.client.player.OutOfProcessMediaPlayer;
import uk.co.caprica.vlcjpro.client.player.OutOfProcessMediaPlayerComponent;
import uk.co.caprica.vlcjpro.client.player.OutOfProcessMediaPlayerComponentFactory;

public class VLCJProDemo {

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {

    new NativeDiscovery().discover();
    LibVlcVersion.getVersion();

    //CRASHES HERE
    OutOfProcessMediaPlayerComponentFactory theFactory = new OutOfProcessMediaPlayerComponentFactory();
    OutOfProcessMediaPlayerComponent theComponent = theFactory.newOutOfProcessMediaPlayerComponent();

    Canvas theVideoCanvas = new Canvas();
    theVideoCanvas.setFocusable(true);
    theVideoCanvas.setSize(new Dimension(1920, 1080));
    theVideoCanvas.setLocation(0, 0);

    theComponent.setVideoSurface(theVideoCanvas);

    OutOfProcessMediaPlayer theMediaPlayer = theComponent.mediaPlayer();
    theMediaPlayer.setRepeat(true);      

    JFrame mainFrame = new JFrame();
    mainFrame.setLayout(new BorderLayout());
    mainFrame.setBackground(Color.black);
    mainFrame.setMaximumSize(new Dimension(1920, 1080));
    mainFrame.setPreferredSize(new Dimension(1920, 1080));
    mainFrame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
    mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    mainFrame.add(theVideoCanvas);
    mainFrame.pack();
    mainFrame.setVisible(true);

    theMediaPlayer.playMedia("horse.avi");
}
}

Solution

  • Probably you are trying to use a trial/demo version of vlcj-pro that has expired.

    If so, you need to wait until a new trial version is published.