请看下面的代码
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 播放媒体。但事实并非如此,它只是用空白窗口打开框架,没有视频,没有声音。有什么问题?请帮忙