Play an Audio file Looped

suggest change

Needed imports:

import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;

This code will create a clip and play it continuously once started:

Clip clip = AudioSystem.getClip();
clip.open(AudioSystem.getAudioInputStream(new URL(filename)));
clip.start();
clip.loop(Clip.LOOP_CONTINUOUSLY);

Get an Array with all supported file types:

AudioFileFormat.Type [] audioFileTypes = AudioSystem.getAudioFileTypes();

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents