BrowserCallback
open class BrowserCallback : MediaController.ControllerCallback
Callback to listen events from MediaLibraryService
.
Summary
Inherited functions |
From class ControllerCallback
Unit |
onAllowedCommandsChanged(@NonNull controller: MediaController, @NonNull commands: SessionCommandGroup)
Called when the allowed commands are changed by session.
|
Unit |
onBufferingStateChanged(@NonNull controller: MediaController, @NonNull item: MediaItem, state: Int)
Called to report buffering events for a media item.
Use getBufferedPosition() for current buffering position.
|
Unit |
onConnected(@NonNull controller: MediaController, @NonNull allowedCommands: SessionCommandGroup)
Called when the controller is successfully connected to the session. The controller becomes available afterwards.
|
Unit |
onCurrentMediaItemChanged(@NonNull controller: MediaController, @Nullable item: MediaItem?)
Called when the current item is changed. It's also called after setPlaylist or setMediaItem . Also called when MediaItem#setMetadata(MediaMetadata) is called on the current media item.
When it's called, you should invalidate previous playback information and wait for later callbacks. Also, current, previous, and next media item indices may need to be updated.
|
SessionResult |
onCustomCommand(@NonNull controller: MediaController, @NonNull command: SessionCommand, @Nullable args: Bundle?)
Called when the session sent a custom command. Returns a SessionResult for session to get notification back. If the null is returned, SessionResult#RESULT_ERROR_UNKNOWN will be returned.
Default implementation returns SessionResult#RESULT_ERROR_NOT_SUPPORTED .
|
Unit |
onDisconnected(@NonNull controller: MediaController)
Called when the session refuses the controller or the controller is disconnected from the session. The controller becomes unavailable afterwards and the callback wouldn't be called.
It will be also called after the #close(), so you can put clean up code here. You don't need to call #close() after this.
|
Unit |
onPlaybackCompleted(@NonNull controller: MediaController)
Called when the playback is completed.
|
Unit |
onPlaybackInfoChanged(@NonNull controller: MediaController, @NonNull info: MediaController.PlaybackInfo)
Called when the session has changed anything related with the PlaybackInfo .
Interoperability: When connected to android.support.v4.media.session.MediaSessionCompat , this may be called when the session changes playback info by calling android.support.v4.media.session.MediaSessionCompat#setPlaybackToLocal(int) or android.support.v4.media.session.MediaSessionCompat#setPlaybackToRemote( * VolumeProviderCompat) }. Specifically:
- Prior to API 21, this will always be called whenever any of those two methods is called.
- From API 21 to 22, this is called only when the playback type i
| |