import java.util.*; import java.util.zip.*; import java.util.List; import java.util.regex.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.table.*; import java.io.*; import java.net.*; import java.lang.reflect.*; import java.lang.ref.*; import java.lang.management.*; import java.security.*; import java.security.spec.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.imageio.*; import java.math.*; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaView; import javafx.stage.Stage; import javafx.scene.layout.*; import javafx.geometry.Insets; import javafx.scene.control.Button; import javafx.beans.property.*; import javafx.beans.binding.*; import javafx.scene.paint.Color; import javafx.application.Application; import javafx.stage.Stage; import javafx.application.Platform; public class main { public static void main(String[] args) throws Exception { for (int __twice = 0; __twice < 2; __twice++) { VideoPlayer.arg = "/media/CE009E97009E865D__/Lenny Kravitz Let Love Rule.mp4"; jfxStart(VideoPlayer.class); sleepSeconds(4); } } // public class, public constructor as per JavaFX requirements public static class VideoPlayer extends Application { static String arg; File file; public void start(Stage stage) { try { file = new File(arg); // Create and set the Scene. // Numbers are window size (content is not scaled) double w = 540, h = 209; BorderPane root = new BorderPane(); Scene scene = new Scene(root, w, h, Color.BLACK); stage.setScene(scene); // Name and display the Stage. stage.setTitle("JavaX Video Player"); stage.show(); // Create the media source. Media media = new Media(file.toURI().toURL().toString()); // Create the player and set to play automatically. MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay(true); // Create the media view. MediaView mediaView = new MediaView(mediaPlayer); // Resize Hack DoubleProperty mvw = mediaView.fitWidthProperty(); DoubleProperty mvh = mediaView.fitHeightProperty(); mvw.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width")); mvh.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height")); mediaView.setPreserveRatio(true); root.setCenter(mediaView); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} } static void jfxStart(Class appClass) { startJavaFX(appClass); } static void sleepSeconds(long s) { if (s > 0) sleep(s*1000); } static void sleep(long ms) { try { Thread.sleep(ms); } catch (Exception e) { throw new RuntimeException(e); } } static void sleep() { try { print("Sleeping."); synchronized(main.class) { main.class.wait(); } } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} static boolean startJavaFX_firstStart = true; static void startJavaFX(final Class appClass) { { Thread _t_0 = new Thread("Starting JavaFX") { public void run() { try { if (startJavaFX_firstStart) { startJavaFX_firstStart = false; fixContextClassLoader(); // Maybe not needed anymore now Application.launch(appClass); } else jfxLater(new Runnable() { public void run() { try { Application app = nuObject(appClass); Stage stage = new Stage(); app.start(stage); } catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }}}); } catch (Exception _e) { throw _e instanceof RuntimeException ? (RuntimeException) _e : new RuntimeException(_e); } } }; _t_0.start(); } } static volatile StringBuffer local_log = new StringBuffer(); // not redirected static volatile StringBuffer print_log = local_log; // might be redirected, e.g. to main bot // in bytes - will cut to half that static volatile int print_log_max = 1024*1024; static volatile int local_log_max = 100*1024; static void print() { print(""); } // slightly overblown signature to return original object... static A print(A o) { String s = String.valueOf(o) + "\n"; StringBuffer loc = local_log; StringBuffer buf = print_log; int loc_max = print_log_max; if (buf != loc && buf != null) { print_append(buf, s, print_log_max); loc_max = local_log_max; } if (loc != null) print_append(loc, s, loc_max); System.out.print(s); return o; } static void print(long l) { print(String.valueOf(l)); } static void print(char c) { print(String.valueOf(c)); } static void print_append(StringBuffer buf, String s, int max) { synchronized(buf) { buf.append(s); max /= 2; if (buf.length() > max) try { int newLength = max/2; int ofs = buf.length()-newLength; String newString = buf.substring(ofs); buf.setLength(0); buf.append("[...] ").append(newString); } catch (Exception e) { buf.setLength(0); } } } static Object nuObject(String className, Object... args) { try { return nuObject(Class.forName(className), args); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} static Object nuObject(Object realm, String className, Object... args) { return nuObject(_getClass(realm, className), args); } static A nuObject(Class c, Object... args) { try { Constructor m = nuObject_findConstructor(c, args); m.setAccessible(true); return (A) m.newInstance(args); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} static Constructor nuObject_findConstructor(Class c, Object... args) { for (Constructor m : c.getDeclaredConstructors()) { if (!nuObject_checkArgs(m.getParameterTypes(), args, false)) continue; return m; } throw new RuntimeException("Constructor with " + args.length + " matching parameter(s) not found in " + c.getName()); } static boolean nuObject_checkArgs(Class[] types, Object[] args, boolean debug) { if (types.length != args.length) { if (debug) System.out.println("Bad parameter length: " + args.length + " vs " + types.length); return false; } for (int i = 0; i < types.length; i++) if (!(args[i] == null || isInstanceX(types[i], args[i]))) { if (debug) System.out.println("Bad parameter " + i + ": " + args[i] + " vs " + types[i]); return false; } return true; } static void jfxLater(Runnable r) { Platform.runLater(r); } static void fixContextClassLoader() { Thread.currentThread().setContextClassLoader(myClassLoader()); } // extended over Class.isInstance() to handle primitive types static boolean isInstanceX(Class type, Object arg) { if (type == boolean.class) return arg instanceof Boolean; if (type == int.class) return arg instanceof Integer; if (type == long.class) return arg instanceof Long; if (type == float.class) return arg instanceof Float; if (type == short.class) return arg instanceof Short; if (type == char.class) return arg instanceof Character; if (type == byte.class) return arg instanceof Byte; if (type == double.class) return arg instanceof Double; return type.isInstance(arg); } static Class _getClass(String name) { try { return Class.forName(name); } catch (ClassNotFoundException e) { return null; } } static Class _getClass(Object o) { return o instanceof Class ? (Class) o : o.getClass(); } static Class _getClass(Object realm, String name) { try { return getClass(realm).getClassLoader().loadClass(classNameToVM(name)); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} static ClassLoader myClassLoader() { return mc().getClassLoader(); } static Class getClass(String name) { try { return Class.forName(name); } catch (ClassNotFoundException e) { return null; } } static Class getClass(Object o) { return o instanceof Class ? (Class) o : o.getClass(); } static Class getClass(Object realm, String name) { try { return getClass(realm).getClassLoader().loadClass(classNameToVM(name)); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} static String classNameToVM(String name) { return name.replace(".", "$"); } static Class mc() { return getMainClass(); } static Class getMainClass() { try { return Class.forName("main"); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} static Class getMainClass(Object o) { try { return (o instanceof Class ? (Class) o : o.getClass()).getClassLoader().loadClass("main"); } catch (Throwable __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); }} }