class BackgroundMusicManager {

    MediaPlayer createMediaPlayer(String source) {
        try {
            final Media media = new Media(source);
            final MediaPlayer player = makeMediaPlayer(media);
            player.setOnError(() -> log.error("error on audio media loading : " + player.getError()));
            player.volumeProperty().bindBidirectional(ActiveConfigurationContext.getInstance().getMusicVolumeProperty());
            player.setOnEndOfMedia(this::next);

            return player;
        } catch (MediaException e) {
            log.error("error while loading media {}, type : {}", source, e.getType(), e);
        }
        return null;
    }

    public  BackgroundMusicManager();

}