MediaService
Media service.
This service provides:
What content is playing, the activeMediaItem.
Which media source is playing, the activeSource.
Which Actions can be launched on the active media item, availableActions.
Which sourcess are available in the system at this time.
The ability to perform Actions on the activeSource, with launchAction.
A media source is an app which has registered a MediaBrowserServiceCompat
(from androidx.media
), and is able to play content and lets clients browse it.
This service concentrates all information about media currently being played. As only one source at a time can play audio, Android decides which one gets the audio focus. The chosen source is available here as activeSource.
Each media source makes different operations (actions) available at any given time to be performed, or launched, on the media that it is currently being played. Action represents such an action, and availableActions is a list of what actions are presently available.
Browsing through media offered by media sources is possible with a SourceClient. The IVI media service intentionally excludes this functionality to concentrate on the playback state.
Types
Properties
Information about the currently active media item of the activeSource. Can be null
if there is no active media or if there is no active source.
The queue of media items that are currently scheduled for playing by the activeSource. Can be empty if no queue is specified or if there is no active source.
Index of the item in activeQueue that is currently being played. Can be null
if there is no active media, if the queue is empty, or if there is no active source.
Which source is currently active. The active source is the one almost all of the information provided by the MediaService refers to. Can be null
if there is no active source.
Actions provided by the activeSource for the activeMediaItem.
Playback state of the media currently being played by the activeSource. IviPlaybackState.IDLE if nothing is being played, or if there is no active source.
Functions
Returns the active media item for the given sourceId. Returns null
if the specified source does not have any active IviMediaItem. To get the active media of the activeSource, just use activeMediaItem directly.
Issues a Action to the current media source.