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

49
LINES

< > BotCompany Repo | #1003698 // JavaFX Video Test

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

Libraryless. Click here for Pure Java version (96L/1K/4K).

!759

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;

public class main extends Application {
  p {
    System.setProperty("prism.forceGPU", "true");
    System.setProperty("prism.verbose", "true");
    
    fixContextClassLoader();
    launch();
  }

  public void start(Stage stage) {
    // Create and set the Scene.
    // Numbers are window size (content is not scaled)
    double w = 540, h = 209;
    Scene scene = new Scene(new Group(), w, h);
    stage.setScene(scene);

    // Name and display the Stage.
    stage.setTitle("Hello Media");
    stage.show();

    // 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);
    ((Group) scene.getRoot()).getChildren().add(mediaView);
  }
}

download  show line numbers  debug dex  old transpilations   

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

Comments [hide]

ID Author/Program Comment Date
1254 stefan Works!! 2016-07-25 23:34:52

add comment

Snippet ID: #1003698
Snippet name: JavaFX Video Test
Eternal ID of this version: #1003698/1
Text MD5: 1ee0de5b4a7c76f260865b3bf68ad5ed
Transpilation MD5: 7e73fbd12f6f4cc8a424b193dcb5ec68
Author: stefan
Category: javax / javafx
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-25 23:34:03
Source code size: 1480 bytes / 49 lines
Pitched / IR pitched: No / No
Views / Downloads: 782 / 876
Referenced in: #1003699 - JavaFX + Swing Test
#1003700 - JavaFX: Try Adding Buttons To Video