Class SessionCallbackBuilder


  • @Deprecated
    public final class SessionCallbackBuilder
    extends Object
    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
    • Method Detail

      • setMediaItemProvider

        @CanIgnoreReturnValue
        public SessionCallbackBuilder setMediaItemProvider​(@Nullable
                                                           SessionCallbackBuilder.MediaItemProvider 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)
      • setSkipCallback

        @CanIgnoreReturnValue
        public SessionCallbackBuilder setSkipCallback​(@Nullable
                                                      SessionCallbackBuilder.SkipCallback 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()
      • setRewindIncrementMs

        @CanIgnoreReturnValue
        public SessionCallbackBuilder 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 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 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.