MediaLibrarySession

class MediaLibrarySession : MediaSession2
kotlin.Any
   ↳ androidx.media.MediaSession2
   ↳ androidx.media.MediaLibraryService2.MediaLibrarySession

Session for the MediaLibraryService2. Build this object with Builder and return in #onCreateSession(String).

Summary

Nested classes

Builder for MediaLibrarySession.

Callback for the MediaLibrarySession.

Inherited constants
Public methods
Unit
notifyChildrenChanged(controller: MediaSession2.ControllerInfo, parentId: String, itemCount: Int, extras: Bundle?)

Notify the controller of the change in a parent's children.

Unit
notifyChildrenChanged(parentId: String, itemCount: Int, extras: Bundle?)

Notify all controllers that subscribed to the parent about change in the parent's children, regardless of the extra bundle supplied by MediaBrowser2#subscribe(String, Bundle).

Unit
notifySearchResultChanged(controller: MediaSession2.ControllerInfo, query: String, itemCount: Int, extras: Bundle?)

Notify controller about change in the search result.

Inherited functions

Public methods

notifyChildrenChanged

fun notifyChildrenChanged(controller: MediaSession2.ControllerInfo, parentId: String, itemCount: Int, extras: Bundle?): Unit

Notify the controller of the change in a parent's children.

If the controller hasn't subscribed to the parent, the API will do nothing.

Controllers will use MediaBrowser2#getChildren(String, int, int, Bundle) to get the list of children.

Parameters
controller MediaSession2.ControllerInfo: controller to notify
parentId MediaSession2.ControllerInfo: parent id with changes in its children
itemCount MediaSession2.ControllerInfo: number of children.
extras MediaSession2.ControllerInfo: extra information from session to controller

notifyChildrenChanged

fun notifyChildrenChanged(parentId: String, itemCount: Int, extras: Bundle?): Unit

Notify all controllers that subscribed to the parent about change in the parent's children, regardless of the extra bundle supplied by MediaBrowser2#subscribe(String, Bundle).

Parameters
parentId String: parent id
itemCount String: number of children
extras String: extra information from session to controller

notifySearchResultChanged

fun notifySearchResultChanged(controller: MediaSession2.ControllerInfo, query: String, itemCount: Int, extras: Bundle?): Unit

Notify controller about change in the search result.

Parameters
controller MediaSession2.ControllerInfo: controller to notify
query MediaSession2.ControllerInfo: previously sent search query from the controller.
itemCount MediaSession2.ControllerInfo: the number of items that have been found in the search.
extras MediaSession2.ControllerInfo: extra bundle