一共两个类,第二个是界面,看别人视频做的,结果视频播放不了,求解答。
public class PlayMain {
static MainWindow frame;
public static void main(String[] args) {
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "D:\\Program Files\\VideoLAN\\VLC");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frame = new MainWindow();
frame.setVisible(true);
frame.getMediaPlayer().playMedia("D:\\视频\\123.mkv");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
public class MainWindow extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
EmbeddedMediaPlayerComponent playerComponent;
/**
* Launch the application.
*/
public static void main(String[] args) {
/* EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainWindow frame = new MainWindow();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});*/
}
/**
* Create the frame.
*/
public MainWindow() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 592, 430);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
JPanel videopane = new JPanel();
contentPane.add(videopane, BorderLayout.CENTER);
videopane.setLayout(new BorderLayout(0, 0));
//videopane.setLayout(new BorderLayout(0, 0));
playerComponent = new EmbeddedMediaPlayerComponent();
videopane.add(playerComponent);
}
public EmbeddedMediaPlayer getMediaPlayer(){
return playerComponent.getMediaPlayer();
}
}