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_COMMANDS: Player.Commands!

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

DEFAULT_SESSION_AND_LIBRARY_COMMANDS

@UnstableApi
const val DEFAULT_SESSION_AND_LIBRARY_COMMANDS: SessionCommands!

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

DEFAULT_SESSION_COMMANDS

@UnstableApi
const val DEFAULT_SESSION_COMMANDS: SessionCommands!

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_COMMANDS: Player.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_COMMANDS: SessionCommands!

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_COMMANDS: SessionCommands!

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 availablePlayerCommands: Player.Commands!

Available player commands.

availableSessionCommands

val availableSessionCommands: SessionCommands!

Available session commands.

customLayout

@UnstableApi
val customLayout: ImmutableList<CommandButton!>?

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

isAccepted

val isAccepted: Boolean

Whether the connection request is accepted or not.

mediaButtonPreferences

@UnstableApi
val mediaButtonPreferences: ImmutableList<CommandButton!>?

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

sessionActivity

@UnstableApi
val sessionActivity: PendingIntent?

The session activity.

sessionExtras

@UnstableApi
val sessionExtras: Bundle?

The session extras.