added in version 26.1.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1

MediaPlayerAdapter

public class MediaPlayerAdapter
extends PlayerAdapter

java.lang.Object
   ↳ android.support.v17.leanback.media.PlayerAdapter
     ↳ android.support.v17.leanback.media.MediaPlayerAdapter


This implementation extends the PlayerAdapter with a MediaPlayer.

Summary

Public constructors

MediaPlayerAdapter(Context context)

Constructor.

Public methods

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.

boolean isPlaying()

Returns true if media is currently playing.

boolean isPrepared()
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 release()

Release internal MediaPlayer.

void reset()

Will reset the MediaPlayer and the glue such that a new file can be played.

void seekTo(long newPosition)

Seek to new position.

boolean setDataSource(Uri uri)

Sets the media source of the player witha given URI.

void setProgressUpdatingEnabled(boolean enabled)

Implement this method to enable or disable progress updating.

Protected methods

boolean onError(int what, int extra)

Called to indicate an error.

boolean onInfo(int what, int extra)

Called to indicate an info or a warning.

void onS