vlcj loop
来源:互联网 发布:红帽系统yum源 编辑:程序博客网 时间:2024/05/29 15:37
If you refer to VLC sample uk.co.caprica.vlcj.test.list.TestMediaListEmbeddedPlayer from vlcj-1.2.0-test.jar distribution, this is how it is done:
/** * Example showing how to combine a media list player with an embedded media * player. */public class TestMediaListEmbeddedPlayer extends VlcjTest { public static void main(String[] args) throws Exception { MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(); Canvas canvas = new Canvas(); canvas.setBackground(Color.black); CanvasVideoSurface videoSurface = mediaPlayerFactory.newVideoSurface(canvas); EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer(); mediaPlayer.setVideoSurface(videoSurface); MediaListPlayer mediaListPlayer = mediaPlayerFactory.newMediaListPlayer(); mediaListPlayer.addMediaListPlayerEventListener(new MediaListPlayerEventAdapter() { @Override public void nextItem(MediaListPlayer mediaListPlayer, libvlc_media_t item, String itemMrl) { System.out.println("nextItem()"); } }); mediaListPlayer.setMediaPlayer(mediaPlayer); // <--- Important, associate the media player with the media list player JPanel cp = new JPanel(); cp.setBackground(Color.black); cp.setLayout(new BorderLayout()); cp.add(canvas, BorderLayout.CENTER); JFrame f = new JFrame("vlcj embedded media list player test"); f.setIconImage(new ImageIcon(TestMediaListEmbeddedPlayer.class.getResource("/icons/vlcj-logo.png")).getImage()); f.setContentPane(cp); f.setSize(800, 600); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); MediaList mediaList = mediaPlayerFactory.newMediaList(); String[] options = {}; mediaList.addMedia("C:\\Documents and Settings\\DEVELOPER\\Desktop\\videoplayback1.mp4", options); mediaList.addMedia("C:\\Documents and Settings\\DEVELOPER\\Desktop\\videoplayback2.mp4", options); mediaListPlayer.setMediaList(mediaList); mediaListPlayer.setMode(MediaListPlayerMode.LOOP); mediaListPlayer.play(); // This looping is just for purposes of demonstration, ordinarily you would // not do this of course for(;;) { Thread.sleep(500); mediaPlayer.setChapter(3); Thread.sleep(5000); mediaListPlayer.playNext(); } // mediaList.release(); // mediaListPlayer.release(); // mediaPlayer.release(); // mediaPlayerFactory.release(); }}
阅读全文
0 0
- vlcj loop
- loop
- loop
- Loop
- loop
- Loop & Loop
- vlcj-java写个播放器
- vlcj--java-制作视频播放器
- windows下(java环境)配置最新版的vlcj
- JavaWeb 中调用vlcj总是找不到.dll文件
- PLI Loop
- busy loop
- Joseph Loop
- Tsql loop
- Free Loop
- Foreach Loop
- Free loop
- loop设备
- 点云数据处理学习笔记
- Python- 时间格式的相互转换
- java.io.IOException: Error running exec(). Command: [/system/xbin/su] Working Directory: null Enviro
- String,StringBuffer,StringBuilder
- 阿里云服务器被入侵挂上了wnTKYg挖矿程序解决办法
- vlcj loop
- 感知机perceptron-机器学习ML
- 用WebMagic框架写一个简单的爬虫
- 七.ARM裸机学习之SDRAM
- 矛与盾:二进制漏洞攻防思想对抗
- 容器
- log4j 指定类输出到指定位置
- 浅析TCP/IP协议
- 还原二叉树(25 分)