MediaRouteSelector
public final class MediaRouteSelector
Describes the capabilities of routes that applications would like to discover and use.
This object is immutable once created using a Builder instance.
Example
MediaRouteSelector selector = new MediaRouteSelector.Builder()
.addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
.addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
.build();
MediaRouter router = MediaRouter.getInstance(context);
router.addCallback(selector, callback, MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);Summary
Nested types |
|---|
public final class MediaRouteSelector.BuilderBuilder for |
Constants |
|
|---|---|
static final MediaRouteSelector |
An empty media route selector that will not match any routes. |
Public methods |
|
|---|---|
@NonNull Bundle |
asBundle()Converts this object to a bundle for serialization. |
boolean |
contains(@NonNull MediaRouteSelector selector)Returns true if this selector contains all of the capabilities described by the specified selector. |
boolean |
|
static @Nullable MediaRouteSelector |
fromBundle(@Nullable Bundle bundle)Creates an instance from a bundle. |
@NonNull List<String> |
Gets the list of |
boolean |
hasControlCategory(@Nullable String category)Returns true if the selector contains the specified category. |
int |
hashCode() |
boolean |
isEmpty()Returns true if the selector does not specify any capabilities. |
boolean |
isValid()Returns true if the selector has all of the required fields. |
boolean |
matchesControlFilters(@Nullable List<IntentFilter> filters)Returns true if the selector matches at least one of the specified control filters. |
@NonNull String |
toString() |
Constants
EMPTY
public static final MediaRouteSelector EMPTY
An empty media route selector that will not match any routes.
Public methods
asBundle
public @NonNull Bundle asBundle()
Converts this object to a bundle for serialization.
contains
public boolean contains(@NonNull MediaRouteSelector selector)
Returns true if this selector contains all of the capabilities described by the specified selector.
| Parameters | |
|---|---|
@NonNull MediaRouteSelector selector |
The selector to be examined. |
| Returns | |
|---|---|
boolean |
True if this selector contains all of the capabilities described by the specified selector. |
fromBundle
public static @Nullable MediaRouteSelector fromBundle(@Nullable Bundle bundle)
Creates an instance from a bundle.
| Returns | |
|---|---|
@Nullable MediaRouteSelector |
The new instance, or null if the bundle was null. |
getControlCategories
public @NonNull List<String> getControlCategories()
Gets the list of media control categories in the selector.
hasControlCategory
public boolean hasControlCategory(@Nullable String category)
Returns true if the selector contains the specified category.
| Returns | |
|---|---|
boolean |
|
isEmpty
public boolean isEmpty()
Returns true if the selector does not specify any capabilities.
isValid
public boolean isValid()
Returns true if the selector has all of the required fields.
matchesControlFilters
public boolean matchesControlFilters(@Nullable List<IntentFilter> filters)
Returns true if the selector matches at least one of the specified control filters.
| Parameters | |
|---|---|
@Nullable List<IntentFilter> filters |
The list of control filters to consider. |
| Returns | |
|---|---|
boolean |
True if a match is found. |