List of usage examples for android.support.v4.media.session PlaybackStateCompat STATE_CONNECTING
int STATE_CONNECTING
To view the source code for android.support.v4.media.session PlaybackStateCompat STATE_CONNECTING.
Click Source Link
From source file:com.scooter1556.sms.lib.android.service.AudioPlayerService.java
@Override public void onStateChanged(SMSAudioPlayer player, boolean playWhenReady, int playbackState) { switch (playbackState) { case ExoPlayer.STATE_BUFFERING: // Update state mediaState = PlaybackStateCompat.STATE_BUFFERING; updatePlaybackState();//from ww w . j ava 2s . com break; case ExoPlayer.STATE_ENDED: // Clean-up resources cleanupPlayer(); if (mediaElementList.size() > (currentListPosition + 1)) { currentListPosition++; initialiseTrack(currentListPosition); // Update state mediaState = PlaybackStateCompat.STATE_SKIPPING_TO_NEXT; updatePlaybackState(); } else { // Playlist has ended cleanupPlayer(); currentListPosition = 0; // Update state mediaState = PlaybackStateCompat.STATE_STOPPED; updatePlaybackState(); } // Update listeners for (AudioPlayerListener listener : listeners) { listener.PlaybackStateChanged(); listener.PlaylistPositionChanged(); } break; case ExoPlayer.STATE_IDLE: break; case ExoPlayer.STATE_PREPARING: // Update state mediaState = PlaybackStateCompat.STATE_CONNECTING; updatePlaybackState(); break; case ExoPlayer.STATE_READY: if (playWhenReady) { // Update state mediaState = PlaybackStateCompat.STATE_PLAYING; updatePlaybackState(); } break; default: break; } }
From source file:com.torrenttunes.android.MusicService.java
/** * Helper to switch to a different Playback instance * @param playback switch to this playback *///from w w w . j ava 2 s . co m private void switchToPlayer(Playback playback, boolean resumePlaying) { if (playback == null) { throw new IllegalArgumentException("Playback cannot be null"); } // suspend the current one. int oldState = mPlayback.getState(); int pos = mPlayback.getCurrentStreamPosition(); String currentMediaId = mPlayback.getCurrentMediaId(); LogHelper.d(TAG, "Current position from " + playback + " is ", pos); mPlayback.stop(false); playback.setCallback(this); playback.setCurrentStreamPosition(pos < 0 ? 0 : pos); playback.setCurrentMediaId(currentMediaId); playback.start(); // finally swap the instance mPlayback = playback; switch (oldState) { case PlaybackStateCompat.STATE_BUFFERING: case PlaybackStateCompat.STATE_CONNECTING: case PlaybackStateCompat.STATE_PAUSED: mPlayback.pause(); break; case PlaybackStateCompat.STATE_PLAYING: if (resumePlaying && QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) { mPlayback.play(mPlayingQueue.get(mCurrentIndexOnQueue)); } else if (!resumePlaying) { mPlayback.pause(); } else { mPlayback.stop(true); } break; case PlaybackStateCompat.STATE_NONE: break; default: LogHelper.d(TAG, "Default called. Old state is ", oldState); } }
From source file:androidx.media.widget.VideoView2.java
private int getCorrespondingPlaybackState() { switch (mCurrentState) { case STATE_ERROR: return PlaybackStateCompat.STATE_ERROR; case STATE_IDLE: return PlaybackStateCompat.STATE_NONE; case STATE_PREPARING: return PlaybackStateCompat.STATE_CONNECTING; case STATE_PREPARED: return PlaybackStateCompat.STATE_PAUSED; case STATE_PLAYING: return PlaybackStateCompat.STATE_PLAYING; case STATE_PAUSED: return PlaybackStateCompat.STATE_PAUSED; case STATE_PLAYBACK_COMPLETED: return PlaybackStateCompat.STATE_STOPPED; default:/*from w w w. j a va 2 s. c om*/ return -1; } }