I have an audio player, I have found how to add a single file to the audio inputstream, but I have an arraylist of files I want to add. How should I do that?
public class AudioPlayer {
Long currentFrame;
Clip clip;
// current status of clip
String status;
AudioInputStream musicInputStream;
// constructor to initialize streams and clip
public AudioPlayer(Schedule schedule,List<File> files)
throws UnsupportedAudioFileException,
IOException, LineUnavailableException
{
// create AudioInputStream object
musicInputStream =
AudioSystem.getAudioInputStream(files.get(0).getAbsoluteFile());
// create clip reference
clip = AudioSystem.getClip();
// open audioInputStream to the clip
clip.open(musicInputStream);
clip.loop(Clip.LOOP_CONTINUOUSLY);
}
}