MediaBrowser.BrowserCallback

Added in 1.0.0
Deprecated in 1.3.0

public class MediaBrowser.BrowserCallback extends MediaController.ControllerCallback


Callback to listen events from MediaLibraryService.

Summary

Public constructors

Public methods

void
onChildrenChanged(
    @NonNull MediaBrowser browser,
    @NonNull String parentId,
    @IntRange(from = 0) int itemCount,
    @Nullable MediaLibraryService.LibraryParams params
)

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

void
onSearchResultChanged(
    @NonNull MediaBrowser browser,
    @NonNull String query,
    @IntRange(from = 0) int itemCount,
    @Nullable MediaLibraryService.LibraryParams params
)

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

Inherited methods

From androidx.media2.session.MediaController.ControllerCallback
void

Called when the allowed commands are changed by session.

void
onBufferingStateChanged(
    @NonNull MediaController controller,
    @NonNull MediaItem item,
    int state
)

Called to report buffering events for a media item.

void
onConnected(
    @NonNull MediaController controller,
    @NonNull SessionCommandGroup allowedCommands
)

Called when the controller is successfully connected to the session.

void

Called when the current item is changed.

@NonNull SessionResult
onCustomCommand(
    @NonNull MediaController controller,
    @NonNull SessionCommand command,
    @Nullable Bundle args
)

Called when the session sent a custom command.

void

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

void

Called when the playback is completed.

void

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

void
onPlaybackSpeedChanged(@NonNull MediaController controller, float speed)

Called when playback speed is changed.

void
onPlayerStateChanged(@NonNull MediaController controller, int state)

Called when the player state is changed.

void
onPlaylistChanged(
    @NonNull MediaController controller,
    @Nullable List<MediaItem> list,
    @Nullable MediaMetadata metadata
)

Called when a playlist is changed.

void

Called when a playlist metadata is changed.

void
onRepeatModeChanged(@NonNull MediaController controller, int repeatMode)

Called when the repeat mode is changed.

void
onSeekCompleted(@NonNull MediaController controller, long position)

Called to indicate that seeking is completed.

int

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

void
onShuffleModeChanged(
    @NonNull MediaController controller,
    int shuffleMode
)

Called when the shuffle mode is changed.

void
onSubtitleData(
    @NonNull MediaController controller,
    @NonNull MediaItem item,
    @NonNull SessionPlayer.TrackInfo track,
    @NonNull SubtitleData data
)

Called when the subtitle track has new subtitle data available.

void
onTrackDeselected(
    @NonNull MediaController controller,
    @NonNull SessionPlayer.TrackInfo trackInfo
)

Called when a track is deselected.

void
onTrackSelected(
    @NonNull MediaController controller,
    @NonNull SessionPlayer.TrackInfo trackInfo
)

Called when a track is selected.

void

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.

void
onVideoSizeChanged(
    @NonNull MediaController controller,
    @NonNull VideoSize videoSize
)

Called when video size is changed.

Public constructors

BrowserCallback

Added in 1.0.0
Deprecated in 1.3.0
public BrowserCallback()

Public methods

onChildrenChanged

Added in 1.0.0
Deprecated in 1.3.0
public void onChildrenChanged(
    @NonNull MediaBrowser browser,
    @NonNull String parentId,
    @IntRange(from = 0) int itemCount,
    @Nullable MediaLibraryService.LibraryParams params
)

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
@NonNull MediaBrowser browser

the browser for this event

@NonNull String parentId

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

@IntRange(from = 0) int itemCount

number of children

@Nullable MediaLibraryService.LibraryParams params

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
public void onSearchResultChanged(
    @NonNull MediaBrowser browser,
    @NonNull String query,
    @IntRange(from = 0) int itemCount,
    @Nullable MediaLibraryService.LibraryParams params
)

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

Parameters
@NonNull MediaBrowser browser

the browser for this event

@NonNull String query

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

@IntRange(from = 0) int itemCount

The item count for the search result

@Nullable MediaLibraryService.LibraryParams params

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