PlayerAdapter
abstract class PlayerAdapter
kotlin.Any | |
↳ | androidx.leanback.media.PlayerAdapter |
Base class that wraps underlying media player. The class is used by PlaybackGlue, for example PlaybackTransportControlGlue
is bound to a PlayerAdapter. This class is intended to be subclassed, MediaPlayerAdapter
is a concrete subclass using android.media.MediaPlayer
. ExoPlayer also provides a leanback extension that implements PlayerAdapter. Please see ExoPlayer https://developer.android.com/guide/topics/media/exoplayer
Summary
Nested classes | |
---|---|
open |
Client for client of PlayerAdapter. |
Public constructors | |
---|---|
<init>() Base class that wraps underlying media player. |
Public methods | |
---|---|
open Unit |
Optional method. |
open Long |
Returns the current buffered position of the media item in milliseconds. |
PlayerAdapter.Callback! |
Gets callback for event of PlayerAdapter. |
open Long |
Returns the current position of the media item in milliseconds. |
open Long |
Returns the duration of the media item in milliseconds. |
open Long |
Return xor combination of values defined in PlaybackBaseControlGlue. |
open Boolean |
Returns true if media is currently playing. |
open Boolean | |
open Unit |
next() Optional method. |
open Unit |
onAttachedToHost(host: PlaybackGlueHost!) This method is called attached to associated |
open Unit |
This method is called when current associated |
abstract Unit |
pause() Pauses the media player. |
abstract Unit |
play() Starts the media player. |
open Unit |
previous() Optional method. |
open Unit |
rewind() Optional method. |
open Unit |
Seek to new position. |
Unit |
setCallback(callback: PlayerAdapter.Callback!) Sets callback for event of PlayerAdapter. |
open Unit |
setProgressUpdatingEnabled(enable: Boolean) Implement this method to enable or disable progress updating. |
open Unit |
setRepeatAction(repeatActionIndex: Int) Optional method. |
open Unit |
setShuffleAction(shuffleActionIndex: Int) Optional method. |
Public constructors
<init>
PlayerAdapter()
Base class that wraps underlying media player. The class is used by PlaybackGlue, for example PlaybackTransportControlGlue
is bound to a PlayerAdapter. This class is intended to be subclassed, MediaPlayerAdapter
is a concrete subclass using android.media.MediaPlayer
. ExoPlayer also provides a leanback extension that implements PlayerAdapter. Please see ExoPlayer https://developer.android.com/guide/topics/media/exoplayer
Public methods
fastForward
open fun fastForward(): Unit
Optional method. Override this method if getSupportedActions()
include PlaybackBaseControlGlue#ACTION_FAST_FORWARD
to fast forward current media item.
getBufferedPosition
open fun getBufferedPosition(): Long
Returns the current buffered position of the media item in milliseconds.
getCallback
fun getCallback(): PlayerAdapter.Callback!
Gets callback for event of PlayerAdapter.
Return | |
---|---|
PlayerAdapter.Callback! |
Client for event of PlayerAdapter. |
getCurrentPosition
open fun getCurrentPosition(): Long
Returns the current position of the media item in milliseconds.
getSupportedActions
open fun getSupportedActions(): Long
Return xor combination of values defined in PlaybackBaseControlGlue. Default is PLAY_PAUSE (unless subclass enforce to be 0)