added in version 25.1.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
Deprecated since version 27.1.0

MediaControllerGlue

public abstract class MediaControllerGlue
extends PlaybackControlGlue

java.lang.Object
   ↳ android.support.v17.leanback.media.PlaybackGlue
     ↳ android.support.v17.leanback.media.PlaybackControlGlue
       ↳ android.support.v17.leanback.media.MediaControllerGlue


This class was deprecated in API level 27.1.0.
Use MediaControllerAdapter with PlaybackTransportControlGlue or PlaybackBannerControlGlue.

A helper class for implementing a glue layer for MediaControllerCompat.

Summary

Inherited constants

From class android.support.v17.leanback.media.PlaybackControlGlue

Public constructors

MediaControllerGlue(Context context, int[] fastForwardSpeeds, int[] rewindSpeeds)

Constructor for the glue.

Public methods

void attachToMediaController(MediaControllerCompat mediaController)

Attaches to the given media controller.

void detach()

Detaches from the media controller.

int getCurrentPosition()

Returns the current position of the media item in milliseconds.

int getCurrentSpeedId()

Returns the current playback speed.

Drawable getMediaArt()

Returns a bitmap of the art for the media item.

final MediaControllerCompat getMediaController()

Returns the media controller currently attached.

int getMediaDuration()

Returns the duration of the media item in milliseconds.

CharSequence getMediaSubtitle()

Returns the subtitle of the media item.

CharSequence getMediaTitle()

Returns the title of the media item.

long getSupportedActions()

Returns a bitmask of actions supported by the media player.

boolean hasValidMedia()

Returns true if there is a valid media item.

boolean isMediaPlaying()

Returns true if media is currently playing.

void next()

Goes to the next media item.

void pause()

Pauses the media player.

void play(int speed)

Start playback at the given speed.

void previous()

Goes to the previous media item.

Inherited methods

From class android.support.v17.leanback.media.PlaybackControlGlue
From class android.support.v17.leanback.media.PlaybackGlue
From class java.lang.Object
From interface android.support.v17.leanback.widget.OnActionClickedListener
From interface android.view.View.OnKeyListener

Public constructors

MediaControllerGlue

added in version 25.1.0
MediaControllerGlue (Context context, 
                int[] fastForwardSpeeds, 
                int[] rewindSpeeds)

Constructor for the glue.

Parameters
fastForwardSpeeds int: Array of seek speeds for fast forward.

rewindSpeeds int: Array of seek speeds for rewind.

Public methods

attachToMediaController

added in version 25.1.0
void attachToMediaController (MediaControllerCompat mediaController)

Attaches to the given media controller.

Parameters
mediaController MediaControllerCompat

detach

added in version 25.1.0
void detach ()

Detaches from the media controller. Must be called when the object is no longer needed.

getCurrentPosition

added in version 25.1.0
int getCurrentPosition ()

Returns the current position of the media item in milliseconds.

Returns
int

getCurrentSpeedId

added in version 25.1.0
int getCurrentSpeedId ()

Returns the current playback speed. When playing normally, PLAYBACK_SPEED_NORMAL should be returned.

Returns
int

getMediaArt

added in version 25.1.0
Drawable getMediaArt ()

Returns a bitmap of the art for the media item.

Returns
Drawable

getMediaController

added in version 25.1.0
MediaControllerCompat getMediaController ()

Returns the media controller currently attached.

Returns
MediaControllerCompat

getMediaDuration

added in version 25.1.0
int getMediaDuration ()

Returns the duration of the media item in milliseconds.

Returns
int

getMediaSubtitle

added in version 25.1.0
CharSequence getMediaSubtitle ()

Returns the subtitle of the media item.

Returns
CharSequence

getMediaTitle

added in version 25.1.0
CharSequence getMediaTitle ()

Returns the title of the media item.

Returns
CharSequence

getSupportedActions

added in version 25.1.0
long getSupportedActions ()

Returns a bitmask of actions supported by the media player.

Returns
long

hasValidMedia

added in version 25.1.0
boolean hasValidMedia ()

Returns true if there is a valid media item.

Returns
boolean

isMediaPlaying

added in version 25.1.0
boolean isMediaPlaying ()

Returns true if media is currently playing.

Returns
boolean

next

added in version 25.1.0
void next ()

Goes to the next media item. This method is optional.

pause

added in version 25.1.0
void pause ()

Pauses the media player.

play

added in version 25.1.0
void play (int speed)

Start playback at the given speed.

Parameters
speed int: The desired playback speed. For normal playback this will be PLAYBACK_SPEED_NORMAL; higher positive values for fast forward, and negative values for rewind.

previous

added in version 25.1.0
void previous ()

Goes to the previous media item. This method is optional.