Skip to content
Snippets Groups Projects
Commit f8b93493 authored by Tran Peter's avatar Tran Peter
Browse files

fix(intro): fix keyboard buttons not working for skipping

parent 1a05eea0
No related branches found
Tags v0.2.0
5 merge requests!74V1,!73Initial commit,!71Merge DataBase into Development,!32Merge ui into development,!28merge ui in developmentWorking
......@@ -26,7 +26,7 @@ public class IntroController implements Initializable {
private BorderPane introParent;
private final String fileName = "src/main/resources/videos/";
// nextVideo() will iterate through this array so the next video will be played TODO: change the videos to non memes lmao
private final String[] videos = {"sony.mp4", "monke.mp4"};
private final String[] videos = {"black.mp4", "sony.mp4", "monke.mp4"};
private File file = new File(fileName + videos[0]);
private int counter = 0;
private MediaPlayer mediaPlayer;
......@@ -38,6 +38,7 @@ public class IntroController implements Initializable {
introParent.setStyle("-fx-background-color: black;");
introParent.setCursor(Cursor.NONE);
createMediaPlayer();
mediaPlayer.setOnReady(() -> introParent.requestFocus());
}
private void createMediaPlayer() {
......@@ -53,7 +54,14 @@ public class IntroController implements Initializable {
}
});
// TODO: make any button pressed work
introParent.setOnKeyPressed((keyEvent -> {
if (counter == videos.length - 1) {
videoEnd();
} else {
nextVideo();
}
}));
introParent.setOnMouseClicked((mouseEvent) -> {
if (counter == videos.length - 1) {
videoEnd();
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment