import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.Pane; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaView; import javafx.stage.Stage; import javafx.util.Duration; public class Bug extends Application { public static void main(String[] args) { launch(args); } private MediaPlayer mp; private Media media; private MediaView mv; private Scene scene; @Override public void start(Stage stage) throws Exception { String path = "file:///D:/Junior/Projects/Программирование/Apps/video/video.mp4"; System.out.println("path = " + path); media = new Media(path); mp = new MediaPlayer(media); mp.play(); mv = new MediaView(mp); mv.setPreserveRatio(true); Pane sp = new Pane(); sp.getChildren().setAll(mv); scene = new Scene(sp, 800, 600); mv.fitWidthProperty().bind(scene.widthProperty()); mv.fitHeightProperty().bind(scene.heightProperty()); Button b = new Button("seek and change rate"); b.setOnAction(new EventHandler() { @Override public void handle(ActionEvent arg0) { mp.seek(Duration.seconds(100)); if (mp.getRate() == 1) { mp.setRate(0.5); } else { mp.setRate(1); } } }); sp.getChildren().add(b); stage.setScene(scene); stage.show(); } }