Package com.google.android.exoplayer2.ext.mediasession

## Class RepeatModeActionProvider

- java.lang.Object
- - com.google.android.exoplayer2.ext.mediasession.RepeatModeActionProvider

- All Implemented Interfaces:
    `MediaSessionConnector.CustomActionProvider`

      public final class RepeatModeActionProvider
      extends Object
      implements MediaSessionConnector.CustomActionProvider

  Provides a custom action for toggling repeat modes.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_REPEAT_TOGGLE_MODES` | The default repeat toggle modes.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RepeatModeActionProvider​(Context context)` | Creates a new instance.
    `RepeatModeActionProvider​(Context context, int repeatToggleModes)` | Creates a new instance enabling the given repeat toggle modes.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `android.support.v4.media.session.PlaybackStateCompat.CustomAction` | `getCustomAction​(Player player)` | Returns a `PlaybackStateCompat.CustomAction` which will be published to the media session by the connector or `null` if this action should not be published at the given player state.
    `void` | `onCustomAction​(Player player, ControlDispatcher controlDispatcher, String action, Bundle extras)` | Called when a custom action provided by this provider is sent to the media session.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_REPEAT_TOGGLE_MODES

          @RepeatToggleModes
          public static final int DEFAULT_REPEAT_TOGGLE_MODES

      The default repeat toggle modes.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RepeatModeActionProvider

          public RepeatModeActionProvider​(Context context)

      Creates a new instance.

      Equivalent to `RepeatModeActionProvider(context, DEFAULT_REPEAT_TOGGLE_MODES)`.

      Parameters:
        `context` - The context.

    - #### RepeatModeActionProvider

          public RepeatModeActionProvider​(Context context,
                                          @RepeatToggleModes
                                          int repeatToggleModes)

      Creates a new instance enabling the given repeat toggle modes.
      Parameters:
        `context` - The context.
        `repeatToggleModes` - The toggle modes to enable.

  - ### Method Detail

    - #### onCustomAction

          public void onCustomAction​(Player player,
                                     ControlDispatcher controlDispatcher,
                                     String action,
                                     @Nullable
                                     Bundle extras)

      Description copied from interface: `MediaSessionConnector.CustomActionProvider`
      Called when a custom action provided by this provider is sent to the media session.
      Specified by:
        `onCustomAction` in interface `MediaSessionConnector.CustomActionProvider`
      Parameters:
        `player` - The player connected to the media session.
        `controlDispatcher` - A `ControlDispatcher` that should be used for dispatching changes to the player.
        `action` - The name of the action which was sent by a media controller.
        `extras` - Optional extras sent by a media controller, may be null.

    - #### getCustomAction

          public android.support.v4.media.session.PlaybackStateCompat.CustomAction getCustomAction​(Player player)

      Description copied from interface: `MediaSessionConnector.CustomActionProvider`
      Returns a `PlaybackStateCompat.CustomAction` which will be published to the media session by the connector or `null` if this action should not be published at the given player state.
      Specified by:
        `getCustomAction` in interface `MediaSessionConnector.CustomActionProvider`
      Parameters:
        `player` - The player connected to the media session.
      Returns:
        The custom action to be included in the session playback state or `null`.