1 import java.awt.Canvas;
4 import java.awt.event.WindowAdapter;
5 import java.awt.event.WindowEvent;
7 import javax.swing.JPanel;
9 import org.videolan.jvlc.JVLC;
11 /*****************************************************************************
12 * MultipleVideosSample.java: VLC Java Bindings
13 *****************************************************************************
14 * Copyright (C) 1998-2008 the VideoLAN team
16 * Authors: Filippo Carone <filippo@carone.org>
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
34 *****************************************************************************/
36 public class MultipleVideosSample
39 private static int videosNumber = 6;
40 private static String filename ="/home/carone/a.avi";
42 public static void main(String[] args) throws Exception
44 Frame frame = new java.awt.Frame();
45 frame.setBounds(0, 0, 600, 700);
46 JPanel jvcc = new JPanel();
47 Canvas[] videoCanvasesArray = new Canvas[videosNumber];
55 for (int i = 0; i < videosNumber; i++)
57 Canvas jvlcCanvas = new Canvas();
58 videoCanvasesArray[i] = jvlcCanvas;
59 jvlcCanvas.setSize(200, 200);
60 jvlcCanvas.setBackground(new Color(0x0));
64 frame.addWindowListener(new WindowAdapter()
68 public void windowClosing(WindowEvent ev)
74 frame.setVisible(true);
75 JVLC[] jvlcArray = new JVLC[videosNumber];
76 for (int i = 0; i < videosNumber; i++)
78 JVLC jvlc = new JVLC();
80 jvlc.setVideoOutput(videoCanvasesArray[i]);
83 for (int i = 0; i < videosNumber; i++)
85 jvlcArray[i].play(filename);
86 jvlcArray[i].setVideoOutput(videoCanvasesArray[i]);