Example usage for android.media RemoteControlClient PLAYSTATE_ERROR

List of usage examples for android.media RemoteControlClient PLAYSTATE_ERROR

Introduction

In this page you can find the example usage for android.media RemoteControlClient PLAYSTATE_ERROR.

Prototype

int PLAYSTATE_ERROR

To view the source code for android.media RemoteControlClient PLAYSTATE_ERROR.

Click Source Link

Document

Playback state of a RemoteControlClient which cannot perform any playback related operation because of an internal error.

Usage

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 va 2 s  . com*/
}

From source file:com.bullmobi.message.services.media.MediaController2KitKat.java

/**
 * {@inheritDoc}/*from   www.  j  a v a 2s .  co 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:com.namelessdev.mpdroid.NotificationService.java

/**
 * Get the RemoteControlClient status for the corresponding MPDStatus
 *
 * @param mpdStatus MPDStatus to parse// w w w .ja  va2 s .c  o  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;
}