MediaBrowser.BrowserCallback

Added in 1.0.0
Deprecated in 1.3.0

class MediaBrowser.BrowserCallback : MediaController.ControllerCallback


Callback to listen events from MediaLibraryService.

Summary

Public constructors

Public functions

Unit
onChildrenChanged(
    browser: MediaBrowser,
    parentId: String,
    itemCount: @IntRange(from = 0) Int,
    params: MediaLibraryService.LibraryParams?
)

Called when there's change in the parent's children after you've subscribed to the parent with subscribe.

Unit
onSearchResultChanged(
    browser: MediaBrowser,
    query: String,
    itemCount: @IntRange(from = 0) Int,
    params: MediaLibraryService.LibraryParams?
)

Called when there's change in the search result requested by the previous search.

Inherited functions

From androidx.media2.session.MediaController.ControllerCallback
Unit
onAllowedCommandsChanged(
    controller: MediaController,
    commands: SessionCommandGroup
)

Called when the allowed commands are changed by session.

Unit
onBufferingStateChanged(
    controller: MediaController,
    item: MediaItem,
    state: Int
)

Called to report buffering events for a media item.

Unit
onConnected(
    controller: MediaController,
    allowedCommands: SessionCommandGroup
)

Called when the controller is successfully connected to the session.

Unit

Called when the current item is changed.

SessionResult
onCustomCommand(
    controller: MediaController,
    command: SessionCommand,
    args: Bundle?
)

Called when the session sent a custom command.

Unit

Called when the session refuses the controller or the controller is disconnected from the session.

Unit

Called when the playback is completed.

Unit

Called when the session has changed anything related with the PlaybackInfo.

Unit

Called when playback speed is changed.

Unit
onPlayerStateChanged(controller: MediaController, state: Int)

Called when the player state is changed.

Unit
onPlaylistChanged(
    controller: MediaController,
    list: (Mutable)List<MediaItem!>?,
    metadata: MediaMetadata?
)

Called when a playlist is changed.

Unit
onPlaylistMetadataChanged(
    controller: MediaController,
    metadata: MediaMetadata?
)

Called when a playlist metadata is changed.

Unit
onRepeatModeChanged(controller: MediaController, repeatMode: Int)

Called when the repeat mode is changed.

Unit
onSeekCompleted(controller: MediaController, position: Long)

Called to indicate that seeking is completed.

Int
onSetCustomLayout(
    controller: MediaController,
    layout: (Mutable)List<MediaSession.CommandButton!>
)

Called when the session set the custom layout through the setCustomLayout.

Unit
onShuffleModeChanged(controller: MediaController, shuffleMode: Int)

Called when the shuffle mode is changed.

Unit
onSubtitleData(
    controller: MediaController,
    item: MediaItem,
    track: SessionPlayer.TrackInfo,
    data: SubtitleData
)

Called when the subtitle track has new subtitle data available.

Unit
onTrackDeselected(
    controller: MediaController,
    trackInfo: SessionPlayer.TrackInfo
)

Called when a track is deselected.

Unit
onTrackSelected(
    controller: MediaController,
    trackInfo: SessionPlayer.TrackInfo
)

Called when a track is selected.

Unit
onTracksChanged(
    controller: MediaController,
    tracks: (Mutable)List<SessionPlayer.TrackInfo!>
)

Called when the tracks of the current media item is changed such as 1) when tracks of a media item become available, 2) when new tracks are found during playback, or 3) when the current media item is changed.

Unit
onVideoSizeChanged(controller: MediaController, videoSize: VideoSize)

Called when video size is changed.

Public constructors

BrowserCallback

Added in 1.0.0
Deprecated in 1.3.0
BrowserCallback()

Public functions

onChildrenChanged

Added in 1.0.0
Deprecated in 1.3.0
fun onChildrenChanged(
    browser: MediaBrowser,
    parentId: String,
    itemCount: @IntRange(from = 0) Int,
    params: MediaLibraryService.LibraryParams?
): Unit

Called when there's change in the parent's children after you've subscribed to the parent with subscribe.

This API is called when the library service called notifyChildrenChanged for the parent.

Parameters
browser: MediaBrowser

the browser for this event

parentId: String

non-empty parent id that you've specified with subscribe

itemCount: @IntRange(from = 0) Int

number of children

params: MediaLibraryService.LibraryParams?

library params from the library service. Can be differ from params that you've specified with subscribe.

onSearchResultChanged

Added in 1.0.0
Deprecated in 1.3.0
fun onSearchResultChanged(
    browser: MediaBrowser,
    query: String,
    itemCount: @IntRange(from = 0) Int,
    params: MediaLibraryService.LibraryParams?
): Unit

Called when there's change in the search result requested by the previous search.

Parameters
browser: MediaBrowser

the browser for this event

query: String

non-empty search query that you've specified with search

itemCount: @IntRange(from = 0) Int

The item count for the search result

params: MediaLibraryService.LibraryParams?

library params from the library service. Can be differ from params that you've specified with search.