diff --git a/client/src/main/java/ctbrec/ui/Player.java b/client/src/main/java/ctbrec/ui/Player.java index d5c4fec7..afb6b1cb 100644 --- a/client/src/main/java/ctbrec/ui/Player.java +++ b/client/src/main/java/ctbrec/ui/Player.java @@ -17,9 +17,7 @@ import ctbrec.io.DevNull; import ctbrec.io.StreamRedirectThread; import ctbrec.recorder.download.StreamSource; import ctbrec.ui.controls.Dialogs; -import javafx.application.Platform; import javafx.scene.Scene; -import javafx.scene.control.Alert; public class Player { private static final transient Logger LOG = LoggerFactory.getLogger(Player.class); @@ -80,23 +78,12 @@ public class Player { LOG.debug("Playing {}", best.getMediaPlaylistUrl()); return Player.play(best.getMediaPlaylistUrl(), async); } else { - Platform.runLater(() -> { - Alert alert = new AutosizeAlert(Alert.AlertType.INFORMATION); - alert.setTitle("Room not public"); - alert.setHeaderText("Room is currently not public"); - alert.showAndWait(); - }); + Dialogs.showError(scene, "Room not public", "Room is currently not public", null); return false; } } catch (Exception e1) { LOG.error("Couldn't get stream information for model {}", model, e1); - Platform.runLater(() -> { - Alert alert = new AutosizeAlert(Alert.AlertType.ERROR); - alert.setTitle("Error"); - alert.setHeaderText("Couldn't determine stream URL"); - alert.setContentText(e1.getLocalizedMessage()); - alert.showAndWait(); - }); + Dialogs.showError(scene, "Couldn't determine stream URL", e1.getLocalizedMessage(), e1); return false; } }