Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

BrowserCallback

open class BrowserCallback : MediaController2.ControllerCallback
kotlin.Any
   ↳ androidx.media2.MediaController2.ControllerCallback
   ↳ androidx.media2.MediaBrowser2.BrowserCallback

Callback to listen events from MediaLibraryService2.

Summary

Public constructors

Callback to listen events from MediaLibraryService2.

Public methods
open Unit
onGetChildrenDone(@NonNull browser: MediaBrowser2, @NonNull parentId: String, page: Int, pageSize: Int, @Nullable result: MutableList<MediaItem2!>?, @Nullable extras: Bundle?)

Called when the list of items has been returned by the library service for the previous MediaBrowser2#getChildren(String, int, int, Bundle).

open Unit
onGetLibraryRootDone(@NonNull browser: MediaBrowser2, @Nullable rootHints: Bundle?, @Nullable rootMediaId: String?, @Nullable rootExtra: Bundle?)

Called with the result of getLibraryRoot(Bundle).

open Unit
onGetSearchResultDone(@NonNull browser: MediaBrowser2, @NonNull query: String, page: Int, pageSize: Int, @Nullable result: MutableList<MediaItem2!>?, @Nullable extras: Bundle?)

Called when the search result has been returned by the library service for the previous MediaBrowser2#getSearchResult(String, int, int, Bundle).

open Unit
onChildrenChanged(@NonNull browser: MediaBrowser2, @NonNull parentId: String, itemCount: Int, @Nullable extras: Bundle?)

Called when there's change in the parent's children.

open Unit
onGetItemDone(@NonNull browser: MediaBrowser2, @NonNull mediaId: String, @Nullable result: MediaItem2?)

Called when the item has been returned by the library service for the previous MediaBrowser2#getItem(String) call.

open Unit
onSearchResultChanged(@NonNull browser: MediaBrowser2, @NonNull query: String, itemCount: Int, @Nullable extras: Bundle?)

Called when there's change in the search result requested by the previous MediaBrowser2#search(String, Bundle).

Inherited functions

Public constructors

<init>

BrowserCallback()

Callback to listen events from MediaLibraryService2.

Public methods

onGetChildrenDone

open fun onGetChildrenDone(@NonNull browser: MediaBrowser2, @NonNull parentId: String, page: Int, pageSize: Int, @Nullable result: MutableList<MediaItem2!>?, @Nullable extras: Bundle?): Unit

Called when the list of items has been returned by the library service for the previous MediaBrowser2#getChildren(String, int, int, Bundle).

Parameters
browser MediaBrowser2: the browser for this event
parentId MediaBrowser2: parent id
page MediaBrowser2: page number that you've specified with getChildren(String, int, int, Bundle)
pageSize MediaBrowser2: page size that you've specified with getChildren(String, int, int, Bundle)
result MediaBrowser2: result. Can be null
extras MediaBrowser2: extra bundle from the library service

onGetLibraryRootDone

open fun onGetLibraryRootDone(@NonNull browser: MediaBrowser2, @Nullable rootHints: Bundle?, @Nullable rootMediaId: String?, @Nullable rootExtra: Bundle?): Unit

Called with the result of getLibraryRoot(Bundle).

rootMediaId and rootExtra can be null if the library root isn't available.

Parameters
browser MediaBrowser2: the browser for this event
rootHints MediaBrowser2: rootHints that you previously requested.
rootMediaId MediaBrowser2: media id of the library root. Can be null
rootExtra MediaBrowser2: extra of the library root. Can be null

onGetSearchResultDone

open fun onGetSearchResultDone(@NonNull browser: MediaBrowser2, @NonNull query: String, page: Int, pageSize: Int, @Nullable result: MutableList<MediaItem2!>?, @Nullable extras: Bundle?): Unit

Called when the search result has been returned by the library service for the previous MediaBrowser2#getSearchResult(String, int, int, Bundle).

Result can be null if there had been error.

Parameters
browser MediaBrowser2: the browser for this event
query MediaBrowser2: search query that you've specified with getSearchResult(String, int, int, Bundle)
page MediaBrowser2: page number that you've specified with getSearchResult(String, int, int, Bundle)
pageSize MediaBrowser2: page size that you've specified with getSearchResult(String, int, int, Bundle)
result MediaBrowser2: result. Can be null.
extras MediaBrowser2: extra bundle from the library service

onChildrenChanged

open fun onChildrenChanged(@NonNull browser: MediaBrowser2, @NonNull parentId: String, itemCount: Int, @Nullable extras: Bundle?): Unit

Called when there's change in the parent's children.

This API is called when the library service called MediaLibrarySession#notifyChildrenChanged(ControllerInfo, String, int, Bundle) or MediaLibrarySession#notifyChildrenChanged(String, int, Bundle) for the parent.

Parameters
browser MediaBrowser2: the browser for this event
parentId MediaBrowser2: parent id that you've specified with subscribe(String, Bundle)
itemCount MediaBrowser2: number of children
extras MediaBrowser2: extra bundle from the library service. Can be differ from extras that you've specified with subscribe(String, Bundle).

onGetItemDone

open fun onGetItemDone(@NonNull browser: MediaBrowser2, @NonNull mediaId: String, @Nullable result: MediaItem2?): Unit

Called when the item has been returned by the library service for the previous MediaBrowser2#getItem(String) call.

Result can be null if there had been error.

Parameters
browser MediaBrowser2: the browser for this event
mediaId MediaBrowser2: media id
result MediaBrowser2: result. Can be null

onSearchResultChanged

open fun onSearchResultChanged(@NonNull browser: MediaBrowser2, @NonNull query: String, itemCount: Int, @Nullable extras: Bundle?): Unit

Called when there's change in the search result requested by the previous MediaBrowser2#search(String, Bundle).

Parameters
browser MediaBrowser2: the browser for this event
query MediaBrowser2: search query that you've specified with search(String, Bundle)
itemCount MediaBrowser2: The item count for the search result
extras MediaBrowser2: extra bundle from the library service