MediaControl

@IviExperimental(reasons = [])
interface MediaControl

A visual control for a media-related command. It can be used anywhere the user can interact with active media.

MediaControls are always associated by a MediaControlPolicy to a specific media source.

Examples of controls:

  • Toggle play/pause state.

  • Stop.

  • Play media ID "x".

  • Remove favorite state from media item "y".

See also

Properties

Link copied to clipboard
open val actionType: TtButton.ActionType

The type of the control, which is used by TtButton to apply one of the predefined styles. May be overridden in subclasses in order to apply a specialized style. TtButton.ActionType.TERTIARY is used by default as the most neutral option.

Link copied to clipboard
abstract val drawable: LiveData<DrawableResolver>

The icon of the control, which is used to represent the control to the user.

Link copied to clipboard
abstract val isAvailable: LiveData<Boolean>

Whether or not it is possible to launch the action right now.

Link copied to clipboard
open val isVisible: LiveData<Boolean>

Whether the control is visible. This can be used to show the control as disabled. Defaults to isAvailable.

Link copied to clipboard
open val tag: Int?

Int resource ID to tag this MediaControl with. The tag can be used in tests to refer to one or more controls with the same tag.

Link copied to clipboard
open val text: LiveData<StringResolver>

Textual description of the control.

Functions

Link copied to clipboard
open fun asIconTtButtonViewModel(): LiveData<TtButtonViewModel>

Creates a TtButtonViewModel representation of this MediaControl as an icon button. This implies only the drawable is included.

Link copied to clipboard
abstract fun launch(): Boolean

Perform the action.

Inheritors

Link copied to clipboard
Link copied to clipboard