Answer the question
In order to leave comments, you need to log in
How to write a normal audio player?
I have an ArrayList with paths to music files, the music class is like this:
public class Track {
public Media track;
public MediaPlayer player;
public Track(){
}
public void setMusic(String musicPath){
if(player!=null){
player.stop();
player.setAudioSpectrumListener(null);
}else{
track = new Media(new File(musicPath).toURI().toString());
player = new MediaPlayer(track);
}
}
public void playMusic(){
player.play();
}
public void pauseMusic(){
player.pause();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question