MediaPlayerAdapter

public class MediaPlayerAdapter
extends PlayerAdapter

java.lang.Object
   ↳ androidx.leanback.media.PlayerAdapter
     ↳ androidx.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.

final MediaPlayer getMediaPlayer()

Return the MediaPlayer associated with the MediaPlayerAdapter.

int getProgressUpdatingInterval()

Return updating interval of progress UI 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.