Deprecated: Function create_function() is deprecated in /home/bluekitc/public_html/ringwald.ch/libxine-java/pmwiki.php on line 456

Deprecated: Function create_function() is deprecated in /home/bluekitc/public_html/ringwald.ch/libxine-java/pmwiki.php on line 456

Deprecated: Function create_function() is deprecated in /home/bluekitc/public_html/ringwald.ch/libxine-java/pmwiki.php on line 456

Deprecated: Function create_function() is deprecated in /home/bluekitc/public_html/ringwald.ch/libxine-java/pmwiki.php on line 456

Deprecated: Function create_function() is deprecated in /home/bluekitc/public_html/ringwald.ch/libxine-java/pmwiki.php on line 456
libxine-java - Java binding for the xine multimedia library : Main - Example browse
Deprecated: Function create_function() is deprecated in /home/bluekitc/public_html/ringwald.ch/libxine-java/pmwiki.php on line 456

Simple AWT example (example/MuXine.java):


 import java.awt.*;
 import org.libxine.*;

 public class MuXine {
     public static void main(String args[]) {
         if (args.length==0) {
             System.out.println("Usage: java Muxine movieFile");
             System.exit(0);
         }
         Xine engine = Xine.getXine();
         XineAWTCanvas view = new XineAWTCanvas();
         Frame awtFrame = new Frame("MuXine Java Video Player");
         awtFrame.add(view);
         awtFrame.setVisible(true);
         awtFrame.setSize(320, 240);
         awtFrame.setBackground(Color.BLACK);
         XineController controller = engine.createController( view );
         controller.open( args[0] );
         controller.playOnce();
     }
 }

Simple SWT example with FullScreen mode (example/MuXineSWT.java):


import org.libxine.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;

public class MuXineSWT {
    static boolean fullscreen = false;

    public static void main(String args[]) {
        if (args.length==0) {
            System.out.println("Usage: java MuxineSWT movieFile");
            System.exit(0);
        } 

        Xine engine = Xine.getXine();
        Display display = new Display();
        Shell shell = new Shell(display);

        shell.setText("MuXine SWT Player");
        shell.setLayout(new FillLayout(SWT.VERTICAL));
        XineSWTCanvas view = new XineSWTCanvas(shell);
        shell.setBounds(40, 40, 320, 240);
        shell.open ();

        final XineController controller = engine.createController( view );
        controller.open( args[0] );
        controller.start();

        /* use key listener for fullscreen mode */
        view.addKeyListener( new KeyListener() {
            public void keyPressed(KeyEvent e) {
                System.out.println( "App: Key pressed: " + e.character);
                if (e.character == 'f'){
                    if (fullscreen) {
                        controller.exitFullscreenMode();
                        fullscreen = false;
                    } else {
                        controller.enterFullscreenMode();
                        fullscreen = true;  
                    }
                }
            }
            public void keyReleased(KeyEvent e){
            }
        });

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