java eclipse vlcj java本机访问(jna)

k75qkfdt  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(254)

我正在尝试在java上用vlcj播放视频。当我尝试运行时,我在控制台上收到此消息,并且框架没有打开。
java native access(jna)api版本3版本:3.5.2(b66)本机:3.5.0(60417F69D77E4D8D693B3391A4A5B91)前缀:win32-amd64
这是我的密码:

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;

public class App extends JFrame`{

private static final long serialVersionUID = 1L;
   private static final String TITLE = "My First Media Player";
   private static final String VIDEO_PATH = "C:\\videos\\video.mp4";
   private final EmbeddedMediaPlayerComponent mediaPlayerComponent;
   private JButton playButton;

   public App(String title) {
      super(title);
      mediaPlayerComponent = new EmbeddedMediaPlayerComponent();        
   }
   public void initialize() {
      this.setBounds(100, 100, 600, 400);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      this.addWindowListener(new WindowAdapter() {
         @Override
         public void windowClosing(WindowEvent e) {
            mediaPlayerComponent.release();
            System.exit(0);
         }
      });       
      JPanel contentPane = new JPanel();
      contentPane.setLayout(new BorderLayout());     
      contentPane.add(mediaPlayerComponent, BorderLayout.CENTER);

      JPanel controlsPane = new JPanel();
      playButton = new JButton("Play");
      controlsPane.add(playButton);     
      contentPane.add(controlsPane, BorderLayout.SOUTH);
      playButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            mediaPlayerComponent.getMediaPlayer().play();;
         }
      });        
      this.setContentPane(contentPane);
      this.setVisible(true);
   }
   public void loadVideo(String path) {
     // mediaPlayerComponent.getMediaPlayer()
   }
   public static void main( String[] args ){
      try {
         UIManager.setLookAndFeel(
         UIManager.getSystemLookAndFeelClassName());
      } 
      catch (Exception e) {
         System.out.println(e);
      }
      App application = new App(TITLE);
      application.initialize(); 
      application.setVisible(true);  
      application.loadVideo(VIDEO_PATH);
   }

}
我的库:
vlcj-3.0.1震击器jna-3.5.2
我的dll:
libvlc.dll 32位和jde 32位已更改,libs 32位、dll 32位

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题