MediaSession.ConnectionResult
public final class MediaSession.ConnectionResult
A result for onConnect to denote the set of available commands and the media button preferences for a controller.
Summary
Nested types |
|---|
|
A builder for |
Constants |
|
|---|---|
static final Player.Commands |
|
static final SessionCommands |
|
static final SessionCommands |
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 ImmutableList<CommandButton> |
The media button preferences or null if the media button preferences of the session should be used. |
final @Nullable PendingIntent |
The session activity. |
final @Nullable Bundle |
The session extras. |
Public methods |
|
|---|---|
static MediaSession.ConnectionResult |
accept(Creates a connection result with the given session and player commands. |
static MediaSession.ConnectionResult |
reject()Creates a |
Constants
DEFAULT_SESSION_AND_LIBRARY_COMMANDS
@UnstableApi
public static final SessionCommands DEFAULT_SESSION_AND_LIBRARY_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<CommandButton> customLayout
The custom layout or null if the custom layout of the session should be used.
mediaButtonPreferences
@UnstableApi
public final @Nullable ImmutableList<CommandButton> mediaButtonPreferences
The media button preferences or null if the media button preferences of the session should be used.
sessionActivity
@UnstableApi
public final @Nullable PendingIntent sessionActivity
The session activity.
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 media button preferences 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.