public static void toggle() {
        try {
            if (currentPlayback != null) {
                if (currentPlayback.getStatus() == MediaPlayer.Status.PLAYING) {
                    pause();
                } else {
                    play();
                }
            }
        } catch (MediaException e) {
            System.out.println("Invalid media type.");
        }
    }