Android APIs
public abstract class

MediaControllerGlue

extends PlaybackControlGlue
java.lang.Object
   ↳ android.support.v17.leanback.app.PlaybackControlGlue
     ↳ android.support.v17.leanback.app.MediaControllerGlue

Class Overview

A helper class for implementing a glue layer between a PlaybackOverlayFragment and a MediaControllerCompat.

Summary

[Expand]
Inherited Constants
From class android.support.v17.leanback.app.PlaybackControlGlue
Public Constructors
MediaControllerGlue(Context context, PlaybackOverlayFragment fragment, int[] seekSpeeds)
Constructor for the glue.
MediaControllerGlue(Context context, PlaybackOverlayFragment fragment, 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.
Protected Methods
void pausePlayback()
Pause playback.
void skipToNext()
Skip to the next track.
void skipToPrevious()
Skip to the previous track.
void startPlayback(int speed)
Start playback at the given speed.
[Expand]
Inherited Methods
From class android.support.v17.leanback.app.PlaybackControlGlue
From class java.lang.Object
From interface android.support.v17.leanback.widget.OnActionClickedListener
From interface android.view.View.OnKeyListener

Public Constructors

public MediaControllerGlue (Context context, PlaybackOverlayFragment fragment, int[] seekSpeeds)

Constructor for the glue.

The PlaybackOverlayFragment must be passed in. A OnItemViewClickedListener and PlaybackOverlayFragment.InputEventHandler will be set on the fragment.

Parameters
seekSpeeds Array of seek speeds for fast forward and rewind.

public MediaControllerGlue (Context context, PlaybackOverlayFragment fragment, int[] fastForwardSpeeds, int[] rewindSpeeds)

Constructor for the glue.

The PlaybackOverlayFragment must be passed in. A OnItemViewClickedListener and PlaybackOverlayFragment.InputEventHandler will be set on the fragment.

Parameters
fastForwardSpeeds Array of seek speeds for fast forward.
rewindSpeeds Array of seek speeds for rewind.

Public Methods

public void attachToMediaController (MediaControllerCompat mediaController)

Attaches to the given media controller.

public void detach ()

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

public int getCurrentPosition ()

Returns the current position of the media item in milliseconds.

public int getCurrentSpeedId ()

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

public Drawable getMediaArt ()

Returns a bitmap of the art for the media item.

public final MediaControllerCompat getMediaController ()

Returns the media controller currently attached.

public int getMediaDuration ()

Returns the duration of the media item in milliseconds.

public CharSequence getMediaSubtitle ()

Returns the subtitle of the media item.

public CharSequence getMediaTitle ()

Returns the title of the media item.

public long getSupportedActions ()

Returns a bitmask of actions supported by the media player.

public boolean hasValidMedia ()

Returns true if there is a valid media item.

public boolean isMediaPlaying ()

Returns true if media is currently playing.

Protected Methods

protected void pausePlayback ()

Pause playback.

protected void skipToNext ()

Skip to the next track.

protected void skipToPrevious ()

Skip to the previous track.

protected void startPlayback (int speed)

Start playback at the given speed.

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