Libraryless. Click here for Pure Java version (96L/1K/4K).
1 | !759 |
2 | |
3 | import javafx.application.Application; |
4 | import javafx.scene.Group; |
5 | import javafx.scene.Scene; |
6 | import javafx.scene.media.Media; |
7 | import javafx.scene.media.MediaPlayer; |
8 | import javafx.scene.media.MediaView; |
9 | import javafx.stage.Stage; |
10 | |
11 | public class main extends Application { |
12 | p { |
13 | System.setProperty("prism.forceGPU", "true"); |
14 | System.setProperty("prism.verbose", "true"); |
15 | |
16 | fixContextClassLoader(); |
17 | launch(); |
18 | } |
19 | |
20 | public void start(Stage stage) { |
21 | // Create and set the Scene. |
22 | // Numbers are window size (content is not scaled) |
23 | double w = 540, h = 209; |
24 | Scene scene = new Scene(new Group(), w, h); |
25 | stage.setScene(scene); |
26 | |
27 | // Name and display the Stage. |
28 | stage.setTitle("Hello Media"); |
29 | stage.show(); |
30 | |
31 | // Create the media source. |
32 | //String source = getParameters().getRaw().get(0); |
33 | String source = "/media/CE009E97009E865D__/Downloads/Oblivion (2013)/Oblivion.2013.mp4"; |
34 | Media media = null; |
35 | try { |
36 | media = new Media(new File(source).toURI().toURL().toString()); |
37 | } catch (MalformedURLException e) { |
38 | throw new RuntimeException(e); |
39 | } |
40 | |
41 | // Create the player and set to play automatically. |
42 | MediaPlayer mediaPlayer = new MediaPlayer(media); |
43 | mediaPlayer.setAutoPlay(true); |
44 | |
45 | // Create the view and add it to the Scene. |
46 | MediaView mediaView = new MediaView(mediaPlayer); |
47 | ((Group) scene.getRoot()).getChildren().add(mediaView); |
48 | } |
49 | } |
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
ID | Author/Program | Comment | Date |
---|---|---|---|
1254 | stefan | Works!! | 2016-07-25 23:34:52 |
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: | 784 / 879 |
Referenced in: | [show references] |