如何在 vlcj 上暂停和播放视频?

使用 java swing 播放视频有效,但使用andvlcj暂停,则无效。jbuttonpaused()


package tutorial;


import java.awt.BorderLayout;


import javax.swing.JFrame;

import javax.swing.JPanel;


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


public class Tutorial {


    public static void main(String[] args) {

        JFrame frame = new JFrame("My First Media Player");

        frame.setBounds(100, 100, 600, 400);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


        JPanel panel = new JPanel();

        panel.setLayout(new BorderLayout());


        EmbeddedMediaPlayerComponent mediaPlayerComponent = new EmbeddedMediaPlayerComponent();

        panel.add(mediaPlayerComponent, BorderLayout.CENTER);


        frame.setContentPane(panel);

        frame.setVisible(true);


        mediaPlayerComponent.mediaPlayer().media().play("C:\\Users\\USER\\Desktop\\Rex Orange County.mp4");

    }

}


Smart猫小萌
浏览 135回答 1
1回答

慕容森

// toggle pausemediaPlayerComponent.mediaPlayer().controls().pause(); // explicitly set pausedmediaPlayerComponent.mediaPlayer().controls().setPause(true);// playmediaPlayerComponent.mediaPlayer().controls().play()
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java