MediaSessionConnector
MediaSessionConnector connects an Android media session to a THEOplayer instance.
// Create and initialize the media session
mediaSession = MediaSessionCompat(this, TAG).apply {
// Do not let MediaButtons restart the player when the app is not visible
setMediaButtonReceiver(null)
}
// Create a MediaSessionConnector and attach the THEOplayer instance.
mediaSessionConnector = MediaSessionConnector(mediaSession)
mediaSessionConnector.player = player
// Optionally show debug logs
mediaSessionConnector.debug = true
// Set mediaSession to active
mediaSessionConnector.setActive(true)
See also
Properties
The playback actions that are enabled for the media session. By default, all actions supported by the player are enabled.
A callback for playback actions. When set, the media session will receive playback events, otherwise the default behavior will be executed for supported actions.
A callback for playback preparation actions. When set, the media session will receive prepare events.
A callback for queue editing actions. When set, the media session will receive queue editing events.
A callback for queue navigation actions. When set, the media session will receive queue navigation events.
A callback for rating actions. When set, the media session will receive rating events.
Whether each time update event should trigger an update in playback state.
The interval the player should skip backward when rewinding, in seconds.
The interval the player should skip forward when fast-forwarding, in seconds.
Functions
Add a listener for media session callback actions.
Get metadata for the current media item.
Get metadata provider for the current media item.
Force update of the current meta data.
Force update of current playback state.
Remove a listener for media session callback actions.
Pass a custom description for the current media item.