请查看以下代码
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");
}
}
此代码应该使用VLCJ播放媒体。但它不是,它只是打开一个空白窗口,没有视频,没有声音的框架。有什么问题?请帮忙
答案 0 :(得分:2)
根据@Yohan的要求:尝试使用正确版本的VLCJ库和正确版本的libVLC库。请参阅http://code.google.com/p/vlcj/wiki/WhichVersion