added in version 27.1.0
belongs to Maven artifact


public class MediaControllerAdapter
extends PlayerAdapter


A helper class for implementing a adapter layer for MediaControllerCompat.


Public constructors

MediaControllerAdapter(MediaControllerCompat controller)

Constructor for the adapter using MediaControllerCompat.

Public methods

void fastForward()

Optional method.

long getBufferedPosition()

Returns the current buffered position of the media item in milliseconds.

long getCurrentPosition()

Returns the current position of the media item in milliseconds.

long getDuration()

Returns the duration of the media item in milliseconds.

Drawable getMediaArt(Context context)

Get current media's drawable art.

MediaControllerCompat getMediaController()

Return the object of MediaControllerCompat from this class.

CharSequence getMediaSubtitle()

Get current media's subtitle.

CharSequence getMediaTitle()

Get current media's title.

long getSupportedActions()

Return xor combination of values defined in PlaybackBaseControlGlue.

boolean isPlaying()

Returns true if media is currently playing.

void next()

Optional method.

void onAttachedToHost(PlaybackGlueHost host)

This method is called attached to associated PlaybackGlueHost.

void onDetachedFromHost()

This method is called when current associated PlaybackGlueHost is attached to a different PlaybackGlue or PlaybackGlueHost is destroyed.

void pause()

Pauses the media player.

void play()

Starts the media player.

void previous()

Optional method.

void rewind()

Optional method.

void seekTo(long positionInMs)

Seek to new position.

void setProgressUpdatingEnabled(boolean enabled)

Implement this method to enable or disable progress updating.

void setRepeatAction(int repeatActionIndex)

Optional method.

void setShuffleAction(int shuffleActionIndex)

Optional method.

Inherited methods