Example usage for android.support.v4.media.session PlaybackStateCompat STATE_NONE

List of usage examples for android.support.v4.media.session PlaybackStateCompat STATE_NONE

Introduction

In this page you can find the example usage for android.support.v4.media.session PlaybackStateCompat STATE_NONE.

Prototype

int STATE_NONE

To view the source code for android.support.v4.media.session PlaybackStateCompat STATE_NONE.

Click Source Link

Document

This is the default playback state and indicates that no media has been added yet, or the performer has been reset and has no content to play.

Usage

From source file:com.achep.acdisplay.services.media.MediaControlsHelper.java

@Override
public void onPlaybackStateChanged(int state) {
    Check.getInstance().isInMainThread();
    switch (state) {
    case PlaybackStateCompat.STATE_PLAYING:
        mHandler.removeMessages(H.MSG_HIDE_MEDIA_WIDGET);
        if (!mShowing) {
            mShowing = true;/* ww w. j  a va2s.c  om*/
            notifyOnStateChanged();
        }
        break;
    default:
        if (mShowing) {
            int delay = state == PlaybackStateCompat.STATE_NONE ? 500 : DELAY;
            mHandler.sendEmptyMessageDelayed(H.MSG_HIDE_MEDIA_WIDGET, delay);
        }
        break;
    }
}

From source file:com.classiqo.nativeandroid_32bitz.playback.LocalPlayback.java

public LocalPlayback(Context context, MusicProvider musicProvider) {
    this.mContext = context;
    this.mMusicProvider = musicProvider;
    this.mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    this.mWifiLock = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE))
            .createWifiLock(WifiManager.WIFI_MODE_FULL, "nA_32bitz_lock");
    this.mState = PlaybackStateCompat.STATE_NONE;
}

From source file:net.simno.klingar.playback.LocalPlayback.java

LocalPlayback(Context context, MusicController musicController, AudioManager audioManager,
        WifiManager wifiManager) {//  w  ww.  ja v a2s . c o m
    this.context = context;
    this.musicController = musicController;
    this.audioManager = audioManager;
    this.wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, "klingar_lock");
    this.state = PlaybackStateCompat.STATE_NONE;
    String agent = Util.getUserAgent(context, context.getResources().getString(R.string.app_name));
    this.dataSourceFactory = new DefaultDataSourceFactory(context, agent, null);
    this.extractorsFactory = new DefaultExtractorsFactory();
}

From source file:com.allthatseries.RNAudioPlayer.Playback.java

public Playback(Context context) {
    this.mContext = context;
    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, "playback_lock");
    this.mState = PlaybackStateCompat.STATE_NONE;
}

From source file:com.classiqo.nativeandroid_32bitz.ui.BaseActivity.java

protected boolean shouldShowControls() {
    MediaControllerCompat mediaController = getSupportMediaController();

    if (mediaController == null || mediaController.getMetadata() == null
            || mediaController.getPlaybackState() == null) {
        return false;
    }/*  w w  w  . ja  v a 2s .  c o  m*/

    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.chu.googleplaylibrary.playback.LocalPlayback.java

public LocalPlayback(Context context, String mMusicProvider) {
    this.mContext = context;
    this.mMusicProvider = mMusicProvider;
    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:dk.glutter.android.knr.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, "knr_lock");
    this.mState = PlaybackStateCompat.STATE_NONE;
}

From source file:nuclei.media.playback.FallbackPlayback.java

public FallbackPlayback(MediaService service) {
    mService = service;//from   w  w  w . j  a va2s .co  m
    this.mAudioManager = (AudioManager) mService.getSystemService(Context.AUDIO_SERVICE);
    // Create the Wifi lock (this does not acquire the lock, this just creates it)
    this.mWifiLock = ((WifiManager) mService.getApplicationContext().getSystemService(Context.WIFI_SERVICE))
            .createWifiLock(WifiManager.WIFI_MODE_FULL, "uAmp_lock");
    this.mState = PlaybackStateCompat.STATE_NONE;
}

From source file:rocks.stalin.android.app.playback.RemotePlayback.java

public RemotePlayback(Context context, MusicProvider musicProvider, OffsetSource timeProvider,
        TaskScheduler scheduler) {//from  ww w  . ja  va 2s. c  o m
    this.mContext = context;
    this.mMusicProvider = musicProvider;
    this.mAudioManager = (AudioManager) context.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
    // Create the Wifi lock (this does not acquire the lock, this just creates it)
    this.mWifiLock = ((WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE))
            .createWifiLock(WifiManager.WIFI_MODE_FULL, "smus_lock");
    this.timeProvider = timeProvider;
    this.scheduler = scheduler;
    this.mState = PlaybackStateCompat.STATE_NONE;
}

From source file:com.scooter1556.sms.lib.android.service.AudioPlayerService.java

@Override
public void onCreate() {
    // Create the service
    super.onCreate();

    restService = RESTService.getInstance();

    currentListPosition = 0;/* w  w w  . j  a  v a2 s.c o m*/

    mediaElementList = new ArrayList<>();

    // Setup media session
    mediaSessionCallback = new MediaSessionCallback();
    mediaSession = new MediaSessionCompat(this, "SMSPlayer");
    mediaSession.setFlags(
            MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS | MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
    mediaSession.setCallback(mediaSessionCallback);
    mediaState = PlaybackStateCompat.STATE_NONE;
    updatePlaybackState();

    audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "sms");
    wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL,
            "sms");
}