public void processAddRequest(MusicItem musicItem) { Logger.debug(TAG, ">>>" + "processAddRequest"); listMusic.clear(); currentPos = 0; this.currentItem = musicItem; tryToGetAudioFocus(); playNextSong(musicItem); }
public void processAllList(List<? extends MusicItem> list) { if (list == null || list.size() == 0) { return; } this.listMusic.clear(); this.listMusic.addAll(list); currentPos = 0; currentItem = listMusic.get(currentPos); playNextSong(currentItem); }
@Override public void onCompletion(MediaPlayer mediaPlayer) { if (listMusic.isEmpty()) { return; } currentPos++; if (currentPos == listMusic.size()) { currentPos = 0; } currentItem = listMusic.get(currentPos); playNextSong(currentItem); }
@Override public boolean onError(MediaPlayer mediaPlayer, int i, int i1) { if (listMusic.isEmpty()) { return false; } currentPos++; if (currentPos == listMusic.size()) { currentPos = 0; } currentItem = listMusic.get(currentPos); playNextSong(currentItem); return true; }
public void processPlayRequest() { Logger.debug(TAG, ">>>" + "processPlayRequest"); tryToGetAudioFocus(); if (mState == State.Stopped) { if (!listMusic.isEmpty() && currentItem != null) { currentItem = listMusic.get(currentPos); playNextSong(currentItem); } } else if (mState == State.Paused) { mState = State.Playing; setupAsForeGround(currentItem); configAndStartMediaPlayer(); } }