MediaControllerAdapter
class MediaControllerAdapter : PlayerAdapter
A helper class for implementing a adapter layer for MediaControllerCompat.
Summary
Public constructors |
|---|
MediaControllerAdapter(controller: MediaControllerCompat!)Constructor for the adapter using |
Public functions |
|
|---|---|
Unit |
Optional method. |
Long |
Returns the current buffered position of the media item in milliseconds. |
Long |
Returns the current position of the media item in milliseconds. |
Long |
Returns the duration of the media item in milliseconds. |
Drawable! |
getMediaArt(context: Context!)Get current media's drawable art. |
MediaControllerCompat! |
Return the object of |
CharSequence! |
Get current media's subtitle. |
CharSequence! |
Get current media's title. |
Long |
Return xor combination of values defined in PlaybackBaseControlGlue. |
Boolean |
Returns true if media is currently playing. |
Unit |
next()Optional method. |
Unit |
onAttachedToHost(host: PlaybackGlueHost)This method is called attached to associated |
Unit |
This method is called when current associated |
Unit |
pause()Pauses the media player. |
Unit |
play()Starts the media player. |
Unit |
previous()Optional method. |
Unit |
rewind()Optional method. |
Unit |
Seek to new position. |
Unit |
setProgressUpdatingEnabled(enable: Boolean)Implement this method to enable or disable progress updating. |
Unit |
setRepeatAction(repeatActionIndex: Int)Optional method. |
Unit |
setShuffleAction(shuffleActionIndex: Int)Optional method. |
Inherited functions |
||||||
|---|---|---|---|---|---|---|
|
Public constructors
MediaControllerAdapter
MediaControllerAdapter(controller: MediaControllerCompat!)
Constructor for the adapter using MediaControllerCompat.
| Parameters | |
|---|---|
controller: MediaControllerCompat! |
Object of MediaControllerCompat.. |
Public functions
fastForward
fun fastForward(): Unit
Optional method. Override this method if getSupportedActions include ACTION_FAST_FORWARD to fast forward current media item.
getBufferedPosition
fun getBufferedPosition(): Long
Returns the current buffered position of the media item in milliseconds.
getCurrentPosition
fun getCurrentPosition(): Long
Returns the current position of the media item in milliseconds.
getMediaArt
fun getMediaArt(context: Context!): Drawable!
Get current media's drawable art.
| Returns | |
|---|---|
Drawable! |
Drawable art of current media. |
getMediaController
fun getMediaController(): MediaControllerCompat!
Return the object of MediaControllerCompat from this class.
| Returns | |
|---|---|
MediaControllerCompat! |
Media Controller Compat object owned by this class. |
getMediaSubtitle
fun getMediaSubtitle(): CharSequence!
Get current media's subtitle.
| Returns | |
|---|---|
CharSequence! |
Subtitle of current media. |
getMediaTitle
fun getMediaTitle(): CharSequence!
Get current media's title.
| Returns | |
|---|---|
CharSequence! |
Title of current media. |
getSupportedActions
fun getSupportedActions(): Long
Return xor combination of values defined in PlaybackBaseControlGlue. Default is PLAY_PAUSE (unless subclass enforce to be 0)
next
fun next(): Unit
Optional method. Override this method if getSupportedActions include ACTION_SKIP_TO_NEXT to skip to next item.
onAttachedToHost
fun onAttachedToHost(host: PlaybackGlueHost): Unit
This method is called attached to associated PlaybackGlueHost.
| Parameters | |
|---|---|
host: PlaybackGlueHost |
onDetachedFromHost
fun onDetachedFromHost(): Unit
This method is called when current associated PlaybackGlueHost is attached to a different PlaybackGlue or PlaybackGlueHost is destroyed. Subclass may override. A typical implementation will release resources (e.g. MediaPlayer or connection to playback service) in this method.
previous
fun previous(): Unit
Optional method. Override this method if getSupportedActions include ACTION_SKIP_TO_PREVIOUS to skip to previous item.
rewind
fun rewind(): Unit
Optional method. Override this method if getSupportedActions include ACTION_REWIND to rewind in current media item.
seekTo
fun seekTo(positionInMs: Long): Unit
Seek to new position.
| Parameters | |
|---|---|
positionInMs: Long |
New position in milliseconds. |
setProgressUpdatingEnabled
fun setProgressUpdatingEnabled(enable: Boolean): Unit
Implement this method to enable or disable progress updating.
| Parameters | |
|---|---|
enable: Boolean |
True to enable progress updating, false otherwise. |
setRepeatAction
fun setRepeatAction(repeatActionIndex: Int): Unit
Optional method. Override this method if getSupportedActions include ACTION_REPEAT to set the repeat action.
| Parameters | |
|---|---|
repeatActionIndex: Int |
The shuffle action. Must be one of the followings: |
setShuffleAction
fun setShuffleAction(shuffleActionIndex: Int): Unit
Optional method. Override this method if getSupportedActions include ACTION_SHUFFLE to set the shuffle action.