public class

MediaSession.ConnectionResult.AcceptedResultBuilder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.session.MediaSession.ConnectionResult.AcceptedResultBuilder

Overview

A builder for MediaSession.ConnectionResult instances to accept a connection.

Summary

Constructors
publicAcceptedResultBuilder(MediaSession mediaSession)

Creates an instance.

Methods
public MediaSession.ConnectionResultbuild()

Returns a new MediaSession.ConnectionResult instance for accepting a connection.

public MediaSession.ConnectionResult.AcceptedResultBuildersetAvailablePlayerCommands(Player.Commands availablePlayerCommands)

Sets the player commands that are available to the controller that gets this result returned when connecting.

public MediaSession.ConnectionResult.AcceptedResultBuildersetAvailableSessionCommands(SessionCommands availableSessionCommands)

Sets the session commands that are available to the controller that gets this result returned when connecting.

public MediaSession.ConnectionResult.AcceptedResultBuildersetCustomLayout(java.util.List<CommandButton> customLayout)

Sets the custom layout, overriding the custom layout of the session.

public MediaSession.ConnectionResult.AcceptedResultBuildersetSessionActivity(PendingIntent sessionActivity)

Sets the session activity, overriding the session activity of the session.

public MediaSession.ConnectionResult.AcceptedResultBuildersetSessionExtras(Bundle sessionExtras)

Sets the session extras, overriding the extras of the session.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public AcceptedResultBuilder(MediaSession mediaSession)

Creates an instance.

Parameters:

mediaSession: The session for which to create a MediaSession.ConnectionResult.

Methods

public MediaSession.ConnectionResult.AcceptedResultBuilder setAvailableSessionCommands(SessionCommands availableSessionCommands)

Sets the session commands that are available to the controller that gets this result returned when connecting.

The default is MediaSession.ConnectionResult.DEFAULT_SESSION_AND_LIBRARY_COMMANDS for a MediaLibraryService.MediaLibrarySession and MediaSession.ConnectionResult.DEFAULT_SESSION_COMMANDS for a MediaSession.

public MediaSession.ConnectionResult.AcceptedResultBuilder setAvailablePlayerCommands(Player.Commands availablePlayerCommands)

Sets the player commands that are available to the controller that gets this result returned when connecting.

This set of available player commands is intersected with the actual player commands supported by a player. The resulting intersection is the set of commands actually being available to a controller.

The default is MediaSession.ConnectionResult.DEFAULT_PLAYER_COMMANDS.

public MediaSession.ConnectionResult.AcceptedResultBuilder setCustomLayout(java.util.List<CommandButton> customLayout)

Sets the custom layout, overriding the custom layout of the session.

The default is null to indicate that the custom layout of the session should be used.

Make sure to have the session commands of all command buttons of the custom layout included in the MediaSession.ConnectionResult.AcceptedResultBuilder.setAvailableSessionCommands(SessionCommands) available session commands} On the controller side, the enabled flag is set to false if the available commands of the controller do not allow to use a button.

public MediaSession.ConnectionResult.AcceptedResultBuilder setSessionExtras(Bundle sessionExtras)

Sets the session extras, overriding the extras of the session.

The default is null to indicate that the extras of the session should be used.

public MediaSession.ConnectionResult.AcceptedResultBuilder setSessionActivity(PendingIntent sessionActivity)

Sets the session activity, overriding the session activity of the session.

The default is null to indicate that the session activity of the session should be used.

Returns a new MediaSession.ConnectionResult instance for accepting a connection.