public void Restart() { if (player != null && !player.getSourceLocation().equals(null) || !player.getSourceLocation().equals("")) { player.stop(); player.play(); } }
/** * Constructs a new MusicPlayer object, to use the specified music file. * * @param filePath - path to the music file. * @param volume - volume the file should be played at. */ public MP3MusicPlayer(String filename) { super(filename); try { player = new Player(); // player.setCurrentVolume(volume); player.setSourceLocation(filename); } catch (Exception e) { e.printStackTrace(); } }
/** Pauses the music file. */ public void Pause() { if (player != null && !player.getSourceLocation().equals(null) || !player.getSourceLocation().equals("")) { player.pause(); } }