PeakGen
PeakGen

Reputation: 23025

VLCJ doesn't play video

Please have a look at the following code

import com.sun.jna.Native;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

import com.sun.jna.NativeLibrary;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class Tutorial2B {

  private final EmbeddedMediaPlayerComponent mediaPlayerComponent;

  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        new Tutorial2B();
      }
    });
  }

  private Tutorial2B() {

      NativeLibrary.addSearchPath(
      RuntimeUtil.getLibVlcLibraryName(), "c:/program files/videolan/vlc"
    );
    Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);

    JFrame frame = new JFrame("vlcj Tutorial");

    mediaPlayerComponent = new EmbeddedMediaPlayerComponent();

    frame.setContentPane(mediaPlayerComponent);

    frame.setLocation(100, 100);
    frame.setSize(1050, 600);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

    System.out.println("Running");

    mediaPlayerComponent.getMediaPlayer().playMedia("I:/YouTube (1).mp4");
  }
}

This code supposed to play the media using VLCJ. But it is not, it is just opening the frame with a blank window, no video, no sounds. Whats the problem? Please help

Upvotes: 2

Views: 2936

Answers (1)

ee.
ee.

Reputation: 957

As requested by @Yohan: Try to use the correct version of VLCJ library with the correct version of libVLC library. Please refer to http://code.google.com/p/vlcj/wiki/WhichVersion

Upvotes: 2

Related Questions