Make use of the Dialogs class instead of creation own alerts
This commit is contained in:
parent
9302dffd7f
commit
a41223397d
|
@ -17,9 +17,7 @@ import ctbrec.io.DevNull;
|
||||||
import ctbrec.io.StreamRedirectThread;
|
import ctbrec.io.StreamRedirectThread;
|
||||||
import ctbrec.recorder.download.StreamSource;
|
import ctbrec.recorder.download.StreamSource;
|
||||||
import ctbrec.ui.controls.Dialogs;
|
import ctbrec.ui.controls.Dialogs;
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
|
|
||||||
public class Player {
|
public class Player {
|
||||||
private static final transient Logger LOG = LoggerFactory.getLogger(Player.class);
|
private static final transient Logger LOG = LoggerFactory.getLogger(Player.class);
|
||||||
|
@ -80,23 +78,12 @@ public class Player {
|
||||||
LOG.debug("Playing {}", best.getMediaPlaylistUrl());
|
LOG.debug("Playing {}", best.getMediaPlaylistUrl());
|
||||||
return Player.play(best.getMediaPlaylistUrl(), async);
|
return Player.play(best.getMediaPlaylistUrl(), async);
|
||||||
} else {
|
} else {
|
||||||
Platform.runLater(() -> {
|
Dialogs.showError(scene, "Room not public", "Room is currently not public", null);
|
||||||
Alert alert = new AutosizeAlert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle("Room not public");
|
|
||||||
alert.setHeaderText("Room is currently not public");
|
|
||||||
alert.showAndWait();
|
|
||||||
});
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
LOG.error("Couldn't get stream information for model {}", model, e1);
|
LOG.error("Couldn't get stream information for model {}", model, e1);
|
||||||
Platform.runLater(() -> {
|
Dialogs.showError(scene, "Couldn't determine stream URL", e1.getLocalizedMessage(), e1);
|
||||||
Alert alert = new AutosizeAlert(Alert.AlertType.ERROR);
|
|
||||||
alert.setTitle("Error");
|
|
||||||
alert.setHeaderText("Couldn't determine stream URL");
|
|
||||||
alert.setContentText(e1.getLocalizedMessage());
|
|
||||||
alert.showAndWait();
|
|
||||||
});
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue