Back to Exoplayer

SessionCallbackBuilder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/ext/media2/SessionCallbackBuilder.html

latest15.5 KB
Original Source

Package com.google.android.exoplayer2.ext.media2

Class SessionCallbackBuilder

  • java.lang.Object

    • com.google.android.exoplayer2.ext.media2.SessionCallbackBuilder

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classSessionCallbackBuilderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Builds a MediaSession.SessionCallback with various collaborators. See Also:MediaSession.SessionCallback

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static interface | SessionCallbackBuilder.AllowedCommandProvider | Deprecated.

Provides allowed commands for MediaController. | | static interface | SessionCallbackBuilder.CustomCommandProvider | Deprecated.

Callbacks for querying what custom commands are supported, and for handling a custom command when a controller sends it. | | static class | SessionCallbackBuilder.DefaultAllowedCommandProvider | Deprecated.

Default implementation of SessionCallbackBuilder.AllowedCommandProvider that behaves as follows: Accepts connection requests from controller if any of the following conditions are met: Controller is in the same package as the session. | | static interface | SessionCallbackBuilder.DisconnectedCallback | Deprecated.

Callback for handling controller disconnection. | | static class | SessionCallbackBuilder.MediaIdMediaItemProvider | Deprecated.

A SessionCallbackBuilder.MediaItemProvider that creates media items containing only a media ID. | | static interface | SessionCallbackBuilder.MediaItemProvider | Deprecated.

Provides the MediaItem. | | static interface | SessionCallbackBuilder.PostConnectCallback | Deprecated.

Callback for handling extra initialization after the connection. | | static interface | SessionCallbackBuilder.RatingCallback | Deprecated.

Callback receiving a user rating for a specified media id. | | static interface | SessionCallbackBuilder.SkipCallback | Deprecated.

Callback receiving skip backward and skip forward. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static int | DEFAULT_SEEK_TIMEOUT_MS | Deprecated.

Default timeout value for setSeekTimeoutMs(int). |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | SessionCallbackBuilder​(Context context, SessionPlayerConnector sessionPlayerConnector) | Deprecated.

Creates a new builder. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | androidx.media2.session.MediaSession.SessionCallback | build() | Deprecated.

Builds MediaSession.SessionCallback. | | SessionCallbackBuilder | setAllowedCommandProvider​(SessionCallbackBuilder.AllowedCommandProvider allowedCommandProvider) | Deprecated.

Sets the SessionCallbackBuilder.AllowedCommandProvider to provide allowed commands for controllers. | | SessionCallbackBuilder | setCustomCommandProvider​(SessionCallbackBuilder.CustomCommandProvider customCommandProvider) | Deprecated.

Sets the SessionCallbackBuilder.CustomCommandProvider to handle incoming custom commands. | | SessionCallbackBuilder | setDisconnectedCallback​(SessionCallbackBuilder.DisconnectedCallback disconnectedCallback) | Deprecated.

Sets the SessionCallbackBuilder.DisconnectedCallback to handle cleaning up controller. | | SessionCallbackBuilder | setFastForwardIncrementMs​(int fastForwardMs) | Deprecated.

Sets the fast forward increment in milliseconds. | | SessionCallbackBuilder | setMediaItemProvider​(SessionCallbackBuilder.MediaItemProvider mediaItemProvider) | Deprecated.

Sets the SessionCallbackBuilder.MediaItemProvider that will convert media ids to MediaItems. | | SessionCallbackBuilder | setPostConnectCallback​(SessionCallbackBuilder.PostConnectCallback postConnectCallback) | Deprecated.

Sets the SessionCallbackBuilder.PostConnectCallback to handle extra initialization after the connection. | | SessionCallbackBuilder | setRatingCallback​(SessionCallbackBuilder.RatingCallback ratingCallback) | Deprecated.

Sets the SessionCallbackBuilder.RatingCallback to handle user ratings. | | SessionCallbackBuilder | setRewindIncrementMs​(int rewindMs) | Deprecated.

Sets the rewind increment in milliseconds. | | SessionCallbackBuilder | setSeekTimeoutMs​(int seekTimeoutMs) | Deprecated.

Sets the timeout in milliseconds for fast forward and rewind operations, or 0 for no timeout. | | SessionCallbackBuilder | setSkipCallback​(SessionCallbackBuilder.SkipCallback skipCallback) | Deprecated.

Sets the SessionCallbackBuilder.SkipCallback to handle skip backward and skip forward. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

DEFAULT_SEEK_TIMEOUT_MS

public static final int DEFAULT_SEEK_TIMEOUT_MS

Deprecated.

Default timeout value for setSeekTimeoutMs(int). See Also:Constant Field Values

Constructor Detail

- 

SessionCallbackBuilder

public SessionCallbackBuilder​([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context,[SessionPlayerConnector](SessionPlayerConnector.html "class in com.google.android.exoplayer2.ext.media2")sessionPlayerConnector)

Deprecated.

Creates a new builder.

The builder uses the following default values:

  - [`SessionCallbackBuilder.AllowedCommandProvider`](SessionCallbackBuilder.AllowedCommandProvider.html "interface in com.google.android.exoplayer2.ext.media2"): [`SessionCallbackBuilder.DefaultAllowedCommandProvider`](SessionCallbackBuilder.DefaultAllowedCommandProvider.html "class in com.google.android.exoplayer2.ext.media2")
  - Seek timeout: [`DEFAULT_SEEK_TIMEOUT_MS`](#DEFAULT_SEEK_TIMEOUT_MS)
  - 

Unless stated above, null or 0 would be used to disallow relevant features. Parameters:context - A context.sessionPlayerConnector - A session player connector to handle incoming calls from the controller.

Method Detail

- 

setRatingCallback

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setRatingCallback​(@Nullable[SessionCallbackBuilder.RatingCallback](SessionCallbackBuilder.RatingCallback.html "interface in com.google.android.exoplayer2.ext.media2")ratingCallback)

Deprecated.

Sets the SessionCallbackBuilder.RatingCallback to handle user ratings. Parameters:ratingCallback - A rating callback.Returns:This builder.See Also:MediaSession.SessionCallback.onSetRating(MediaSession, ControllerInfo, String, Rating), MediaController.setRating(String, Rating)

- 

setCustomCommandProvider

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setCustomCommandProvider​(@Nullable[SessionCallbackBuilder.CustomCommandProvider](SessionCallbackBuilder.CustomCommandProvider.html "interface in com.google.android.exoplayer2.ext.media2")customCommandProvider)

Deprecated.

Sets the SessionCallbackBuilder.CustomCommandProvider to handle incoming custom commands. Parameters:customCommandProvider - A custom command provider.Returns:This builder.See Also:MediaSession.SessionCallback.onCustomCommand(MediaSession, ControllerInfo, SessionCommand, Bundle), MediaController.sendCustomCommand(SessionCommand, Bundle)

- 

setMediaItemProvider

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setMediaItemProvider​(@Nullable[SessionCallbackBuilder.MediaItemProvider](SessionCallbackBuilder.MediaItemProvider.html "interface in com.google.android.exoplayer2.ext.media2")mediaItemProvider)

Deprecated.

Sets the SessionCallbackBuilder.MediaItemProvider that will convert media ids to MediaItems. Parameters:mediaItemProvider - The media item provider.Returns:This builder.See Also:MediaSession.SessionCallback.onCreateMediaItem(MediaSession, ControllerInfo, String), MediaController.addPlaylistItem(int, String), MediaController.replacePlaylistItem(int, String), MediaController.setMediaItem(String), MediaController.setPlaylist(List, MediaMetadata)

- 

setAllowedCommandProvider

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setAllowedCommandProvider​(@Nullable[SessionCallbackBuilder.AllowedCommandProvider](SessionCallbackBuilder.AllowedCommandProvider.html "interface in com.google.android.exoplayer2.ext.media2")allowedCommandProvider)

Deprecated.

Sets the SessionCallbackBuilder.AllowedCommandProvider to provide allowed commands for controllers. Parameters:allowedCommandProvider - A allowed command provider.Returns:This builder.

- 

setSkipCallback

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setSkipCallback​(@Nullable[SessionCallbackBuilder.SkipCallback](SessionCallbackBuilder.SkipCallback.html "interface in com.google.android.exoplayer2.ext.media2")skipCallback)

Deprecated.

Sets the SessionCallbackBuilder.SkipCallback to handle skip backward and skip forward. Parameters:skipCallback - The skip callback.Returns:This builder.See Also:MediaSession.SessionCallback.onSkipBackward(MediaSession, ControllerInfo), MediaSession.SessionCallback.onSkipForward(MediaSession, ControllerInfo), MediaController.skipBackward(), MediaController.skipForward()

- 

setPostConnectCallback

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setPostConnectCallback​(@Nullable[SessionCallbackBuilder.PostConnectCallback](SessionCallbackBuilder.PostConnectCallback.html "interface in com.google.android.exoplayer2.ext.media2")postConnectCallback)

Deprecated.

Sets the SessionCallbackBuilder.PostConnectCallback to handle extra initialization after the connection. Parameters:postConnectCallback - The post connect callback.Returns:This builder.See Also:MediaSession.SessionCallback.onPostConnect(MediaSession, ControllerInfo)

- 

setDisconnectedCallback

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setDisconnectedCallback​(@Nullable[SessionCallbackBuilder.DisconnectedCallback](SessionCallbackBuilder.DisconnectedCallback.html "interface in com.google.android.exoplayer2.ext.media2")disconnectedCallback)

Deprecated.

Sets the SessionCallbackBuilder.DisconnectedCallback to handle cleaning up controller. Parameters:disconnectedCallback - The disconnected callback.Returns:This builder.See Also:MediaSession.SessionCallback.onDisconnected(MediaSession, ControllerInfo)

- 

setRewindIncrementMs

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setRewindIncrementMs​(int rewindMs)

Deprecated.

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.See Also:MediaSession.SessionCallback.onRewind(MediaSession, MediaSession.ControllerInfo), setSeekTimeoutMs(int)

- 

setFastForwardIncrementMs

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setFastForwardIncrementMs​(int fastForwardMs)

Deprecated.

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.See Also:MediaSession.SessionCallback.onFastForward(MediaSession, MediaSession.ControllerInfo), setSeekTimeoutMs(int)

- 

setSeekTimeoutMs

@CanIgnoreReturnValue
public[SessionCallbackBuilder](SessionCallbackBuilder.html "class in com.google.android.exoplayer2.ext.media2")setSeekTimeoutMs​(int seekTimeoutMs)

Deprecated.

Sets the timeout in milliseconds for fast forward and rewind operations, or 0 for no timeout. If a timeout is set, controllers will receive an error if the session's call to SessionPlayer.seekTo(long) takes longer than this amount of time. Parameters:seekTimeoutMs - A timeout for SessionPlayer.seekTo(long). A non-positive value will wait forever.Returns:This builder.

- 

build

public androidx.media2.session.MediaSession.SessionCallback build()

Deprecated.

Builds MediaSession.SessionCallback. Returns:A new callback for a media session.