public void run() { // Play song System.out.println("Playing song: " + song); songQueue.add(new File(song)); musicHome.refreshQueue(); musicPlayer.setSong(songQueue.remove(0)); musicHome.refreshQueue(); if (!musicPlayer.isPlaying()) { musicPlayer.play(-1); } t.cancel(); }
public void run() { list.load(musicHome.getMusicDirectory().getAbsolutePath() + "/" + list.getName()); // add all songs in Playlist to queue, refresh, and play for (int i = 0; i < list.getSize(); i++) { list.setPosition(i); songQueue.add(new File(list.getCurrentSong())); } musicHome.refreshQueue(); musicPlayer.setSong(songQueue.remove(0)); musicHome.refreshQueue(); if (!musicPlayer.isPlaying()) { musicPlayer.play(-1); } t.cancel(); }
scheduledPlaylist(Playlist list, MusicHome mh) { this.list = list; this.musicHome = mh; this.musicPlayer = mh.getMusicPlayer(); this.songQueue = mh.getSongQueue(); }
scheduledSong(String song, MusicHome mh) { this.song = song; this.musicHome = mh; this.musicPlayer = mh.getMusicPlayer(); this.songQueue = mh.getSongQueue(); }