Example #1
0
  public void processAddRequest(MusicItem musicItem) {
    Logger.debug(TAG, ">>>" + "processAddRequest");
    listMusic.clear();
    currentPos = 0;
    this.currentItem = musicItem;

    tryToGetAudioFocus();
    playNextSong(musicItem);
  }
Example #2
0
  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);
  }
Example #3
0
 @Override
 public void onCompletion(MediaPlayer mediaPlayer) {
   if (listMusic.isEmpty()) {
     return;
   }
   currentPos++;
   if (currentPos == listMusic.size()) {
     currentPos = 0;
   }
   currentItem = listMusic.get(currentPos);
   playNextSong(currentItem);
 }
Example #4
0
 @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;
 }
Example #5
0
 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();
   }
 }