public final class

MediaLibraryService.MediaLibrarySession.Builder

extends androidx.media3.session.MediaSession.BuilderBase<MediaLibraryService.MediaLibrarySession, MediaLibraryService.MediaLibrarySession.Builder, MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback>

 java.lang.Object

↳androidx.media3.session.MediaSession.BuilderBase<MediaLibraryService.MediaLibrarySession, MediaLibraryService.MediaLibrarySession.Builder, MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback>

↳androidx.media3.session.MediaLibraryService.MediaLibrarySession.Builder

Overview

A builder for MediaLibraryService.MediaLibrarySession.

Any incoming requests from the MediaBrowser will be handled on the application thread of the underlying Player.

Summary

Constructors
publicBuilder(MediaLibraryService service, Player player, MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback callback)

Creates a builder for MediaLibraryService.MediaLibrarySession.

Methods
public MediaLibraryService.MediaLibrarySessionbuild()

Builds a MediaLibraryService.MediaLibrarySession.

public MediaLibraryService.MediaLibrarySession.BuildersetExtras(Bundle extras)

Sets an extra for the MediaLibraryService.MediaLibrarySession.

public MediaLibraryService.MediaLibrarySession.BuildersetId(java.lang.String id)

Sets an ID of the MediaLibraryService.MediaLibrarySession.

public MediaLibraryService.MediaLibrarySession.BuildersetMediaItemFiller(MediaSession.MediaItemFiller mediaItemFiller)

Sets the logic used to fill in the fields of a MediaItem.

public MediaLibraryService.MediaLibrarySession.BuildersetSessionActivity(PendingIntent pendingIntent)

Sets a PendingIntent to launch an for the MediaLibraryService.MediaLibrarySession.

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

Constructors

Creates a builder for MediaLibraryService.MediaLibrarySession.

Parameters:

service: The MediaLibraryService that instantiates the MediaLibraryService.MediaLibrarySession.
player: The underlying player to perform playback and handle transport controls.
callback: The callback to handle requests from MediaBrowser.

Methods

public MediaLibraryService.MediaLibrarySession.Builder setSessionActivity(PendingIntent pendingIntent)

Sets a PendingIntent to launch an for the MediaLibraryService.MediaLibrarySession. This can be used as a quick link to an ongoing media screen.

Parameters:

pendingIntent: The pending intent.

Returns:

The builder to allow chaining.

public MediaLibraryService.MediaLibrarySession.Builder setId(java.lang.String id)

Sets an ID of the MediaLibraryService.MediaLibrarySession. If not set, an empty string will be used.

Use this if and only if your app supports multiple playback at the same time and also wants to provide external apps to have finer-grained controls.

Parameters:

id: The ID. Must be unique among all sessions per package.

Returns:

The builder to allow chaining.

Sets the logic used to fill in the fields of a MediaItem.

Parameters:

mediaItemFiller: The filler.

Returns:

The builder to allow chaining.

public MediaLibraryService.MediaLibrarySession.Builder setExtras(Bundle extras)

Sets an extra for the MediaLibraryService.MediaLibrarySession. The MediaSession.getToken() session token} will have the extras. If not set, an empty will be used.

Parameters:

extras: The extra .

Returns:

The builder to allow chaining.

Builds a MediaLibraryService.MediaLibrarySession.

Returns:

A new session.