Fix: try/catch in audio load+
This commit is contained in:
@@ -145,11 +145,15 @@ public class GUI extends Application implements IView {
|
|||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
Platform.runLater(() -> primaryStage.setFullScreen(true));
|
Platform.runLater(() -> primaryStage.setFullScreen(true));
|
||||||
|
|
||||||
String musicUrl = getClass().getResource("/Audio/Music.mp3").toExternalForm();
|
try {
|
||||||
bgMusic = new MediaPlayer(new Media(musicUrl));
|
String musicUrl = getClass().getResource("/Audio/Music.mp3").toExternalForm();
|
||||||
bgMusic.setCycleCount(MediaPlayer.INDEFINITE);
|
bgMusic = new MediaPlayer(new Media(musicUrl));
|
||||||
bgMusic.setVolume(0.4);
|
bgMusic.setCycleCount(MediaPlayer.INDEFINITE);
|
||||||
bgMusic.play();
|
bgMusic.setVolume(0.4);
|
||||||
|
bgMusic.play();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("Audio unavailable: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user