Libraryless. Click here for Pure Java version (303L/3K/10K).
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 | import javafx.scene.layout.*; |
11 | import javafx.geometry.Insets; |
12 | import javafx.scene.control.Button; |
13 | import javafx.beans.property.*; |
14 | import javafx.beans.binding.*; |
15 | import javafx.scene.paint.Color; |
16 | |
17 | p { |
18 | twice { |
19 | VideoPlayer.arg = "/media/CE009E97009E865D__/Lenny Kravitz Let Love Rule.mp4"; |
20 | jfxStart(VideoPlayer.class); |
21 | sleepSeconds(4); |
22 | } |
23 | } |
24 | |
25 | // public class, public constructor as per JavaFX requirements |
26 | public sclass VideoPlayer extends Application { |
27 | static S arg; |
28 | |
29 | File file; |
30 | |
31 | public void start(Stage stage) ctex { |
32 | file = new File(arg); |
33 | |
34 | // Create and set the Scene. |
35 | // Numbers are window size (content is not scaled) |
36 | double w = 540, h = 209; |
37 | new BorderPane root; |
38 | Scene scene = new Scene(root, w, h, Color.BLACK); |
39 | stage.setScene(scene); |
40 | |
41 | // Name and display the Stage. |
42 | stage.setTitle("JavaX Video Player"); |
43 | stage.show(); |
44 | |
45 | // Create the media source. |
46 | Media media = new Media(file.toURI().toURL().toString()); |
47 | |
48 | // Create the player and set to play automatically. |
49 | MediaPlayer mediaPlayer = new MediaPlayer(media); |
50 | mediaPlayer.setAutoPlay(true); |
51 | |
52 | // Create the media view. |
53 | MediaView mediaView = new MediaView(mediaPlayer); |
54 | |
55 | // Resize Hack |
56 | DoubleProperty mvw = mediaView.fitWidthProperty(); |
57 | DoubleProperty mvh = mediaView.fitHeightProperty(); |
58 | mvw.bind(Bindings.selectDouble(mediaView.sceneProperty(), "width")); |
59 | mvh.bind(Bindings.selectDouble(mediaView.sceneProperty(), "height")); |
60 | mediaView.setPreserveRatio(true); |
61 | |
62 | root.setCenter(mediaView); |
63 | } |
64 | } |
Began life as a copy of #1003746
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
No comments. add comment
Snippet ID: | #1003750 |
Snippet name: | Try Playing Two Videos, take two |
Eternal ID of this version: | #1003750/1 |
Text MD5: | 557ab3726ecc9c319697c0c28e1d1155 |
Transpilation MD5: | 6450905f01975940fcf9903c99496851 |
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 19:25:40 |
Source code size: | 1871 bytes / 64 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 537 / 627 |
Referenced in: | [show references] |