selectFile.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser chooser = new FileChooser();
chooser.getExtensionFilters().add("select (*mp4)", "*.mp4");
try {
fileToPlay = fileChooser.showOpenDialog(null);
Media m = new Media(fileToPlay.toURI().toString());
MediaPlayer mp = new MediaPlayer(m);
mediaPlayer.setMediaPlayer(mp);
mp.play();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
}
});
Asked
Active
Viewed 10 times
0
![](../../users/profiles/15273968.webp)
onkar ruikar
- 1,641
- 1
- 4
- 14
![](../../users/profiles/13062578.webp)
Nelson
- 1
- 1
-
Hello there! I'm new to reviewing questions so I hope I don't screw this one up. It's a bit hard to understand what you're trying to ask for, what your problem is, and what you've tried so far to fix it. There's a great guide here for asking good questions, and it's really neat: https://stackoverflow.com/help/how-to-ask – Haakon Løtveit Apr 27 '21 at 14:35