forked from j62/ctbrec
1
0
Fork 0

Make use of the Dialogs class instead of creation own alerts

This commit is contained in:
0xboobface 2019-06-01 15:33:20 +02:00
parent 9302dffd7f
commit a41223397d
1 changed files with 2 additions and 15 deletions

View File

@ -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;
}
}