I want to play just an audio in a loop everytime this has finished. I have to say that is just backgroud music and it's running in a thread. Here's the code:
package Generator;
import javazoom.jl.player.Player;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javazoom.jl.decoder.JavaLayerException;
public class Reproductor {
Player reproductor;
public void reproducir() throws FileNotFoundException, JavaLayerException {
reproductor = new Player(new FileInputStream("C:\\Users\\Leonardo\\Desktop\\config generator\\Recursos\\Triage at dawn.mp3"));
new Thread () {
@Override
public void run() {
try {
reproductor.play(); //This just play the audio for the first time.
} catch (JavaLayerException ex) {
}
}
}.start();
}
public void parar() {
if(reproductor != null) {
reproductor.close();
}
}