public class Player
{
private PlayList playList;
public Track currentTrack;
boolean stopped = false;
public Player()
{
playList = new PlayList("audio");
}
public PlayList getPlayList()
{
return playList;
}
public void play()
{
stop();
if(stopped = true){
currentTrack.play();
stopped = false;
}
}
public void stop()
{
currentTrack.stop();
currentTrack.rewind();
stopped = true;
}
public void setTrack(int trackNumber)
{
currentTrack = playList.getTrack(trackNumber);
}
public String getTrackName()
{
return currentTrack.getName();
}
public String getTrackInfo()
{
getTrackName();
currentTrack.getDuration();
return getTrackName() + " (" + currentTrack.getDuration() + ") " +
"seconds";
}
}
我试图阻止音频在彼此上面播放。非常基本的代码(即时学习基础哈哈)这是一个学校作业顺便说一句。一切都完成了,除了音频保持在彼此的顶部,而不是停止播放的第一个音频。