Package com.castlabs.sdk.mediasession
Class MediaSessionBuilder
java.lang.Object
com.castlabs.sdk.mediasession.MediaSessionBuilder
Media Session builder allowing customizations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A listener to provide media session events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetCommandButtons
(ArrayList<androidx.media3.session.CommandButton> commandButtons) Sets custom command buttons that will be shown in the media style notification.setCustomMediaSessionServiceClass
(Class<? extends androidx.media3.session.MediaSessionService> customMediaSessionServiceClass) Sets a custom media session service class.setFastForwardIncrementMs
(int fastForwardMs) Sets the fast forward increment in millisecondssetListener
(MediaSessionBuilder.Listener listener) Sets a listener for receiving media session events.setPlayerCommands
(androidx.media3.common.Player.Commands playerCommands) Sets available player commands for the session.setRewindIncrementMs
(int rewindMs) Sets the rewind increment in millisecondssetSessionActivity
(PendingIntent pendingIntent) setSessionCommands
(androidx.media3.session.SessionCommands sessionCommands) Sets custom session commands for the session.
-
Constructor Details
-
MediaSessionBuilder
public MediaSessionBuilder()Constructs default MediaSessionBuilder
-
-
Method Details
-
setRewindIncrementMs
Sets the rewind increment in milliseconds- Parameters:
rewindMs
- The rewind increment in milliseconds. A non-positive value will cause the rewind to be disabled- Returns:
- This builder
-
setFastForwardIncrementMs
Sets the fast forward increment in milliseconds- Parameters:
fastForwardMs
- The fast forward increment in milliseconds. A non-positive value will cause the fast forward to be disabled- Returns:
- This builder
-
setSessionCommands
@NonNull public MediaSessionBuilder setSessionCommands(@NonNull androidx.media3.session.SessionCommands sessionCommands) Sets custom session commands for the session.- Parameters:
sessionCommands
- The session commands to be set- Returns:
- This builder
-
setPlayerCommands
@NonNull public MediaSessionBuilder setPlayerCommands(@NonNull androidx.media3.common.Player.Commands playerCommands) Sets available player commands for the session.- Parameters:
playerCommands
- The player commands to be set- Returns:
- This builder
-
setCommandButtons
@NonNull public MediaSessionBuilder setCommandButtons(@NonNull ArrayList<androidx.media3.session.CommandButton> commandButtons) Sets custom command buttons that will be shown in the media style notification.- Parameters:
commandButtons
- The command buttons to be set- Returns:
- This builder
-
setListener
Sets a listener for receiving media session events.- Parameters:
listener
- The listener to be set- Returns:
- This builder
-
setCustomMediaSessionServiceClass
@NonNull public MediaSessionBuilder setCustomMediaSessionServiceClass(@Nullable Class<? extends androidx.media3.session.MediaSessionService> customMediaSessionServiceClass) Sets a custom media session service class.- Parameters:
customMediaSessionServiceClass
- The custom media session service class to be set- Returns:
- This builder
-
setSessionActivity
- Parameters:
pendingIntent
- The pending intent to be set- Returns:
- This builder
-