List of usage examples for android.media.session PlaybackState STATE_CONNECTING
int STATE_CONNECTING
To view the source code for android.media.session PlaybackState STATE_CONNECTING.
Click Source Link
From source file:com.example.android.mediabrowserservice.QueueFragment.java
private void onPlaybackStateChanged(PlaybackStateCompat state) { LogHelper.d(TAG, "onPlaybackStateChanged ", state); if (state == null) { return;/*from w w w . j a v a2 s .c o m*/ } mQueueAdapter.setActiveQueueItemId(state.getActiveQueueItemId()); mQueueAdapter.notifyDataSetChanged(); boolean enablePlay = false; StringBuilder statusBuilder = new StringBuilder(); switch (state.getState()) { case PlaybackState.STATE_PLAYING: statusBuilder.append("playing"); enablePlay = false; break; case PlaybackState.STATE_PAUSED: statusBuilder.append("paused"); enablePlay = true; break; case PlaybackState.STATE_STOPPED: statusBuilder.append("ended"); enablePlay = true; break; case PlaybackState.STATE_ERROR: statusBuilder.append("error: ").append(state.getErrorMessage()); break; case PlaybackState.STATE_BUFFERING: statusBuilder.append("buffering"); break; case PlaybackState.STATE_NONE: statusBuilder.append("none"); enablePlay = false; break; case PlaybackState.STATE_CONNECTING: statusBuilder.append("connecting"); break; default: statusBuilder.append(mPlaybackState); } statusBuilder.append(" -- At position: ").append(state.getPosition()); LogHelper.d(TAG, statusBuilder.toString()); if (enablePlay) { mPlayPause.setImageDrawable( ContextCompat.getDrawable(getActivity(), R.drawable.ic_play_arrow_white_24dp)); } else { mPlayPause.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.ic_pause_white_24dp)); } mSkipPrevious.setEnabled((state.getActions() & PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS) != 0); mSkipNext.setEnabled((state.getActions() & PlaybackStateCompat.ACTION_SKIP_TO_NEXT) != 0); LogHelper.d(TAG, "Queue From MediaController *** Title " + mMediaController.getQueueTitle() + "\n: Queue: " + mMediaController.getQueue() + "\n Metadata " + mMediaController.getMetadata()); }