使用 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"); }}
1 回答
慕容森
TA贡献1853条经验 获得超18个赞
// toggle pause
mediaPlayerComponent.mediaPlayer().controls().pause();
// explicitly set paused
mediaPlayerComponent.mediaPlayer().controls().setPause(true);
// play
mediaPlayerComponent.mediaPlayer().controls().play()
添加回答
举报
0/150
提交
取消