adityashimoga / gstreamer-java

Automatically exported from code.google.com/p/gstreamer-java
0 stars 0 forks source link

SWT VideoComponent does not show video on Ubuntu 10.10 #80

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using org.gstreamer.swt.overlay.VideoComponent on Ubuntu 10.10 a call to 
VideoComponent.expose() must be made before the video will appear.  If it is 
not called, then the video will not be shown until the window is resized.  This 
was not required on Ubuntu 10.4.

Test case below.  Comment out the VideoComponent.expose() line to see the issue.

import java.io.File;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.gstreamer.Gst;
import org.gstreamer.State;
import org.gstreamer.elements.PlayBin;
import org.gstreamer.swt.overlay.VideoComponent;

public class BasicPlayTest {

    final static String mediaFile = "/home/user/foo.mp4";

    public static void main (String[] args) {
        final Display display = new Display();
        Shell shell = new Shell(display);

        Gst.init("VideoPlayer", new String[] {});
        final PlayBin playbin = new PlayBin("VideoPlayer");

        shell.setLayout(new FillLayout());
        VideoComponent videoComponent = new VideoComponent(shell, SWT.NO_BACKGROUND);
        videoComponent.setKeepAspect(true);
        videoComponent.expose(); // This is important on Ubuntu 10.10 (not needed on 10.04).
        playbin.setVideoSink(videoComponent.getElement());
        shell.open();

        playbin.setInputFile(new File(mediaFile));
        playbin.setState(State.PLAYING);

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) display.sleep();
        }
        display.dispose();
    }

}

Original issue reported on code.google.com by AlexHut...@gmail.com on 17 Jul 2011 at 12:44

GoogleCodeExporter commented 9 years ago
check the latest svn or release 1.5. and it's working.

Original comment by lfar...@lfarkas.org on 19 Jul 2011 at 8:35