Follow the video code
package video;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.Stage;
public class Entrada2_Video extends Application {
public String VIDEO_URL = getClass().getResource("/conteudos/Video_Final3.mp4").toString();
public static void rodarVideo() {
launch();
Entrada1.texto();
}
public void start(Stage palco) throws Exception {
Media media = new Media(VIDEO_URL);
MediaPlayer mediaPlayer = new MediaPlayer(media);
MediaView mediaView = new MediaView(mediaPlayer);
mediaPlayer.play();
StackPane raiz = new StackPane();
raiz.getChildren().add(mediaView);
Scene cena = new Scene(raiz, 854, 480);
palco.setTitle("Peão Genio Quiz");
palco.sceneProperty();
palco.setScene(cena);
palco.show();
palco.setResizable(false);
mediaPlayer.play();
}
}
There is nothing different from other codes already seen on the internet. Now follows the Main class, where all methods will be executed.
package video;
public class Principal{
public static void main(String[] args) {
Entrada2_Video.rodarVideo();
}
}
The program runs fine, the big problem is that I do not know how to close the video automatically at the end of the execution of it! That is, if I want to execute the next method, you must manually close the video.
I would just like to know how to close the video automatically after the end of the video, so that the next method will be executed after the video is closed.