您好我有这个代码在JavaFX GridPane中播放视频。视频播放完美,但它不适合GridPane。那么如何实现呢?
@FXML
private GridPane boxView;
private MediaPlayer player;
private MediaView view;
public void LoadVideo(String videoUrl) {
URL url = getClass().getResource(videoUrl);
final Media m = new Media(url.toString());
this.player = new MediaPlayer(m);
this.view = new MediaView(player);
boxView.getChildren().add(view);
boxView.setAlignment(Pos.CENTER);
player.play();
}