问题描述
本人编写一个基于VCL播放器内核的视频播放器,运行过程中遇到如下问题,求解!!!!源代码:packagecom.jikexueyuan.VideoPlayer.main;importjava.awt.EventQueue;importjava.io.File;importjavax.swing.JOptionPane;importuk.co.caprica.vlcj.binding.LibVlc;importuk.co.caprica.vlcj.runtime.RuntimeUtil;importcom.jikexueyuan.VideoPlayer.View.PlayView;importcom.sun.jna.Native;importcom.sun.jna.NativeLibrary;publicclassMainPlayer{staticPlayViewmainwindow;publicstaticvoidmain(String[]args){if(RuntimeUtil.isWindows()){NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(),fixFilename("D:\ProgramFiles\VideoLAN\VLC"));}Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(),LibVlc.class);EventQueue.invokeLater(newRunnable(){publicvoidrun(){try{PlayViewframe=newPlayView();frame.setVisible(true);Filevideo=newFile("E:\java\Android_developer\workspace_android\VideoPlayer\123.mp4");if(video.exists()&&!video.isDirectory()){mainwindow.getMediaPlayer().playMedia(video.getCanonicalPath());}else{JOptionPane.showMessageDialog(null,"文件不存在");}}catch(Exceptione){e.printStackTrace();}}});}publicstaticStringfixFilename(Stringabsp){Filefile=newFile(absp);returnfile.getAbsolutePath();}}packagecom.jikexueyuan.VideoPlayer.View;importjava.awt.BorderLayout;importjava.awt.EventQueue;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.border.EmptyBorder;importuk.co.caprica.vlcj.component.EmbeddedMediaListPlayerComponent;importuk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;importuk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;publicclassPlayViewextendsJFrame{privateJPanelcontentPane;privateEmbeddedMediaPlayerComponentplaycomponent;/***Launchtheapplication.*/publicstaticvoidmain(String[]args){}/***Createtheframe.*/publicPlayView(){setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100,100,450,300);contentPane=newJPanel();contentPane.setBorder(newEmptyBorder(5,5,5,5));contentPane.setLayout(newBorderLayout(0,0));setContentPane(contentPane);JPanelVideopanel=newJPanel();contentPane.add(Videopanel,BorderLayout.CENTER);Videopanel.setLayout(newBorderLayout(0,0));playcomponent=newEmbeddedMediaPlayerComponent();Videopanel.add(playcomponent,BorderLayout.CENTER);}publicEmbeddedMediaPlayergetMediaPlayer(){returnplaycomponent.getMediaPlayer();}}