Example usage for android.media RemoteControlClient FLAG_KEY_MEDIA_FAST_FORWARD

List of usage examples for android.media RemoteControlClient FLAG_KEY_MEDIA_FAST_FORWARD

Introduction

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

Prototype

int FLAG_KEY_MEDIA_FAST_FORWARD

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

Click Source Link

Document

Flag indicating a RemoteControlClient makes use of the "fast forward" media key.

Usage

From source file:com.wojtechnology.sunami.MediaSessionCompatHelper.java

private static void ensureTransportControls(MediaSessionCompat session, PlaybackStateCompat playbackState) {
    long actions = playbackState.getActions();
    Object remoteObj = session.getRemoteControlClient();
    if (actions != 0 && remoteObj != null) {

        int transportControls = 0;

        if ((actions & PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS;
        }/*from  w ww.ja v  a  2s  .  c  om*/

        if ((actions & PlaybackStateCompat.ACTION_REWIND) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_REWIND;
        }

        if ((actions & PlaybackStateCompat.ACTION_PLAY) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_PLAY;
        }

        if ((actions & PlaybackStateCompat.ACTION_PLAY_PAUSE) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE;
        }

        if ((actions & PlaybackStateCompat.ACTION_PAUSE) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_PAUSE;
        }

        if ((actions & PlaybackStateCompat.ACTION_STOP) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_STOP;
        }

        if ((actions & PlaybackStateCompat.ACTION_FAST_FORWARD) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_FAST_FORWARD;
        }

        if ((actions & PlaybackStateCompat.ACTION_SKIP_TO_NEXT) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_NEXT;
        }

        if ((actions & PlaybackStateCompat.ACTION_SEEK_TO) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_POSITION_UPDATE;
        }

        if ((actions & PlaybackStateCompat.ACTION_SET_RATING) != 0) {
            transportControls |= RemoteControlClient.FLAG_KEY_MEDIA_RATING;
        }

        ((RemoteControlClient) remoteObj).setTransportControlFlags(transportControls);
    }
}