Package com.castlabs.sdk.mediasession
Class MediaSessionBuilder
java.lang.Object
com.castlabs.sdk.mediasession.MediaSessionBuilder
Media Session builder allowing customizations
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionsetAllowedCommandProvider
(SessionCallbackBuilder.AllowedCommandProvider allowedCommandProvider) Sets theSessionCallbackBuilder.AllowedCommandProvider
to provide allowed commands for controllerssetCustomCommandProvider
(SessionCallbackBuilder.CustomCommandProvider customCommandProvider) Sets theSessionCallbackBuilder.CustomCommandProvider
to handle incoming custom commandssetDisconnectedCallback
(SessionCallbackBuilder.DisconnectedCallback disconnectedCallback) Sets theSessionCallbackBuilder.DisconnectedCallback
to handle cleaning up controllersetFastForwardIncrementMs
(int fastForwardMs) Sets the fast forward increment in millisecondssetMediaItemProvider
(SessionCallbackBuilder.MediaItemProvider mediaItemProvider) Sets theSessionCallbackBuilder.MediaItemProvider
that will convert media ids toMediaItems
setPostConnectCallback
(SessionCallbackBuilder.PostConnectCallback postConnectCallback) Sets theSessionCallbackBuilder.PostConnectCallback
to handle extra initialization after the connectionsetRatingCallback
(SessionCallbackBuilder.RatingCallback ratingCallback) Sets theSessionCallbackBuilder.RatingCallback
to handle user ratingssetRewindIncrementMs
(int rewindMs) Sets the rewind increment in millisecondssetSeekTimeoutMs
(int seekTimeoutMs) Sets the timeout in milliseconds for fast forward and rewind operations, or0
for no timeout.setSkipCallback
(SessionCallbackBuilder.SkipCallback skipCallback) Sets theSessionCallbackBuilder.SkipCallback
to handle skip backward and skip forward
-
Constructor Details
-
MediaSessionBuilder
public MediaSessionBuilder()Constructs default MediaSessionBuilder
-
-
Method Details
-
setRatingCallback
public MediaSessionBuilder setRatingCallback(@Nullable SessionCallbackBuilder.RatingCallback ratingCallback) Sets theSessionCallbackBuilder.RatingCallback
to handle user ratings- Parameters:
ratingCallback
- A rating callback- Returns:
- This builder
-
setCustomCommandProvider
public MediaSessionBuilder setCustomCommandProvider(@Nullable SessionCallbackBuilder.CustomCommandProvider customCommandProvider) Sets theSessionCallbackBuilder.CustomCommandProvider
to handle incoming custom commands- Parameters:
customCommandProvider
- A custom command provider- Returns:
- This builder
-
setMediaItemProvider
public MediaSessionBuilder setMediaItemProvider(@Nullable SessionCallbackBuilder.MediaItemProvider mediaItemProvider) Sets theSessionCallbackBuilder.MediaItemProvider
that will convert media ids toMediaItems
- Parameters:
mediaItemProvider
- The media item provider- Returns:
- This builder
-
setAllowedCommandProvider
public MediaSessionBuilder setAllowedCommandProvider(@Nullable SessionCallbackBuilder.AllowedCommandProvider allowedCommandProvider) Sets theSessionCallbackBuilder.AllowedCommandProvider
to provide allowed commands for controllers- Parameters:
allowedCommandProvider
- A allowed command provider- Returns:
- This builder
-
setSkipCallback
public MediaSessionBuilder setSkipCallback(@Nullable SessionCallbackBuilder.SkipCallback skipCallback) Sets theSessionCallbackBuilder.SkipCallback
to handle skip backward and skip forward- Parameters:
skipCallback
- The skip callback- Returns:
- This builder
-
setPostConnectCallback
public MediaSessionBuilder setPostConnectCallback(@Nullable SessionCallbackBuilder.PostConnectCallback postConnectCallback) Sets theSessionCallbackBuilder.PostConnectCallback
to handle extra initialization after the connection- Parameters:
postConnectCallback
- The post connect callback- Returns:
- This builder
-
setDisconnectedCallback
public MediaSessionBuilder setDisconnectedCallback(@Nullable SessionCallbackBuilder.DisconnectedCallback disconnectedCallback) Sets theSessionCallbackBuilder.DisconnectedCallback
to handle cleaning up controller- Parameters:
disconnectedCallback
- The disconnected callback- Returns:
- This builder
-
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
-
setSeekTimeoutMs
Sets the timeout in milliseconds for fast forward and rewind operations, or0
for no timeout. If a timeout is set, controllers will receive an error if the session's call toSessionPlayer.seekTo(long)
takes longer than this amount of time- Parameters:
seekTimeoutMs
- A timeout forSessionPlayer.seekTo(long)
. A non-positive value will wait forever- Returns:
- This builder
-