MediaSession.ConnectionResult


class MediaSession.ConnectionResult


A result for onConnectAsync to denote the set of available commands and the media button preferences for a controller.

Summary

Nested types

A builder for ConnectionResult instances to accept a connection.

Constants

const Player.Commands!

The default Player.Commands used when a controller is isTrusted.

const SessionCommands!

The default SessionCommands used when a controller is isTrusted and the session is a MediaLibrarySession.

const SessionCommands!

The default SessionCommands used when a controller is isTrusted and the session is not a MediaLibrarySession.

const Player.Commands!

The default Player.Commands used when a controller is not isTrusted.

const SessionCommands!

The default SessionCommands used when a controller is not isTrusted and the session is a MediaLibrarySession.

const SessionCommands!

The default SessionCommands used when a controller is not isTrusted and the session is not a MediaLibrarySession.

Public functions

java-static MediaSession.ConnectionResult!
accept(
    availableSessionCommands: SessionCommands!,
    availablePlayerCommands: Player.Commands!
)

Creates a connection result with the given session and player commands.

java-static MediaSession.ConnectionResult!

Creates a ConnectionResult to reject a connection.

Public properties

Player.Commands!

Available player commands.

SessionCommands!

Available session commands.

ImmutableList<CommandButton!>?

The custom layout or null if the custom layout of the session should be used.

Boolean

Whether the connection request is accepted or not.

ImmutableList<CommandButton!>?

The media button preferences or null if the media button preferences of the session should be used.

PendingIntent?

The session activity.

Bundle?

The session extras.

Constants

DEFAULT_PLAYER_COMMANDS

@UnstableApi
const val DEFAULT_PLAYER_COMMANDSPlayer.Commands!

The default Player.Commands used when a controller is isTrusted.

DEFAULT_SESSION_AND_LIBRARY_COMMANDS

@UnstableApi
const val DEFAULT_SESSION_AND_LIBRARY_COMMANDSSessionCommands!

The default SessionCommands used when a controller is isTrusted and the session is a MediaLibrarySession.

DEFAULT_SESSION_COMMANDS

@UnstableApi
const val DEFAULT_SESSION_COMMANDSSessionCommands!

The default SessionCommands used when a controller is isTrusted and the session is not a MediaLibrarySession.

DEFAULT_UNTRUSTED_PLAYER_COMMANDS

@UnstableApi
const val DEFAULT_UNTRUSTED_PLAYER_COMMANDSPlayer.Commands!

The default Player.Commands used when a controller is not isTrusted. Contains all commands from addAllReadOnlyCommands.

DEFAULT_UNTRUSTED_SESSION_AND_LIBRARY_COMMANDS

@UnstableApi
const val DEFAULT_UNTRUSTED_SESSION_AND_LIBRARY_COMMANDSSessionCommands!

The default SessionCommands used when a controller is not isTrusted and the session is a MediaLibrarySession.

DEFAULT_UNTRUSTED_SESSION_COMMANDS

@UnstableApi
const val DEFAULT_UNTRUSTED_SESSION_COMMANDSSessionCommands!

The default SessionCommands used when a controller is not isTrusted and the session is not a MediaLibrarySession.

Public functions

accept

java-static fun accept(
    availableSessionCommands: SessionCommands!,
    availablePlayerCommands: Player.Commands!
): MediaSession.ConnectionResult!

Creates a connection result with the given session and player commands.

Commands are specific to the controller receiving this connection result.

The controller receives the media button preferences of the session.

See AcceptedResultBuilder for a more flexible way to accept a connection.

reject

java-static fun reject(): MediaSession.ConnectionResult!

Creates a ConnectionResult to reject a connection.

Public properties

availablePlayerCommands

val availablePlayerCommandsPlayer.Commands!

Available player commands.

availableSessionCommands

val availableSessionCommandsSessionCommands!

Available session commands.

customLayout

@UnstableApi
val customLayoutImmutableList<CommandButton!>?

The custom layout or null if the custom layout of the session should be used.

isAccepted

val isAcceptedBoolean

Whether the connection request is accepted or not.

mediaButtonPreferences

@UnstableApi
val mediaButtonPreferencesImmutableList<CommandButton!>?

The media button preferences or null if the media button preferences of the session should be used.

sessionActivity

@UnstableApi
val sessionActivityPendingIntent?

The session activity.

sessionExtras

@UnstableApi
val sessionExtrasBundle?

The session extras.