Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

50
LINES

< > BotCompany Repo | #1003703 // Try Putting JavaFX Video in Swing JFrame

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1453L/10K/34K).

!752

import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;

p-awt {
  jfxFastVideo();
  
  JFrame frame = showFrame();
  final new JFXPanel fxPanel;
  frame.add(fxPanel);

  jfxLater(r {
    fxPanel.setScene(createScene());
  });
}

// JavaFX World
static Scene createScene() {
  new Group root;
  Scene scene = new Scene(root, Color.ALICEBLUE);

  // Create the media source.
  //String source = getParameters().getRaw().get(0);
  String source = "/media/CE009E97009E865D__/Downloads/Oblivion (2013)/Oblivion.2013.mp4";
  Media media = null;
  try {
    media = new Media(new File(source).toURI().toURL().toString());
  } catch (MalformedURLException e) {
    throw new RuntimeException(e);
  }

  // Create the player and set to play automatically.
  MediaPlayer mediaPlayer = new MediaPlayer(media);
  mediaPlayer.setAutoPlay(true);

  // Create the view and add it to the Scene.
  MediaView mediaView = new MediaView(mediaPlayer);
  
  root.getChildren().add(mediaView);
  ret scene;
}

Author comment

Began life as a copy of #1003701

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
1260 stefan jfxFastVideo() makes this SLOWER... uargh 2016-07-26 00:26:06
1258 stefan Works, just still doesn't resize content 2016-07-26 00:10:21

add comment

Snippet ID: #1003703
Snippet name: Try Putting JavaFX Video in Swing JFrame
Eternal ID of this version: #1003703/1
Text MD5: f45620525e4c3454e40ed309c87b4dd0
Transpilation MD5: a4a5d0cdc2f7b647ac657dc527f84fd5
Author: stefan
Category: javax / javafx
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-26 00:25:06
Source code size: 1317 bytes / 50 lines
Pitched / IR pitched: No / No
Views / Downloads: 757 / 814
Referenced in: [show references]