Page 1 of 1

JVLC Canvas on Vista

Posted: 09 Aug 2008 10:21
by mkeuschn
Hello *,

I got following error:

Code: Select all

[00000001] main libvlc debug: VLC media player - version 0.9.0-test3-20080727-0004 Grishenko - (c) 1996-2008 the VideoLAN team [00000001] main libvlc debug: libvlc was configured with ./configure '--enable-debug' '--host=i586-mingw32msvc' '--build=i386-linux' '--enable-shared-libvlc' '--enable-sdl' '--with-sdl-config-path=/usr/win32/bin' '--disable-gtk' '--disable-hal' '--disable-libcdio' '--enable-nls' '--enable-skins2' '--enable-ffmpeg' '--with-ffmpeg-mp3lame' '--with-ffmpeg-faac' '--with-ffmpeg-zlib' '--with-ffmpeg-config-path=/usr/win32/bin' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-dvdread' '--disable-vcdx' '--disable-cddax' '--enable-mozilla' '- [00000001] main libvlc debug: translation test: code is "C" Exception in thread "main" java.lang.IllegalStateException: Component must be displayable at com.sun.jna.Native.getComponentID(Native.java:159) at org.videolan.jvlc.JVLC.setVideoOutput(JVLC.java:90) at at.uniklu.unikluni.client.gui.JVLCPanel.<init>(JVLCPanel.java:64) at at.uniklu.unikluni.client.gui.JVLCPanel.main(JVLCPanel.java:128)
when I try to run this java code:

Code: Select all

package at.uniklu.unikluni.client.gui; import java.awt.Canvas; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import org.videolan.jvlc.Audio; import org.videolan.jvlc.JVLC; import org.videolan.jvlc.MediaDescriptor; import org.videolan.jvlc.MediaList; import org.videolan.jvlc.MediaListPlayer; import org.videolan.jvlc.MediaPlayer; import org.videolan.jvlc.Video; import at.uniklu.unikluni.client.listener.ClientMediaPlayerListener; public class JVLCPanel extends JComponent { private static final long serialVersionUID = -3316671696374369195L; private static final String[] vlcArguments = new String[] {"--plugin-path=lib\\plugins"}; private Video video; private Audio audio; private MediaDescriptor mediaDescriptor; private MediaPlayer player; private JVLC jvlc; private JVLCCanvas jvlcCanvas; /** * Constructor. * @param source (e.g.: "C:/11-eclipseWorkspace/test-videos/t-en.mpg") * @param number * @param width * @param height */ public JVLCPanel(String source, int width, int height) { super(); super.setSize(width, height); //jvcc = new JVLCCanvas(width, height); //jvcc.setVisible(true); //this.add(jvlcCanvas); Canvas jvcc = new Canvas(); jvcc.setSize(width, height); jvcc.setVisible(true); this.add(jvcc); //jvlc = jvlcCanvas.getJVLC(); jvlc = new JVLC(vlcArguments); mediaDescriptor = new MediaDescriptor(jvlc, source); player = mediaDescriptor.getMediaPlayer(); player.addListener(new ClientMediaPlayerListener()); video = new Video(jvlc); audio = new Audio(jvlc); // video.setSize(width, height); //if (jvcc.isDisplayable()) { jvlc.setVideoOutput(jvcc); //} this.play(); } /** * Set new source to play. * @param source */ public void setSource(String source) { mediaDescriptor = new MediaDescriptor(jvlc, source); stop(); player = null; player = mediaDescriptor.getMediaPlayer(); } /** * Start player. */ public void play() { player.play(); } /** * Stop player. */ public void stop() { player.stop(); } /** * Set mute. * @param mute */ public void setMute(boolean mute) { audio.setMute(mute); } /** * Set volume. * @param volume */ public void setVolume(int volume) { audio.setVolume(volume); } /** * Return JVLC. * @return */ public JVLC getJVLCObject() { return jvlc; } /** * Set window size. */ public void setSize(int width, int height) { super.setSize(width, height); video.setSize(width, height); } public static void main (String[] args) { JVLCPanel jp = new JVLCPanel("C:/11-eclipseWorkspace/test-videos/t-en.mpg", 640, 480); jp.setVisible(true); JVLCPanel jp2 = new JVLCPanel("C:/11-eclipseWorkspace/test-videos/t-en.mpg", 640, 480); jp2.setVisible(true); JFrame jf = new JFrame("test"); jf.add(jp); jf.add(jp2); jf.setVisible(true); // Canvas canvas = new Canvas(); // canvas.setSize(200,200); // JFrame jf = new JFrame("test"); // jf.add(canvas); // // JVLC jvlc = new JVLC(new String[]{"--plugin-path=lib\\plugins"}); // MediaList ml = new MediaList(jvlc); // // MediaListPlayer mlp = new MediaListPlayer(jvlc); // mlp.setMediaList(ml); // // ml.addMedia(new MediaDescriptor(jvlc, "C:/11-eclipseWorkspace/test-videos/t-en.mpg")); // //jvlc.setVideoOutput(canvas); // // mlp.playItem(new MediaDescriptor(jvlc, "C:/11-eclipseWorkspace/test-videos/t-en.mpg")); // } }
Can anyone help me please,

cheers,
mkeuschn

Re: JVLC Canvas on Vista

Posted: 29 Aug 2008 11:34
by littlejohn
Your window and canvases must be visible (ie, with setVisible(true)) at the time of setting video output. Take a look at:

http://git.videolan.org/?p=vlc.git;a=bl ... 4c;hb=HEAD

Cheers,
Filippo

Re: JVLC Canvas on Vista

Posted: 11 Sep 2008 15:43
by mkeuschn
Thank you for the example. Now I have following problem: when I try to close the Example application I got following error.

Code: Select all

*** LibVLC Exception not handled: No active input Set a breakpoint in 'libvlc_exception_not_handled' to debug. Fontconfig error: Cannot load default config file

Re: JVLC Canvas on Vista

Posted: 12 Sep 2008 09:55
by wells
The same problem happened to me!
Can anyone help me!
Thank you for the example. Now I have following problem: when I try to close the Example application I got following error.

Code: Select all

*** LibVLC Exception not handled: No active input Set a breakpoint in 'libvlc_exception_not_handled' to debug. Fontconfig error: Cannot load default config file

Re: JVLC Canvas on Vista

Posted: 24 Sep 2008 17:22
by mkeuschn
here some errors when I try to read a stream:

Code: Select all

*** LibVLC Exception not handled: No active input Set a breakpoint in 'libvlc_exception_not_handled' to debug. libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 0) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 0) for PID 66 Fontconfig error: Cannot load default config file libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 0) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 0) for PID 66 Fontconfig error: Cannot load default config file