code: private void playTrack(SoundCloudTrack track) {
          pauseTimer();
          try {
              // acquire lock on wifi.
              mWifiLock.acquire();
  
              mIsPaused = false;
              mIsPausedAfterAudioFocusChanged = false;
              mHasAlreadyPlayed = true;
  
              // 1 - UPDATE ALL VISUAL CALLBACK FIRST TO IMPROVE USER EXPERIENCE
  
              updateNotification();
              // update playback state as well as meta data.
              mMediaSession.setPlaybackState(MediaSessionWrapper.PLAYBACK_STATE_PLAYING);
              // start loading of the artwork.
              loadArtwork(this,
                      SoundCloudArtworkHelper.getArtworkUrl(track, SoundCloudArtworkHelper.XXXLARGE));
              // broadcast events
              Intent intent = new Intent(PlaybackListener.ACTION_ON_TRACK_PLAYED);
              intent.putExtra(PlaybackListener.EXTRA_KEY_TRACK, track);
              mLocalBroadcastManager.sendBroadcast(intent);
              Intent bufferingStart = new Intent(PlaybackListener.ACTION_ON_BUFFERING_STARTED);
              mLocalBroadcastManager.sendBroadcast(bufferingStart);
  
              // 2 - THEN PREPARE THE TRACK STREAMING
  
              // set media player to stop state in order to be able to call prepare.
              mMediaPlayer.reset();
  
              // set new data source
              mMediaPlayer.setDataSource(track.getStreamUrl() + SOUND_CLOUD_CLIENT_ID_PARAM
                      + mSoundCloundClientId);
  
              // Try to gain the audio focus before preparing and starting the media player.
              if (mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN)
                      == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
                  // prepare asynchronously the stream to be able to handle new action on the
                  // service thread such as a pause command.
                  mIsPreparing = true;
                  mMediaPlayer.prepareAsync();
              }
  
          } catch (IOException e) {
              Log.e(TAG, "File referencing not exist : " + track);
          }
      }
docs: Play a track.
  <p/>
  This method ensures that the media player will be in the right state to be able to play a new
  datasource.
  
  @param track track url.