List of usage examples for android.support.v4.media.session PlaybackStateCompat STATE_NONE
int STATE_NONE
To view the source code for android.support.v4.media.session PlaybackStateCompat STATE_NONE.
Click Source Link
From source file:com.bayapps.android.robophish.playback.LocalPlayback.java
public LocalPlayback(Context context, MusicProvider musicProvider) { this.mContext = context; this.mMusicProvider = musicProvider; this.mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); // Create the Wifi lock (this does not acquire the lock, this just creates it) this.mWifiLock = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "uAmp_lock"); this.mState = PlaybackStateCompat.STATE_NONE; }
From source file:com.doctoror.fuckoffmusicplayer.data.reporter.MediaSessionPlaybackReporter.java
@PlaybackStateCompat.State private static int toPlaybackStateCompat(@NonNull final PlaybackState state) { switch (state) { case STATE_LOADING: return PlaybackStateCompat.STATE_BUFFERING; case STATE_PLAYING: return PlaybackStateCompat.STATE_PLAYING; case STATE_PAUSED: return PlaybackStateCompat.STATE_PAUSED; case STATE_ERROR: return PlaybackStateCompat.STATE_ERROR; case STATE_IDLE: default://w ww. j a v a 2 s . c om return PlaybackStateCompat.STATE_NONE; } }
From source file:com.achep.acdisplay.services.media.MediaController2.java
/** * {@inheritDoc} */ @Override public void onStop(Object... objects) { mPlaybackState = PlaybackStateCompat.STATE_NONE; }
From source file:com.scooter1556.sms.android.activity.BaseActivity.java
/** * Check if the Media Session is active// www . ja v a2s. c o m */ protected boolean shouldShowControls() { MediaControllerCompat mediaController = MediaControllerCompat.getMediaController(this); if (mediaController == null || mediaController.getMetadata() == null || mediaController.getPlaybackState() == null) { return false; } switch (mediaController.getPlaybackState().getState()) { case PlaybackStateCompat.STATE_ERROR: case PlaybackStateCompat.STATE_NONE: case PlaybackStateCompat.STATE_STOPPED: return false; default: return true; } }
From source file:com.appdevper.mediaplayer.activity.BaseActivity.java
/** * Check if the MediaSession is active and in a "playback-able" state * (not NONE and not STOPPED).//from www .j av a 2s .c o m * * @return true if the MediaSession's state requires playback controls to be visible. */ protected boolean shouldShowControls() { MediaControllerCompat mediaController = getSupportMediaController(); if (mediaController == null || mediaController.getMetadata() == null || mediaController.getPlaybackState() == null) { return false; } switch (mediaController.getPlaybackState().getState()) { case PlaybackStateCompat.STATE_ERROR: case PlaybackStateCompat.STATE_NONE: case PlaybackStateCompat.STATE_STOPPED: return false; default: return true; } }
From source file:com.murati.oszk.audiobook.playback.LocalPlayback.java
@Override public int getState() { if (mExoPlayer == null) { return mExoPlayerNullIsStopped ? PlaybackStateCompat.STATE_STOPPED : PlaybackStateCompat.STATE_NONE; }/*www . ja v a 2 s . com*/ switch (mExoPlayer.getPlaybackState()) { case ExoPlayer.STATE_IDLE: return PlaybackStateCompat.STATE_PAUSED; case ExoPlayer.STATE_BUFFERING: return PlaybackStateCompat.STATE_BUFFERING; case ExoPlayer.STATE_READY: return mExoPlayer.getPlayWhenReady() ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED; case ExoPlayer.STATE_ENDED: return PlaybackStateCompat.STATE_PAUSED; default: return PlaybackStateCompat.STATE_NONE; } }
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;/* ww w . j a v a2s.co 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:com.murati.oszk.audiobook.ui.BaseActivity.java
/** * Check if the MediaSession is active and in a "playback-able" state * (not NONE and not STOPPED).//from w w w. j av a 2 s . c o m * * @return true if the MediaSession's state requires playback controls to be visible. */ protected boolean shouldShowControls() { MediaControllerCompat mediaController = MediaControllerCompat.getMediaController(this); if (mediaController == null || mediaController.getMetadata() == null || mediaController.getPlaybackState() == null) { return false; } switch (mediaController.getPlaybackState().getState()) { case PlaybackStateCompat.STATE_ERROR: case PlaybackStateCompat.STATE_NONE: case PlaybackStateCompat.STATE_STOPPED: return false; default: return true; } }
From source file:com.example.android.supportv4.media.MediaBrowserServiceSupport.java
@Override public void onCreate() { super.onCreate(); Log.d(TAG, "onCreate"); mPlayingQueue = new ArrayList<>(); mMusicProvider = new MusicProvider(); mPackageValidator = new PackageValidator(this); // Start a new MediaSession mSession = new MediaSessionCompat(this, "MusicService"); setSessionToken(mSession.getSessionToken()); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(//from w ww.j a v a 2 s .co m MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS | MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS); mPlayback = new Playback(this, mMusicProvider); mPlayback.setState(PlaybackStateCompat.STATE_NONE); mPlayback.setCallback(this); mPlayback.start(); Context context = getApplicationContext(); Intent intent = new Intent(context, MediaBrowserSupport.class); PendingIntent pi = PendingIntent.getActivity(context, 99 /*request code*/, intent, PendingIntent.FLAG_UPDATE_CURRENT); mSession.setSessionActivity(pi); Bundle extras = new Bundle(); CarHelper.setSlotReservationFlags(extras, true, true, true); mSession.setExtras(extras); updatePlaybackState(null); mMediaNotificationManager = new MediaNotificationManager(this); }
From source file:com.example.android.mediabrowserservice.MusicService.java
@Override public void onCreate() { super.onCreate(); LogHelper.d(TAG, "onCreate"); mPlayingQueue = new ArrayList<>(); mMusicProvider = new MusicProvider(); mPackageValidator = new PackageValidator(this); // Start a new MediaSession mSession = new MediaSessionCompat(this, "MusicService", new ComponentName(this, MediaNotificationManager.class), null); setSessionToken(mSession.getSessionToken()); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(/*from w w w. j a v a2 s .c o m*/ MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS | MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS); mPlayback = new Playback(this, mMusicProvider); mPlayback.setState(PlaybackStateCompat.STATE_NONE); mPlayback.setCallback(this); mPlayback.start(); Context context = getApplicationContext(); Intent intent = new Intent(context, MusicPlayerActivity.class); PendingIntent pi = PendingIntent.getActivity(context, 99 /*request code*/, intent, PendingIntent.FLAG_UPDATE_CURRENT); mSession.setSessionActivity(pi); Bundle extras = new Bundle(); CarHelper.setSlotReservationFlags(extras, true, true, true); mSession.setExtras(extras); updatePlaybackState(null); mMediaNotificationManager = new MediaNotificationManager(this); }