Libraryless. Click here for Pure Java version (122L/2K/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; import javafx.scene.layout.*; import javafx.geometry.Insets; import javafx.scene.control.Button; 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 media view. MediaView mediaView = new MediaView(mediaPlayer); // Make BorderPane and add to scene. BorderPane border = new BorderPane(); HBox hbox = makeButtons(); border.setBottom(hbox); border.setCenter(mediaView); ((Group) scene.getRoot()).getChildren().add(border); } HBox makeButtons() { new HBox hbox; hbox.setPadding(new Insets(15, 12, 15, 12)); hbox.setSpacing(10); hbox.setStyle("-fx-background-color: #336699;"); Button buttonCurrent = new Button("Current"); buttonCurrent.setPrefSize(100, 20); Button buttonProjected = new Button("Projected"); buttonProjected.setPrefSize(100, 20); hbox.getChildren().addAll(buttonCurrent, buttonProjected); return hbox; } }
Began life as a copy of #1003698
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
ID | Author/Program | Comment | Date |
---|---|---|---|
1256 | stefan | Nice! Just now resize the scene with the window | 2016-07-25 23:54:00 |
Snippet ID: | #1003700 |
Snippet name: | JavaFX: Try Adding Buttons To Video |
Eternal ID of this version: | #1003700/1 |
Text MD5: | 7996d53facb18f64852c123dff4f2563 |
Transpilation MD5: | 0ee2b1bf42ba1f656d8ac6f913a80c1d |
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:53:01 |
Source code size: | 2216 bytes / 75 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 672 / 714 |
Referenced in: | [show references] |