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 intDEFAULT_REPEAT_TOGGLE_MODESThe 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.CustomActiongetCustomAction(Player player)Returns aPlaybackStateCompat.CustomActionwhich will be published to the media session by the connector ornullif this action should not be published at the given player state.voidonCustomAction(Player player, String action, Bundle extras)Called when a custom action provided by this provider is sent to the media session.
-
-
-
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, String action, @Nullable Bundle extras)
Description copied from interface:MediaSessionConnector.CustomActionProviderCalled when a custom action provided by this provider is sent to the media session.- Specified by:
onCustomActionin interfaceMediaSessionConnector.CustomActionProvider- Parameters:
player- The player connected to the media session.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.CustomActionProviderReturns aPlaybackStateCompat.CustomActionwhich will be published to the media session by the connector ornullif this action should not be published at the given player state.- Specified by:
getCustomActionin interfaceMediaSessionConnector.CustomActionProvider- Parameters:
player- The player connected to the media session.- Returns:
- The custom action to be included in the session playback state or
null.
-
-