MediaControlContext

@IviExperimental(reasons = [])
class MediaControlContext(val source: LiveSourceId, val playbackState: LiveData<IviPlaybackState>, val activeMediaItem: LiveData<IviMediaItem?>, val actions: LiveDataActionList, val actionLauncher: ActionLaunchCall, val coroutineScope: CoroutineScope)

Provides access to contextual information for MediaControls. Actual use of the information provided by MediaControlContext is not mandatory.

Parameters

source

Source ID of the active source. Is null if no source is playing.

playbackState

Playback state of the active source. IviPlaybackState.IDLE if nothing is being played, or when a source is not active.

activeMediaItem

Active media item from the current source. null if nothing is being played, or when a source is not active.

actions

List of actions provided by the active source. Empty if no source is active, or when no actions are currently available.

At any given time, a source determines which Actions are available: this list can be observed to react to any changes made by the source.

If the current source changes, the list will also change to reflect that source's available list of Actions.

actionLauncher

Lambda that can be used to launch the actions.

coroutineScope

The scope which the MediaControls will run coroutines in.

Constructors

Link copied to clipboard
fun MediaControlContext(source: LiveSourceId, playbackState: LiveData<IviPlaybackState>, activeMediaItem: LiveData<IviMediaItem?>, actions: LiveDataActionList, actionLauncher: ActionLaunchCall, coroutineScope: CoroutineScope)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val coroutineScope: CoroutineScope
Link copied to clipboard
Link copied to clipboard