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

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

Introduction

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

Prototype

int REPEAT_MODE_ONE

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

Click Source Link

Document

Use this value with MediaControllerCompat.TransportControls#setRepeatMode to indicate that the playback of the current playing media item will be repeated.

Usage

From source file:com.google.android.exoplayer2.ext.mediasession.DefaultPlaybackController.java

@Override
public void onSetRepeatMode(Player player, int repeatMode) {
    int selectedExoPlayerRepeatMode = player.getRepeatMode();
    switch (repeatMode) {
    case PlaybackStateCompat.REPEAT_MODE_ALL:
    case PlaybackStateCompat.REPEAT_MODE_GROUP:
        if ((repeatToggleModes & RepeatModeUtil.REPEAT_TOGGLE_MODE_ALL) != 0) {
            selectedExoPlayerRepeatMode = Player.REPEAT_MODE_ALL;
        }/*from  w  ww.  j a v a 2 s.c o m*/
        break;
    case PlaybackStateCompat.REPEAT_MODE_ONE:
        if ((repeatToggleModes & RepeatModeUtil.REPEAT_TOGGLE_MODE_ONE) != 0) {
            selectedExoPlayerRepeatMode = Player.REPEAT_MODE_ONE;
        }
        break;
    default:
        selectedExoPlayerRepeatMode = Player.REPEAT_MODE_OFF;
        break;
    }
    player.setRepeatMode(selectedExoPlayerRepeatMode);
}

From source file:android.support.v17.leanback.media.MediaControllerAdapter.java

/**
 * This function will translate the index of RepeatAction in PlaybackControlsRow to
 * the repeat mode which is defined by PlaybackStateCompat.
 *
 * @param repeatActionIndex Index of RepeatAction in PlaybackControlsRow.
 * @return Repeat Mode in playback state.
 */// w  w w.jav a2  s.co m
private int mapRepeatActionToRepeatMode(int repeatActionIndex) {
    switch (repeatActionIndex) {
    case PlaybackControlsRow.RepeatAction.INDEX_NONE:
        return PlaybackStateCompat.REPEAT_MODE_NONE;
    case PlaybackControlsRow.RepeatAction.INDEX_ALL:
        return PlaybackStateCompat.REPEAT_MODE_ALL;
    case PlaybackControlsRow.RepeatAction.INDEX_ONE:
        return PlaybackStateCompat.REPEAT_MODE_ONE;
    }
    return -1;
}