Can shrink window

This commit is contained in:
Guillaume Tâche
2024-08-18 17:54:43 +02:00
parent 3fa51eb95b
commit 273a6e996f
2 changed files with 11 additions and 1 deletions

View File

@@ -113,9 +113,19 @@ public class FXMediaController implements MediaController {
});
bindPlayButton();
stackPane.widthProperty().addListener((observable, oldValue, newValue) -> resizeMediaView());
stackPane.heightProperty().addListener((observable, oldValue, newValue) -> resizeMediaView());
binder.createBindings();
}
private void resizeMediaView() {
final var width = stackPane.getWidth();
final var height = stackPane.getHeight();
videoView.setFitWidth(width);
videoView.setFitHeight(height);
}
private void loadFileVideo(final Path fileVideoPath) {
final var media = new Media(fileVideoPath.toUri().toString());
final var player = new MediaPlayer(media);

View File

@@ -53,7 +53,7 @@
<center>
<StackPane fx:id="stackPane">
<children>
<MediaView fx:id="videoView" fitHeight="${stackPane.height}" fitWidth="${stackPane.width}"/>
<MediaView fx:id="videoView" managed="false"/>
</children>
</StackPane>
</center>