forked from hacker85/JavaLessons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediaPlayerLesson.java
More file actions
35 lines (29 loc) · 1.01 KB
/
MediaPlayerLesson.java
File metadata and controls
35 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package fx;
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;
/**
* Created by max on 3/3/17.
*/
public class MediaPlayerLesson extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
// Media media = new Media("file:///home/max/Downloads/sound.mp3");
Media media = new Media("file:///mnt/788051CF8051950A/MyJavaVideoLessons/avi/101Swing6WindowLisener.mp4");
MediaPlayer mediaPlayer = new MediaPlayer(media);
//mediaPlayer.setAutoPlay(true);
MediaView mediaView = new MediaView(mediaPlayer);
mediaPlayer.play();
Group group = new Group();
group.getChildren().add(mediaView);
primaryStage.setScene(new Scene(group, 400, 300));
primaryStage.show();
}
}