MediaSession.ConnectionResult


public final class MediaSession.ConnectionResult


A result for onConnect to denote the set of available commands and the custom layout for a controller.

Summary

Nested types

A builder for ConnectionResult instances to accept a connection.

Public fields

final Player.Commands

Available player commands.

final SessionCommands

Available session commands.

final @Nullable ImmutableList<CommandButton>

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

final boolean

Whether the connection request is accepted or not.

final @Nullable Bundle

The session extras.

Public methods

static MediaSession.ConnectionResult
accept(
    SessionCommands availableSessionCommands,
    Player.Commands availablePlayerCommands
)

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

static MediaSession.ConnectionResult

Creates a ConnectionResult to reject a connection.

Constants

DEFAULT_PLAYER_COMMANDS

@UnstableApi
public static final Player.Commands DEFAULT_PLAYER_COMMANDS

DEFAULT_SESSION_AND_LIBRARY_COMMANDS

@UnstableApi
public static final SessionCommands DEFAULT_SESSION_AND_LIBRARY_COMMANDS

DEFAULT_SESSION_COMMANDS

@UnstableApi
public static final SessionCommands DEFAULT_SESSION_COMMANDS

Public fields

availablePlayerCommands

public final Player.Commands availablePlayerCommands

Available player commands.

availableSessionCommands

public final SessionCommands availableSessionCommands

Available session commands.

customLayout

@UnstableApi
public final @Nullable ImmutableList<CommandButtoncustomLayout

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

isAccepted

public final boolean isAccepted

Whether the connection request is accepted or not.

sessionExtras

@UnstableApi
public final @Nullable Bundle sessionExtras

The session extras.

Public methods

accept

public static MediaSession.ConnectionResult accept(
    SessionCommands availableSessionCommands,
    Player.Commands availablePlayerCommands
)

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 custom layout of the session.

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

reject

public static MediaSession.ConnectionResult reject()

Creates a ConnectionResult to reject a connection.