added in version 26.1.0
belongs to Maven artifact


public class MediaPlayerAdapter
extends PlayerAdapter


This implementation extends the PlayerAdapter with a MediaPlayer.


Public constructors

MediaPlayerAdapter(Context context)


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 onSeekComplete()

Called to indicate the completion of a seek operation.

Inherited methods