MediaBrowser
public final class MediaBrowser extends MediaController
Browses media content offered by a MediaLibraryService in addition to the MediaController functions.
Summary
Nested types |
|---|
public final class MediaBrowser.BuilderA builder for |
public interface MediaBrowser.Listener extends MediaController.ListenerA listener for events from |
Public methods |
|
|---|---|
ListenableFuture<LibraryResult<ImmutableList<MediaItem>>> |
getChildren(Returns the children under a parent id. |
ListenableFuture<LibraryResult<MediaItem>> |
Returns the media item with the given media id. |
ListenableFuture<LibraryResult<MediaItem>> |
Returns the library root item. |
ListenableFuture<LibraryResult<ImmutableList<MediaItem>>> |
getSearchResult(Returns the search result from the library service. |
ListenableFuture<LibraryResult<Void>> |
search(String query, @Nullable MediaLibraryService.LibraryParams params)Requests a search from the library service. |
ListenableFuture<LibraryResult<Void>> |
subscribe(Subscribes to a parent id for changes to its children. |
ListenableFuture<LibraryResult<Void>> |
unsubscribe(String parentId)Unsubscribes from a parent id for changes to its children, which was previously subscribed by |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Public methods
getChildren
public ListenableFuture<LibraryResult<ImmutableList<MediaItem>>> getChildren(
String parentId,
@IntRange(from = 0) int page,
@IntRange(from = 1) int pageSize,
@Nullable MediaLibraryService.LibraryParams params
)
Returns the children under a parent id.
If it's successfully completed, value will have the children.
| Parameters | |
|---|---|
String parentId |
A non-empty parent id for getting the children. |
@IntRange(from = 0) int page |
A page number to get the paginated result starting from |
@IntRange(from = 1) int pageSize |
A page size to get the paginated result. Should be greater than |
@Nullable MediaLibraryService.LibraryParams params |
Optional parameters. |
| Returns | |
|---|---|
ListenableFuture<LibraryResult<ImmutableList<MediaItem>>> |
A |
getItem
public ListenableFuture<LibraryResult<MediaItem>> getItem(String mediaId)
Returns the media item with the given media id.
If it's successfully completed, value will have the media item.
| Parameters | |
|---|---|
String mediaId |
A non-empty media id. |
| Returns | |
|---|---|
ListenableFuture<LibraryResult<MediaItem>> |
A |
getLibraryRoot
public ListenableFuture<LibraryResult<MediaItem>> getLibraryRoot(@Nullable MediaLibraryService.LibraryParams params)
Returns the library root item.
If it's successfully completed, value will have the library root item.
| Parameters | |
|---|---|
@Nullable MediaLibraryService.LibraryParams params |
The optional parameters for getting library root item. |
| Returns | |
|---|---|
ListenableFuture<LibraryResult<MediaItem>> |
A |
getSearchResult
public ListenableFuture<LibraryResult<ImmutableList<MediaItem>>> getSearchResult(
String query,
@IntRange(from = 0) int page,
@IntRange(from = 1) int pageSize,
@Nullable MediaLibraryService.LibraryParams params
)
Returns the search result from the library service.
If it's successfully completed, value will have the search result.
| Parameters | |
|---|---|
String query |
A non-empty search query that you've specified with |
@IntRange(from = 0) int page |
A page number to get the paginated result starting from |
@IntRange(from = 1) int pageSize |
A page size to get the paginated result. Should be greater than |
@Nullable MediaLibraryService.LibraryParams params |
Optional parameters. |
| Returns | |
|---|---|
ListenableFuture<LibraryResult<ImmutableList<MediaItem>>> |
A |
search
public ListenableFuture<LibraryResult<Void>> search(String query, @Nullable MediaLibraryService.LibraryParams params)
Requests a search from the library service.
Returned LibraryResult will only tell whether the attempt to search was successful. For getting the search result, listen to onSearchResultChanged and call getSearchResult}.
| Parameters | |
|---|---|
String query |
A non-empty search query. |
@Nullable MediaLibraryService.LibraryParams params |
Optional parameters. |
| Returns | |
|---|---|
ListenableFuture<LibraryResult<Void>> |
A |
subscribe
public ListenableFuture<LibraryResult<Void>> subscribe(
String parentId,
@Nullable MediaLibraryService.LibraryParams params
)
Subscribes to a parent id for changes to its children. When there's a change, onChildrenChanged will be called with the LibraryParams. You may call getChildren to get the children.
| Parameters | |
|---|---|
String parentId |
A non-empty parent id to subscribe to. |
@Nullable MediaLibraryService.LibraryParams params |
Optional parameters. |
| Returns | |
|---|---|
ListenableFuture<LibraryResult<Void>> |
A |
unsubscribe
public ListenableFuture<LibraryResult<Void>> unsubscribe(String parentId)
Unsubscribes from a parent id for changes to its children, which was previously subscribed by subscribe.
This unsubscribes from all previous subscriptions with the parent id, regardless of the LibraryParams that was previously given.
| Parameters | |
|---|---|
String parentId |
A non-empty parent id to unsubscribe from. |
| Returns | |
|---|---|
ListenableFuture<LibraryResult<Void>> |
A |