Class SessionPlayerConnector

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    @Deprecated
    public final class SessionPlayerConnector
    extends androidx.media2.common.SessionPlayer
    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.
    An implementation of SessionPlayer that wraps a given ExoPlayer Player instance.

    Internally this implementation posts operations to and receives callbacks on the thread associated with Player.getApplicationLooper(), so it is important not to block this thread. In particular, when awaiting the result of an asynchronous session player operation, apps should generally use ListenableFuture.addListener(Runnable, Executor) to be notified of completion, rather than calling the blocking Future.get() method.

    • Constructor Detail

      • SessionPlayerConnector

        public SessionPlayerConnector​(Player player)
        Deprecated.
        Creates an instance using DefaultMediaItemConverter to convert between ExoPlayer and media2 MediaItems.
        Parameters:
        player - The player to wrap.
      • SessionPlayerConnector

        public SessionPlayerConnector​(Player player,
                                      MediaItemConverter mediaItemConverter)
        Deprecated.
        Creates an instance.
        Parameters:
        player - The player to wrap.
        mediaItemConverter - The MediaItemConverter.
    • Method Detail

      • play

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> play()
        Deprecated.
        Specified by:
        play in class androidx.media2.common.SessionPlayer
      • pause

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> pause()
        Deprecated.
        Specified by:
        pause in class androidx.media2.common.SessionPlayer
      • prepare

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> prepare()
        Deprecated.
        Specified by:
        prepare in class androidx.media2.common.SessionPlayer
      • seekTo

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> seekTo​(long position)
        Deprecated.
        Specified by:
        seekTo in class androidx.media2.common.SessionPlayer
      • setPlaybackSpeed

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setPlaybackSpeed​(@FloatRange(from=0.0,to=3.4028234663852886E38,fromInclusive=false)
                                                                                                    float playbackSpeed)
        Deprecated.
        Specified by:
        setPlaybackSpeed in class androidx.media2.common.SessionPlayer
      • setAudioAttributes

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setAudioAttributes​(androidx.media.AudioAttributesCompat attr)
        Deprecated.
        Specified by:
        setAudioAttributes in class androidx.media2.common.SessionPlayer
      • getPlayerState

        public int getPlayerState()
        Deprecated.
        Specified by:
        getPlayerState in class androidx.media2.common.SessionPlayer
      • getCurrentPosition

        public long getCurrentPosition()
        Deprecated.
        Specified by:
        getCurrentPosition in class androidx.media2.common.SessionPlayer
      • getDuration

        public long getDuration()
        Deprecated.
        Specified by:
        getDuration in class androidx.media2.common.SessionPlayer
      • getBufferedPosition

        public long getBufferedPosition()
        Deprecated.
        Specified by:
        getBufferedPosition in class androidx.media2.common.SessionPlayer
      • getBufferingState

        public int getBufferingState()
        Deprecated.
        Specified by:
        getBufferingState in class androidx.media2.common.SessionPlayer
      • getPlaybackSpeed

        @FloatRange(from=0.0,
                    to=3.4028234663852886E38,
                    fromInclusive=false)
        public float getPlaybackSpeed()
        Deprecated.
        Specified by:
        getPlaybackSpeed in class androidx.media2.common.SessionPlayer
      • getAudioAttributes

        @Nullable
        public androidx.media.AudioAttributesCompat getAudioAttributes()
        Deprecated.
        Specified by:
        getAudioAttributes in class androidx.media2.common.SessionPlayer
      • setMediaItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setMediaItem​(androidx.media2.common.MediaItem item)
        Deprecated.

        FileMediaItem and CallbackMediaItem are not supported.

        Specified by:
        setMediaItem in class androidx.media2.common.SessionPlayer
      • setPlaylist

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setPlaylist​(List<androidx.media2.common.MediaItem> playlist,
                                                                                               @Nullable
                                                                                               androidx.media2.common.MediaMetadata metadata)
        Deprecated.

        FileMediaItem and CallbackMediaItem are not supported.

        Specified by:
        setPlaylist in class androidx.media2.common.SessionPlayer
      • addPlaylistItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> addPlaylistItem​(int index,
                                                                                                   androidx.media2.common.MediaItem item)
        Deprecated.

        FileMediaItem and CallbackMediaItem are not supported.

        Specified by:
        addPlaylistItem in class androidx.media2.common.SessionPlayer
      • removePlaylistItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> removePlaylistItem​(@IntRange(from=0L)
                                                                                                      int index)
        Deprecated.
        Specified by:
        removePlaylistItem in class androidx.media2.common.SessionPlayer
      • replacePlaylistItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> replacePlaylistItem​(int index,
                                                                                                       androidx.media2.common.MediaItem item)
        Deprecated.

        FileMediaItem and CallbackMediaItem are not supported.

        Specified by:
        replacePlaylistItem in class androidx.media2.common.SessionPlayer
      • movePlaylistItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> movePlaylistItem​(int fromIndex,
                                                                                                    int toIndex)
        Deprecated.
        Overrides:
        movePlaylistItem in class androidx.media2.common.SessionPlayer
      • skipToPreviousPlaylistItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> skipToPreviousPlaylistItem()
        Deprecated.
        Specified by:
        skipToPreviousPlaylistItem in class androidx.media2.common.SessionPlayer
      • skipToNextPlaylistItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> skipToNextPlaylistItem()
        Deprecated.
        Specified by:
        skipToNextPlaylistItem in class androidx.media2.common.SessionPlayer
      • skipToPlaylistItem

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> skipToPlaylistItem​(@IntRange(from=0L)
                                                                                                      int index)
        Deprecated.
        Specified by:
        skipToPlaylistItem in class androidx.media2.common.SessionPlayer
      • updatePlaylistMetadata

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> updatePlaylistMetadata​(@Nullable
                                                                                                          androidx.media2.common.MediaMetadata metadata)
        Deprecated.
        Specified by:
        updatePlaylistMetadata in class androidx.media2.common.SessionPlayer
      • setRepeatMode

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setRepeatMode​(int repeatMode)
        Deprecated.
        Specified by:
        setRepeatMode in class androidx.media2.common.SessionPlayer
      • setShuffleMode

        public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setShuffleMode​(int shuffleMode)
        Deprecated.
        Specified by:
        setShuffleMode in class androidx.media2.common.SessionPlayer
      • getPlaylist

        @Nullable
        public List<androidx.media2.common.MediaItem> getPlaylist()
        Deprecated.
        Specified by:
        getPlaylist in class androidx.media2.common.SessionPlayer
      • getPlaylistMetadata

        @Nullable
        public androidx.media2.common.MediaMetadata getPlaylistMetadata()
        Deprecated.
        Specified by:
        getPlaylistMetadata in class androidx.media2.common.SessionPlayer
      • getRepeatMode

        public int getRepeatMode()
        Deprecated.
        Specified by:
        getRepeatMode in class androidx.media2.common.SessionPlayer
      • getShuffleMode

        public int getShuffleMode()
        Deprecated.
        Specified by:
        getShuffleMode in class androidx.media2.common.SessionPlayer
      • getCurrentMediaItem

        @Nullable
        public androidx.media2.common.MediaItem getCurrentMediaItem()
        Deprecated.
        Specified by:
        getCurrentMediaItem in class androidx.media2.common.SessionPlayer
      • getCurrentMediaItemIndex

        public int getCurrentMediaItemIndex()
        Deprecated.
        Specified by:
        getCurrentMediaItemIndex in class androidx.media2.common.SessionPlayer
      • getPreviousMediaItemIndex

        public int getPreviousMediaItemIndex()
        Deprecated.
        Specified by:
        getPreviousMediaItemIndex in class androidx.media2.common.SessionPlayer
      • getNextMediaItemIndex

        public int getNextMediaItemIndex()
        Deprecated.
        Specified by:
        getNextMediaItemIndex in class androidx.media2.common.SessionPlayer
      • close

        public void close()
        Deprecated.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Overrides:
        close in class androidx.media2.common.SessionPlayer