Libraryless. Click here for Pure Java version (111L/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; import javafx.beans.property.*; import javafx.beans.binding.*; import javafx.scene.paint.Color; 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; new Pane root; Scene scene = new Scene(root, w, h, Color.BLACK); 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); // 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.getChildren().add(mediaView); } }
Began life as a copy of #1003708
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 |
---|---|---|---|
1264 | stefan | No better than v1. Use v2!! | 2016-07-26 00:38:01 |
Snippet ID: | #1003709 |
Snippet name: | JavaFX: Video, Fast, Auto-Resizing, No Buttons v1.5 |
Eternal ID of this version: | #1003709/1 |
Text MD5: | e3d83caee5654cbd0ac902d2a764ef4d |
Transpilation MD5: | c3c4babfa707e5b558e09edfc2277759 |
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:37:32 |
Source code size: | 1997 bytes / 64 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 759 / 788 |
Referenced in: | [show references] |