forked from j62/ctbrec
1
0
Fork 0

Dispose the video player on error

This commit is contained in:
0xboobface 2018-12-02 13:32:38 +01:00
parent 0ff04ed9ef
commit 1feea03ec3
1 changed files with 4 additions and 0 deletions

View File

@ -242,6 +242,7 @@ public class PreviewPopupHandler implements EventHandler<MouseEvent> {
if(videoPlayer.getError().getCause() != null) { if(videoPlayer.getError().getCause() != null) {
LOG.error("Error while starting preview stream root cause:", videoPlayer.getError().getCause()); LOG.error("Error while starting preview stream root cause:", videoPlayer.getError().getCause());
} }
videoPlayer.dispose();
Platform.runLater(() -> { Platform.runLater(() -> {
showTestImage(); showTestImage();
}); });
@ -277,6 +278,9 @@ public class PreviewPopupHandler implements EventHandler<MouseEvent> {
} }
private void hidePopup() { private void hidePopup() {
if(future != null && !future.isDone()) {
future.cancel(true);
}
Platform.runLater(() -> { Platform.runLater(() -> {
popup.setX(-1000); popup.setX(-1000);
popup.setY(-1000); popup.setY(-1000);