List of usage examples for android.media RemoteControlClient PLAYSTATE_BUFFERING
int PLAYSTATE_BUFFERING
To view the source code for android.media RemoteControlClient PLAYSTATE_BUFFERING.
Click Source Link
From source file:com.achep.acdisplay.services.media.MediaController2KitKat.java
@NonNull static SparseIntArray generatePlaybackCompatSparse() { SparseIntArray sia = new SparseIntArray(); sia.put(RemoteControlClient.PLAYSTATE_BUFFERING, PlaybackStateCompat.STATE_BUFFERING); sia.put(RemoteControlClient.PLAYSTATE_PLAYING, PlaybackStateCompat.STATE_PLAYING); sia.put(RemoteControlClient.PLAYSTATE_PAUSED, PlaybackStateCompat.STATE_PAUSED); sia.put(RemoteControlClient.PLAYSTATE_ERROR, PlaybackStateCompat.STATE_ERROR); sia.put(RemoteControlClient.PLAYSTATE_REWINDING, PlaybackStateCompat.STATE_REWINDING); sia.put(RemoteControlClient.PLAYSTATE_FAST_FORWARDING, PlaybackStateCompat.STATE_FAST_FORWARDING); sia.put(RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS, PlaybackStateCompat.STATE_SKIPPING_TO_NEXT); sia.put(RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS, PlaybackStateCompat.STATE_SKIPPING_TO_PREVIOUS); return sia;/*from w w w . jav a 2 s . co m*/ }
From source file:com.bullmobi.message.services.media.MediaController2KitKat.java
/** * {@inheritDoc}// w w w . j a v a 2 s. c o m */ protected MediaController2KitKat(@NonNull Activity activity) { super(activity); SparseIntArray cachedStateSparse = sStateSparse.get(); if (cachedStateSparse == null) { mStateSparse = new SparseIntArray(); mStateSparse.put(RemoteControlClient.PLAYSTATE_BUFFERING, PlaybackStateCompat.STATE_BUFFERING); mStateSparse.put(RemoteControlClient.PLAYSTATE_PLAYING, PlaybackStateCompat.STATE_PLAYING); mStateSparse.put(RemoteControlClient.PLAYSTATE_PAUSED, PlaybackStateCompat.STATE_PAUSED); mStateSparse.put(RemoteControlClient.PLAYSTATE_ERROR, PlaybackStateCompat.STATE_ERROR); mStateSparse.put(RemoteControlClient.PLAYSTATE_REWINDING, PlaybackStateCompat.STATE_REWINDING); mStateSparse.put(RemoteControlClient.PLAYSTATE_FAST_FORWARDING, PlaybackStateCompat.STATE_FAST_FORWARDING); mStateSparse.put(RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS, PlaybackStateCompat.STATE_SKIPPING_TO_NEXT); mStateSparse.put(RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS, PlaybackStateCompat.STATE_SKIPPING_TO_PREVIOUS); // Cache sparse array sStateSparse = new WeakReference<>(mStateSparse); } else { mStateSparse = cachedStateSparse; } }
From source file:github.popeen.dsub.util.compat.RemoteControlClientLP.java
@Override public void setPlaybackState(int state, int index, int queueSize) { PlaybackStateCompat.Builder builder = new PlaybackStateCompat.Builder(); int newState = PlaybackStateCompat.STATE_NONE; switch (state) { case RemoteControlClient.PLAYSTATE_PLAYING: newState = PlaybackStateCompat.STATE_PLAYING; break;/*from www .jav a 2s . com*/ case RemoteControlClient.PLAYSTATE_STOPPED: newState = PlaybackStateCompat.STATE_STOPPED; break; case RemoteControlClient.PLAYSTATE_PAUSED: newState = PlaybackStateCompat.STATE_PAUSED; break; case RemoteControlClient.PLAYSTATE_BUFFERING: newState = PlaybackStateCompat.STATE_BUFFERING; break; } long position = -1; if (state == RemoteControlClient.PLAYSTATE_PLAYING || state == RemoteControlClient.PLAYSTATE_PAUSED) { position = downloadService.getPlayerPosition(); } builder.setState(newState, position, 1.0f); DownloadFile downloadFile = downloadService.getCurrentPlaying(); Entry entry = null; boolean isSong = true; if (downloadFile != null) { entry = downloadFile.getSong(); isSong = entry.isSong(); } builder.setActions(getPlaybackActions(isSong, index, queueSize)); if (entry != null) { addCustomActions(entry, builder); builder.setActiveQueueItemId(entry.getId().hashCode()); } PlaybackStateCompat playbackState = builder.build(); mediaSession.setPlaybackState(playbackState); previousState = state; }
From source file:com.namelessdev.mpdroid.NotificationService.java
/** * Get the RemoteControlClient status for the corresponding MPDStatus * * @param mpdStatus MPDStatus to parse/*w w w . j a v a 2s. co m*/ * @return state to give to RemoteControlClient */ private int getRemoteState(final MPDStatus mpdStatus) { final int state; if (mpdStatus == null) { state = RemoteControlClient.PLAYSTATE_ERROR; } else if (mediaPlayerServiceIsBuffering) { state = RemoteControlClient.PLAYSTATE_BUFFERING; } else { switch (mpdStatus.getState()) { case MPDStatus.MPD_STATE_PLAYING: state = RemoteControlClient.PLAYSTATE_PLAYING; break; case MPDStatus.MPD_STATE_STOPPED: state = RemoteControlClient.PLAYSTATE_STOPPED; break; default: state = RemoteControlClient.PLAYSTATE_PAUSED; break; } } return state; }
From source file:com.firefly.sample.castcompanionlibrary.cast.VideoCastManager.java
@SuppressLint("InlinedApi") private void updateRemoteControl(boolean playing) { if (!isFeatureEnabled(FEATURE_LOCKSCREEN)) { return;// w w w .j a va 2s. c om } if (!isConnected()) { removeRemoteControlClient(); return; } try { if (null == mRemoteControlClientCompat && playing) { setUpRemoteControl(getRemoteMediaInformation()); } if (mRemoteControlClientCompat != null) { int playState = isRemoteStreamLive() ? RemoteControlClient.PLAYSTATE_BUFFERING : RemoteControlClient.PLAYSTATE_PLAYING; mRemoteControlClientCompat .setPlaybackState(playing ? playState : RemoteControlClient.PLAYSTATE_PAUSED); } } catch (TransientNetworkDisconnectionException e) { LOGE(TAG, "Failed to setup RCC due to network issues", e); } catch (NoConnectionException e) { LOGE(TAG, "Failed to setup RCC due to network issues", e); } }
From source file:air.com.snagfilms.cast.chromecast.VideoChromeCastManager.java
@SuppressLint("InlinedApi") private void updateRemoteControl(boolean playing) { if (!isFeatureEnabled(FEATURE_LOCKSCREEN)) { return;//w w w .j a v a2s .co m } if (!isConnected()) { removeRemoteControlClient(); return; } try { if (null == mRemoteControlClientCompat && playing) { setUpRemoteControl(getRemoteMediaInformation()); } if (mRemoteControlClientCompat != null) { int playState = isRemoteStreamLive() ? RemoteControlClient.PLAYSTATE_BUFFERING : RemoteControlClient.PLAYSTATE_PLAYING; mRemoteControlClientCompat .setPlaybackState(playing ? playState : RemoteControlClient.PLAYSTATE_PAUSED); } } catch (TransientNetworkDisconnectionException e) { Log.e(TAG, "Failed to setup RCC due to network issues", e); } catch (NoConnectionException e) { Log.e(TAG, "Failed to setup RCC due to network issues", e); } }
From source file:com.google.sample.castcompanionlibrary.cast.VideoCastManager.java
@SuppressLint("InlinedApi") private void updateRemoteControl(boolean playing) { LOGD(TAG, "updateRemoteControl()"); if (!isFeatureEnabled(FEATURE_LOCKSCREEN)) { return;/* www .j a v a 2 s .c o m*/ } if (!isConnected()) { return; } try { if (null == mRemoteControlClientCompat && playing) { setUpRemoteControl(getRemoteMediaInformation()); } if (mRemoteControlClientCompat != null) { int playState = isRemoteStreamLive() ? RemoteControlClient.PLAYSTATE_BUFFERING : RemoteControlClient.PLAYSTATE_PLAYING; mRemoteControlClientCompat .setPlaybackState(playing ? playState : RemoteControlClient.PLAYSTATE_PAUSED); } } catch (TransientNetworkDisconnectionException e) { LOGE(TAG, "Failed to setup RCC due to network issues", e); } catch (NoConnectionException e) { LOGE(TAG, "Failed to setup RCC due to network issues", e); } }
From source file:com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void updateRemoteControl(boolean playing) { if (!isFeatureEnabled(FEATURE_LOCKSCREEN)) { return;/*from w w w . j a v a 2 s . c o m*/ } if (!isConnected()) { return; } try { if ((mRemoteControlClientCompat == null) && playing) { setUpRemoteControl(getRemoteMediaInformation()); } if (mRemoteControlClientCompat != null) { int playState = isRemoteStreamLive() ? RemoteControlClient.PLAYSTATE_BUFFERING : RemoteControlClient.PLAYSTATE_PLAYING; mRemoteControlClientCompat .setPlaybackState(playing ? playState : RemoteControlClient.PLAYSTATE_PAUSED); } } catch (TransientNetworkDisconnectionException | NoConnectionException e) { LOGE(TAG, "Failed to set up RCC due to network issues", e); } }