List of usage examples for android.media RemoteControlClient PLAYSTATE_PAUSED
int PLAYSTATE_PAUSED
To view the source code for android.media RemoteControlClient PLAYSTATE_PAUSED.
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 . j a v a2s.co m }
From source file:com.bullmobi.message.services.media.MediaController2KitKat.java
/** * {@inheritDoc}//from w ww . j a va2s. c om */ 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;//w w w . j a v a 2 s .c o m 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:org.amahi.anywhere.service.AudioService.java
public void pauseAudio() { audioPlayer.pause(); audioPlayerRemote.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED); }
From source file:be.ugent.zeus.hydra.util.audiostream.MusicService.java
void processPauseRequest() { if (mState == State.Playing) { // Pause media player and cancel the 'foreground service' state. mState = State.Paused;//from w ww.ja v a 2s. co m mPlayer.pause(); relaxResources(false); // while paused, we always retain the MediaPlayer // do not give up audio focus } // Tell any remote controls that our playback state is 'paused'. if (mRemoteControlClientCompat != null) { mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED); } }
From source file:com.yamin.kk.service.AudioService.java
/** * A function to control the Remote Control Client. It is needed for * compatibility with devices below Ice Cream Sandwich (4.0). * * @param p Playback state/*from w ww .java 2s.c o m*/ */ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void setRemoteControlClientPlaybackState(int state) { if (!Util.isICSOrLater() || mRemoteControlClient == null) return; switch (state) { case EventHandler.MediaPlayerPlaying: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING); break; case EventHandler.MediaPlayerPaused: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED); break; case EventHandler.MediaPlayerStopped: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED); break; } }
From source file:com.dzt.musicplay.player.AudioService.java
/** * A function to control the Remote Control Client. It is needed for * compatibility with devices below Ice Cream Sandwich (4.0). * //from w w w . j a v a 2 s .com * @param p * Playback state */ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void setRemoteControlClientPlaybackState(int state) { if (!LibVlcUtil.isICSOrLater() || mRemoteControlClient == null) return; switch (state) { case EventHandler.MediaPlayerPlaying: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING); break; case EventHandler.MediaPlayerPaused: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED); break; case EventHandler.MediaPlayerStopped: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED); break; } }
From source file:org.videolan.vlc.PlaybackService.java
/** * A function to control the Remote Control Client. It is needed for * compatibility with devices below Ice Cream Sandwich (4.0). * * @param state Playback state//from w w w.jav a2 s .c om */ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void setRemoteControlClientPlaybackState(int state) { if (!AndroidUtil.isICSOrLater() || mRemoteControlClient == null) return; switch (state) { case EventHandler.MediaPlayerPlaying: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING); break; case EventHandler.MediaPlayerPaused: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED); break; case EventHandler.MediaPlayerStopped: mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED); break; } }
From source file:com.nd.android.u.square.service.MusicPlaybackService.java
void processPauseRequest() { if (mState == State.Playing) { // Pause media player and cancel the 'foreground service' state. mState = State.Paused;//from w ww .j a va2 s .c om mPlayer.pause(); relaxResources(false); // while paused, we always retain the MediaPlayer // do not give up audio focus if (null != sOnStateChangedListener) sOnStateChangedListener.onPlayerPaused(); } else if (mState == State.Preparing) { // ??MediaPlayer???MediaPlayer // Error?? processStopRequest(true); } // Tell any remote controls that our playback state is 'paused'. if (mRemoteControlClientCompat != null) { mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED); } }
From source file:co.shunya.gita.player.MusicService.java
void processPauseRequest() { if (mState == State.Retrieving) { // If we are still retrieving media, clear the flag that indicates we should start // playing when we're ready mStartPlayingAfterRetrieve = false; return;//ww w. ja va 2 s . co m } Log.i(TAG, "Current State of player:" + mState.toString()); if (mState == State.Playing) { // Pause media player and cancel the 'foreground service' state. setState(State.Paused); mPlayer.pause(); updateUI(); relaxResources(false); // while paused, we always retain the MediaPlayer // do not give up audio focus } updateNotification(mSongTitle + " (pause)", R.drawable.ic_state_pause); // Tell any remote controls that our playback state is 'paused'. if (mRemoteControlClientCompat != null) { mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED); } }