Skip to content

The Playlist class

Ralph Niemitz edited this page May 21, 2017 · 1 revision

The Playlist class is what the name already says. A collection of tracks that can be played in a row. It also has properties for shuffling and looping.

An instance of Playlist already manages the resources, so you don't have to worry about closing the Audio instances inside of it.

Example:

try {

	Playlist playlist = new Playlist();
	playlist.add(new StreamedAudio("music1.mp3"));
	playlist.add(new StreamedAudio("music2.mp3"));
	playlist.add(new StreamedAudio("music3.mp3"));
	playlist.setLoop(true);
	playlist.setVolume(-20.0F);
	playlist.play();

} catch(AudioException exception) {

	exception.printStackTrace();
}
Clone this wiki locally