vlcj仅显示黑屏

时间:2020-04-29 01:55:46

标签: java vlc libvlc vlcj

我解决了previous problem。之后,我编写了启动YouTube播放器的代码。但是,即使创建了窗口,也仅显示黑屏,并且没有声音。我使用Java 8 64位,vlcj-4.4.1,vlcj-natives-4.1.0,jna-5.2.0,jna-platform-5.2.0版本。另外,vlc安装在路径“ C:\ Program Files \ VideoLAN \ VLC”中。我该怎么解决?

public class Video {

    private static final int width = 880, height = 495; //frame.setBounds(0, 200, width, height + 37);
    private final JFrame frame;
    private final CallbackMediaPlayerComponent mediaPlayerComponent;

    public Video(String url) {
        frame = new JFrame("TEST");
        frame.setBounds(0, 200, width, height + 37);

        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                mediaPlayerComponent.release();
                System.exit(0);
            }
        });

        mediaPlayerComponent = new CallbackMediaPlayerComponent();
        frame.setContentPane(mediaPlayerComponent);

        frame.setVisible(true);
        mediaPlayerComponent.mediaPlayer().media().play(url);
    }
} 

0 个答案:

没有答案