MediaBrowser2
public
class
MediaBrowser2
extends MediaController2
java.lang.Object | ||
↳ | androidx.media2.MediaController2 | |
↳ | androidx.media2.MediaBrowser2 |
Browses media content offered by a MediaLibraryService2
.
Summary
Nested classes | |
---|---|
class |
MediaBrowser2.BrowserCallback
Callback to listen events from |
Public constructors | |
---|---|
MediaBrowser2(Context context, SessionToken2 token, Executor executor, MediaBrowser2.BrowserCallback callback)
|
Public methods | |
---|---|
void
|
getChildren(String parentId, int page, int pageSize, Bundle extras)
Get list of children under the parent. |
void
|
getItem(String mediaId)
Get the media item with the given media id. |
void
|
getLibraryRoot(Bundle extras)
Get the library root. |
void
|
getSearchResult(String query, int page, int pageSize, Bundle extras)
Get the search result from lhe library service. |
void
|
search(String query, Bundle extras)
Send a search request to the library service. |
void
|
subscribe(String parentId, Bundle extras)
Subscribe to a parent id for the change in its children. |
void
|
unsubscribe(String parentId)
Unsubscribe for changes to the children of the parent, which was previously subscribed with
|
Inherited methods | |
---|---|
Public constructors
MediaBrowser2
public MediaBrowser2 (Context context, SessionToken2 token, Executor executor, MediaBrowser2.BrowserCallback callback)
Parameters | |
---|---|
context |
Context |
token |
SessionToken2 |
executor |
Executor |
callback |
MediaBrowser2.BrowserCallback |
Public methods
getChildren
public void getChildren (String parentId, int page, int pageSize, Bundle extras)
Get list of children under the parent. Result would be sent back asynchronously with the
MediaBrowser2.BrowserCallback.onGetChildrenDone(MediaBrowser2, String, int, int, List, Bundle)
.
Parameters | |
---|---|
parentId |
String : parent id for getting the children. |
page |
int : page number to get the result. Starts from 0 |
pageSize |
int : page size. Should be greater or equal to 1 |
extras |
Bundle : extra bundle
|
getItem
public void getItem (String mediaId)
Get the media item with the given media id. Result would be sent back asynchronously with the
MediaBrowser2.BrowserCallback.onGetItemDone(MediaBrowser2, String, MediaItem2)
.
Parameters | |
---|---|
mediaId |
String : media id for specifying the item
|
getLibraryRoot
public void getLibraryRoot (Bundle extras)
Get the library root. Result would be sent back asynchronously with the
MediaBrowser2.BrowserCallback.onGetLibraryRootDone(MediaBrowser2, Bundle, String, Bundle)
.
Parameters | |
---|---|
extras |
Bundle : extras for getting root |
getSearchResult
public void getSearchResult (String query, int page, int pageSize, Bundle extras)
Get the search result from lhe library service. Result would be sent back asynchronously with
the
MediaBrowser2.BrowserCallback.onGetSearchResultDone(MediaBrowser2, String, int, int, List, Bundle)
.
Parameters | |
---|---|
query |
String : search query that you've specified with search(String, Bundle) |
page |
int : page number to get search result. Starts from 0 |
pageSize |
int : page size. Should be greater or equal to 1 |
extras |
Bundle : extra bundle
|
search
public void search (String query, Bundle extras)
Send a search request to the library service. When the search result is changed,
MediaBrowser2.BrowserCallback.onSearchResultChanged(MediaBrowser2, String, int, Bundle)
will be
called. You should call getSearchResult(String, int, int, Bundle)
to get the actual
search result.
Parameters | |
---|---|
query |
String : search query. Should not be an empty string. |
extras |
Bundle : extra bundle
|
subscribe
public void subscribe (String parentId, Bundle extras)
Subscribe to a parent id for the change in its children. When there's a change,
MediaBrowser2.BrowserCallback.onChildrenChanged(MediaBrowser2, String, int, Bundle)
will be called
with the bundle that you've specified. You should call
getChildren(String, int, int, Bundle)
to get the actual contents for the parent.
Parameters | |
---|---|
parentId |
String : parent id |
extras |
Bundle : extra bundle
|
unsubscribe
public void unsubscribe (String parentId)
Unsubscribe for changes to the children of the parent, which was previously subscribed with
subscribe(String, Bundle)
.
This unsubscribes all previous subscription with the parent id, regardless of the extra that was previously sent to the library service.
Parameters | |
---|---|
parentId |
String : parent id
|
Interfaces
Classes
- CallbackDataSource2
- CallbackDataSourceDesc2
- CallbackDataSourceDesc2.Builder
- DataSourceDesc2
- DataSourceDesc2.Builder
- FileDataSourceDesc2
- FileDataSourceDesc2.Builder
- MediaBrowser2
- MediaBrowser2.BrowserCallback
- MediaController2
- MediaController2.ControllerCallback
- MediaController2.PlaybackInfo
- MediaItem2
- MediaItem2.Builder
- MediaLibraryService2
- MediaLibraryService2.LibraryRoot
- MediaLibraryService2.MediaLibrarySession
- MediaLibraryService2.MediaLibrarySession.Builder
- MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback
- MediaMetadata2
- MediaMetadata2.Builder
- MediaPlayer2
- MediaPlayer2.DrmEventCallback
- MediaPlayer2.DrmInfo
- MediaPlayer2.EventCallback
- MediaPlayer2.MetricsConstants
- MediaPlayer2.TrackInfo
- MediaPlayerConnector
- MediaPlayerConnector.PlayerEventCallback
- MediaPlaylistAgent
- MediaPlaylistAgent.PlaylistEventCallback
- MediaSession2
- MediaSession2.Builder
- MediaSession2.CommandButton
- MediaSession2.CommandButton.Builder
- MediaSession2.ControllerInfo
- MediaSession2.SessionCallback
- MediaSessionService2
- MediaSessionService2.MediaNotification
- MediaTimestamp2
- PlaybackParams2
- PlaybackParams2.Builder
- Rating2
- SessionCommand2
- SessionCommandGroup2
- SessionCommandGroup2.Builder
- SessionToken2
- SubtitleData2
- TimedMetaData2
- UriDataSourceDesc2
- UriDataSourceDesc2.Builder
Exceptions
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.