Menu ▾ ▴

Embedding

KoKoLio

The AV PlayerFX can run on both Swing and JavaFX platforms depending on the parameter values of the org.avfx.core.AVPlayerFX.launch(org.avfx.core.AVPlayerFX.JavaPlatform platform, Object container)
initializer method:

  1. To run it on Java Swing Event Queue, use org.avfx.core.AVPlayerFX.JavaPlatform.SWING and a valid Swing container component instance (like a javax.swing.JPanel object or the javax.swing.JFrame's layered pane):
    JFrame frame = new JFrame(); org.avfx.core.AVPlayerFX.launch(org.avfx.core.AVPlayerFX.JavaPlatform.SWING, frame.getLayeredPane());
    IMPORTANT: if you embed the AV PlayerFX into a Swing container, make sure to call org.avfx.core.AVPlayerFX.close(org.avfx.core.AVPlayerFX.JavaPlatform.SWING); when you finish, to release all the used resources. You can safely omit this step if the AV PlayerFX runs on the JavaFX Event Thread.
  2. To run it on the JavaFX Event Thread, use org.avfx.core.AVPlayerFX.JavaPlatform.JAVAFX and the Stage instance on the "start" method:
    @Override public void start(Stage primaryStage) { org.avfx.core.AVPlayerFX.launch(org.avfx.core.AVPlayerFX.JavaPlatform.JAVAFX, primaryStage); }

It's that easy!! Enjoy!!


Related

Wiki: Home