Add video to JPanel

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
lefish
Blank Cone
Blank Cone
Posts: 32
Joined: 23 Jun 2008 04:58

Add video to JPanel

Postby lefish » 27 Jun 2008 11:30

Hey, i tried to add video to a jpanel, it's not always works. Sometimes it jumpes a new JFrame, but when i double clicked it, it jumped a new JFrame all the time.
btw, my os is windows xp and jvlc version is 0.8.6a. Anybody have idea on this? Thanks a lot.
Here is my code:

Code: Select all

import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; import org.videolan.jvlc.JVLC; import org.videolan.jvlc.JVLCPanel; import org.videolan.jvlc.Playlist; import org.videolan.jvlc.VLCException; /** * Play video and audio. * * @author Administrator * */ public class JVLCMain { public JVLCMain() { } /** * @param args */ public static void main(String[] args) { JFrame jframe = new JVLCPlayerFrame(args); jframe.setBounds(0, 0, 500, 500); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setVisible(true); } } // TODO need to be fixed. /** * Player's frame. * * @author Administrator * */ class JVLCPlayerFrame extends JFrame { private static final long serialVersionUID = 1L; private JVLCPanel jvcc; private JVLC jvlc; private Playlist playList; public JVLCPlayerFrame(String[] args) { initialize(args); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } play(); } /** * Initialize components. */ public void initialize(String[] args) { jvcc = new JVLCPanel(args); jvlc = jvcc.getJVLCObject(); playList = jvlc.playlist; setLayout(new BorderLayout()); jvcc.setLayout(new BorderLayout()); jvcc.add(new JButton("123123132"), BorderLayout.NORTH); add(jvcc, BorderLayout.CENTER); pack(); } public void play() { try { playList.add("file://d:/rtsp/aa.avi", ""); playList.play(-1, null); } catch (VLCException e) { e.printStackTrace(); } } }

contablimize
New Cone
New Cone
Posts: 1
Joined: 09 Jul 2008 20:28

Re: Add video to JPanel

Postby contablimize » 09 Jul 2008 20:30

I have the same problem with a similar program as well as the SwingClient sample. Any suggestions would be appreciated.


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: Google [Bot] and 33 guests