Exemplo n.º 1
0
 void updateStatusBar() {
   try {
     mPlayer.getPlayerState(updateStatusBarPlayerStateCallback);
   } catch (Exception e) {
     e.printStackTrace();
     mPlayerStatusTask.cancel(true);
   }
 }
Exemplo n.º 2
0
 @Override
 public void onClick(View view) {
   if (mPlayer != null && mPlayer.isInitialized() && mPlayer.isLoggedIn()) {
     if (mPlayerStatusTask.getStatus().equals(AsyncTask.Status.PENDING)) {
       mPlayerStatusTask.execute();
     }
     mPlayer.getPlayerState(playPauseButtonPressedPlayerStateCallback);
   }
 }
Exemplo n.º 3
0
 public void onShowPlayerStateButtonClicked(View view) {
   mPlayer.getPlayerState(
       new PlayerStateCallback() {
         @Override
         public void onPlayerState(PlayerState playerState) {
           logStatus("-- Current player state --");
           logStatus("Playing? " + playerState.playing);
           logStatus("Position: " + playerState.positionInMs + "ms");
           logStatus("Shuffling? " + playerState.shuffling);
           logStatus("Repeating? " + playerState.repeating);
           logStatus("Active device? " + playerState.activeDevice);
           logStatus("Track uri: " + playerState.trackUri);
           logStatus("Track duration: " + playerState.durationInMs);
         }
       });
 }
Exemplo n.º 4
0
  @Override
  protected void onResume() {
    Log.d("DEBUG_JRM", "ONRESUME");
    super.onResume();
    slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
    try {
      if (mPlayer.isInitialized()) {
        mPlayer.getPlayerState(setPlayPauseButtonIconPlayerStateCallback);
        Log.d("DEBUG_JRM", "RESUME PLAYER INIT");
        if (mPlayerStatusTask.getStatus().equals(AsyncTask.Status.PENDING)) {
          Log.d("DEBUG_JRM", "RESUME STAT PENDING");
          mPlayerStatusTask.execute();
        }
      }
    } catch (NullPointerException e) {

    }
  }