javafx.scene.media.MediaPlayer.Status Java Examples
The following examples show how to use
javafx.scene.media.MediaPlayer.Status.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdvancedMedia.java From marathonv5 with Apache License 2.0 | 6 votes |
@Override public void play() { Status status = mediaPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { //System.out.println("Player is in a bad or unknown state, can't play."); return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { mediaPlayer.play(); } }
Example #2
Source File: AdvancedMedia.java From marathonv5 with Apache License 2.0 | 6 votes |
@Override public void play() { Status status = mediaPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { //System.out.println("Player is in a bad or unknown state, can't play."); return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { mediaPlayer.play(); } }
Example #3
Source File: AdvancedMedia.java From netbeans with Apache License 2.0 | 6 votes |
public void play() { Status status = mediaPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { //System.out.println("Player is in a bad or unknown state, can't play."); return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { mediaPlayer.play(); } }
Example #4
Source File: IOSVideoService.java From attach with GNU General Public License v3.0 | 5 votes |
private static void updateStatus(int value) { Status s; switch (value) { case 0: s = Status.UNKNOWN; break; case 1: s = Status.READY; break; case 2: s = Status.PAUSED; break; case 3: s = Status.PLAYING; break; case 4: s = Status.STOPPED; break; case 5: s = Status.DISPOSED; break; default: s = Status.UNKNOWN; } Platform.runLater(() -> STATUS.set(s)); }
Example #5
Source File: StreamingMediaPlayer.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void play() { Status status = mediaPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { mediaPlayer.play(); } }
Example #6
Source File: OverlayMediaPlayer.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void play() { Status status = mediaPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { mediaPlayer.play(); } }
Example #7
Source File: AlphaMediaPlayer.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void play() { Status status = fierPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { fierPlayer.play(); arthPlayer.play(); } }
Example #8
Source File: StreamingMediaPlayer.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void play() { Status status = mediaPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { mediaPlayer.play(); } }
Example #9
Source File: OverlayMediaPlayer.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void play() { Status status = mediaPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { mediaPlayer.play(); } }
Example #10
Source File: AlphaMediaPlayer.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void play() { Status status = fierPlayer.getStatus(); if (status == Status.UNKNOWN || status == Status.HALTED) { return; } if (status == Status.PAUSED || status == Status.STOPPED || status == Status.READY) { fierPlayer.play(); arthPlayer.play(); } }
Example #11
Source File: IOSVideoService.java From attach with GNU General Public License v3.0 | 4 votes |
@Override public ReadOnlyObjectProperty<Status> statusProperty() { return STATUS.getReadOnlyProperty(); }
Example #12
Source File: EmbedAudioVideoDemo.java From Java-11-Cookbook-Second-Edition with MIT License | 4 votes |
@Override public void start(Stage stage) { // Create the media source File file = new File("sample_video1.mp4"); Media media = new Media(file.toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); //mediaPlayer.setAutoPlay(true); mediaPlayer.statusProperty().addListener( new ChangeListener<Status>() { public void changed(ObservableValue ov, Status oldStatus, Status newStatus) { System.out.println(oldStatus +"->" + newStatus); } } ); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); MediaView mediaView = new MediaView(mediaPlayer); mediaView.setFitWidth(350); mediaView.setFitHeight(350); Button pauseB = new Button("Pause"); pauseB.setOnAction(e -> { mediaPlayer.pause(); }); Button playB = new Button("Play"); playB.setOnAction(e -> { mediaPlayer.play(); }); Button stopB = new Button("Stop"); stopB.setOnAction(e -> { mediaPlayer.stop(); }); HBox controlsBox = new HBox(10); controlsBox.getChildren().addAll(pauseB, playB, stopB); VBox vbox = new VBox(); vbox.getChildren().addAll(mediaView, controlsBox); // Create and set the Scene. Scene scene = new Scene(vbox); stage.setScene(scene); // Name and display the Stage. stage.setTitle("Media Demo"); /*stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY());*/ stage.setWidth(400); stage.setHeight(400); stage.show(); }
Example #13
Source File: EmbedAudioVideoDemo.java From Java-9-Cookbook with MIT License | 4 votes |
@Override public void start(Stage stage) { // Create the media source File file = new File("sample_video1.mp4"); Media media = new Media(file.toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); //mediaPlayer.setAutoPlay(true); mediaPlayer.statusProperty().addListener( new ChangeListener<Status>() { public void changed(ObservableValue ov, Status oldStatus, Status newStatus) { System.out.println(oldStatus +"->" + newStatus); } } ); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); MediaView mediaView = new MediaView(mediaPlayer); mediaView.setFitWidth(350); mediaView.setFitHeight(350); Button pauseB = new Button("Pause"); pauseB.setOnAction(e -> { mediaPlayer.pause(); }); Button playB = new Button("Play"); playB.setOnAction(e -> { mediaPlayer.play(); }); Button stopB = new Button("Stop"); stopB.setOnAction(e -> { mediaPlayer.stop(); }); HBox controlsBox = new HBox(10); controlsBox.getChildren().addAll(pauseB, playB, stopB); VBox vbox = new VBox(); vbox.getChildren().addAll(mediaView, controlsBox); // Create and set the Scene. Scene scene = new Scene(vbox); stage.setScene(scene); // Name and display the Stage. stage.setTitle("Media Demo"); /*stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY());*/ stage.setWidth(400); stage.setHeight(400); stage.show(); }
Example #14
Source File: JFXRepresentation.java From phoebus with Eclipse Public License 1.0 | 4 votes |
@Override public boolean isCancelled() { return player.getStatus() == Status.STOPPED; }
Example #15
Source File: VideoService.java From attach with GNU General Public License v3.0 | 2 votes |
/** * Read only property that indicates the media player status. * * @return A {@link ReadOnlyObjectProperty} with the * {@link javafx.scene.media.MediaPlayer.Status} of the media player */ ReadOnlyObjectProperty<Status> statusProperty();