* memory leaks.
*/
public class VolumeTestPlayer extends VlcjTest {
public static void main(String[] args) throws Exception {
Frame f = new Frame("Test Player");
f.setIconImage(new ImageIcon(VolumeTestPlayer.class.getResource("/icons/vlcj-logo.png")).getImage());
f.setSize(800, 600);
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
f.setLayout(new BorderLayout());
Canvas vs = new Canvas();
f.add(vs, BorderLayout.CENTER);
f.setVisible(true);
MediaPlayerFactory factory = new MediaPlayerFactory();
EmbeddedMediaPlayer mediaPlayer = factory.newEmbeddedMediaPlayer();
mediaPlayer.setVideoSurface(factory.newVideoSurface(vs));
List<File> files = scanMedia(new File("/movies"));
Thread.sleep(3000);
for(File file : files) {
mediaPlayer.playMedia(file.getAbsolutePath());
Thread.sleep(500);
mediaPlayer.setChapter(4);
Thread.sleep(2000);
}
mediaPlayer.stop();
mediaPlayer.release();
factory.release();
f.setVisible(false);
System.out.println("Finished");
// Don't exit so a profiler can connect
}