Class SessionPlayerConnector
- java.lang.Object
-
- androidx.media2.common.SessionPlayer
-
- com.google.android.exoplayer2.ext.media2.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 ofSessionPlayer
that wraps a given ExoPlayerPlayer
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 useListenableFuture.addListener(Runnable, Executor)
to be notified of completion, rather than calling the blockingFuture.get()
method.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class androidx.media2.common.SessionPlayer
androidx.media2.common.SessionPlayer.BuffState, androidx.media2.common.SessionPlayer.PlayerCallback, androidx.media2.common.SessionPlayer.PlayerResult, androidx.media2.common.SessionPlayer.PlayerState, androidx.media2.common.SessionPlayer.RepeatMode, androidx.media2.common.SessionPlayer.ShuffleMode, androidx.media2.common.SessionPlayer.TrackInfo
-
-
Field Summary
-
Fields inherited from class androidx.media2.common.SessionPlayer
BUFFERING_STATE_BUFFERING_AND_PLAYABLE, BUFFERING_STATE_BUFFERING_AND_STARVED, BUFFERING_STATE_COMPLETE, BUFFERING_STATE_UNKNOWN, INVALID_ITEM_INDEX, PLAYER_STATE_ERROR, PLAYER_STATE_IDLE, PLAYER_STATE_PAUSED, PLAYER_STATE_PLAYING, REPEAT_MODE_ALL, REPEAT_MODE_GROUP, REPEAT_MODE_NONE, REPEAT_MODE_ONE, SHUFFLE_MODE_ALL, SHUFFLE_MODE_GROUP, SHUFFLE_MODE_NONE, UNKNOWN_TIME
-
-
Constructor Summary
Constructors Constructor Description SessionPlayerConnector(Player player)
Deprecated.Creates an instance usingDefaultMediaItemConverter
to convert between ExoPlayer and media2 MediaItems.SessionPlayerConnector(Player player, MediaItemConverter mediaItemConverter)
Deprecated.Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
addPlaylistItem(int index, androidx.media2.common.MediaItem item)
Deprecated.void
close()
Deprecated.androidx.media.AudioAttributesCompat
getAudioAttributes()
Deprecated.long
getBufferedPosition()
Deprecated.int
getBufferingState()
Deprecated.androidx.media2.common.MediaItem
getCurrentMediaItem()
Deprecated.int
getCurrentMediaItemIndex()
Deprecated.long
getCurrentPosition()
Deprecated.long
getDuration()
Deprecated.int
getNextMediaItemIndex()
Deprecated.float
getPlaybackSpeed()
Deprecated.int
getPlayerState()
Deprecated.List<androidx.media2.common.MediaItem>
getPlaylist()
Deprecated.androidx.media2.common.MediaMetadata
getPlaylistMetadata()
Deprecated.int
getPreviousMediaItemIndex()
Deprecated.int
getRepeatMode()
Deprecated.int
getShuffleMode()
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
movePlaylistItem(int fromIndex, int toIndex)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
pause()
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
play()
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
prepare()
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
removePlaylistItem(int index)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
replacePlaylistItem(int index, androidx.media2.common.MediaItem item)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
seekTo(long position)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
setAudioAttributes(androidx.media.AudioAttributesCompat attr)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
setMediaItem(androidx.media2.common.MediaItem item)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
setPlaybackSpeed(float playbackSpeed)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
setPlaylist(List<androidx.media2.common.MediaItem> playlist, androidx.media2.common.MediaMetadata metadata)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
setRepeatMode(int repeatMode)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
setShuffleMode(int shuffleMode)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
skipToNextPlaylistItem()
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
skipToPlaylistItem(int index)
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
skipToPreviousPlaylistItem()
Deprecated.ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult>
updatePlaylistMetadata(androidx.media2.common.MediaMetadata metadata)
Deprecated.
-
-
-
Constructor Detail
-
SessionPlayerConnector
public SessionPlayerConnector(Player player)
Deprecated.Creates an instance usingDefaultMediaItemConverter
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
- TheMediaItemConverter
.
-
-
Method Detail
-
play
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> play()
Deprecated.- Specified by:
play
in classandroidx.media2.common.SessionPlayer
-
pause
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> pause()
Deprecated.- Specified by:
pause
in classandroidx.media2.common.SessionPlayer
-
prepare
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> prepare()
Deprecated.- Specified by:
prepare
in classandroidx.media2.common.SessionPlayer
-
seekTo
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> seekTo(long position)
Deprecated.- Specified by:
seekTo
in classandroidx.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 classandroidx.media2.common.SessionPlayer
-
setAudioAttributes
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setAudioAttributes(androidx.media.AudioAttributesCompat attr)
Deprecated.- Specified by:
setAudioAttributes
in classandroidx.media2.common.SessionPlayer
-
getPlayerState
public int getPlayerState()
Deprecated.- Specified by:
getPlayerState
in classandroidx.media2.common.SessionPlayer
-
getCurrentPosition
public long getCurrentPosition()
Deprecated.- Specified by:
getCurrentPosition
in classandroidx.media2.common.SessionPlayer
-
getDuration
public long getDuration()
Deprecated.- Specified by:
getDuration
in classandroidx.media2.common.SessionPlayer
-
getBufferedPosition
public long getBufferedPosition()
Deprecated.- Specified by:
getBufferedPosition
in classandroidx.media2.common.SessionPlayer
-
getBufferingState
public int getBufferingState()
Deprecated.- Specified by:
getBufferingState
in classandroidx.media2.common.SessionPlayer
-
getPlaybackSpeed
@FloatRange(from=0.0, to=3.4028234663852886E38, fromInclusive=false) public float getPlaybackSpeed()
Deprecated.- Specified by:
getPlaybackSpeed
in classandroidx.media2.common.SessionPlayer
-
getAudioAttributes
@Nullable public androidx.media.AudioAttributesCompat getAudioAttributes()
Deprecated.- Specified by:
getAudioAttributes
in classandroidx.media2.common.SessionPlayer
-
setMediaItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setMediaItem(androidx.media2.common.MediaItem item)
Deprecated.FileMediaItem
andCallbackMediaItem
are not supported.- Specified by:
setMediaItem
in classandroidx.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
andCallbackMediaItem
are not supported.- Specified by:
setPlaylist
in classandroidx.media2.common.SessionPlayer
-
addPlaylistItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> addPlaylistItem(int index, androidx.media2.common.MediaItem item)
Deprecated.FileMediaItem
andCallbackMediaItem
are not supported.- Specified by:
addPlaylistItem
in classandroidx.media2.common.SessionPlayer
-
removePlaylistItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> removePlaylistItem(@IntRange(from=0L) int index)
Deprecated.- Specified by:
removePlaylistItem
in classandroidx.media2.common.SessionPlayer
-
replacePlaylistItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> replacePlaylistItem(int index, androidx.media2.common.MediaItem item)
Deprecated.FileMediaItem
andCallbackMediaItem
are not supported.- Specified by:
replacePlaylistItem
in classandroidx.media2.common.SessionPlayer
-
movePlaylistItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> movePlaylistItem(int fromIndex, int toIndex)
Deprecated.- Overrides:
movePlaylistItem
in classandroidx.media2.common.SessionPlayer
-
skipToPreviousPlaylistItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> skipToPreviousPlaylistItem()
Deprecated.- Specified by:
skipToPreviousPlaylistItem
in classandroidx.media2.common.SessionPlayer
-
skipToNextPlaylistItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> skipToNextPlaylistItem()
Deprecated.- Specified by:
skipToNextPlaylistItem
in classandroidx.media2.common.SessionPlayer
-
skipToPlaylistItem
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> skipToPlaylistItem(@IntRange(from=0L) int index)
Deprecated.- Specified by:
skipToPlaylistItem
in classandroidx.media2.common.SessionPlayer
-
updatePlaylistMetadata
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> updatePlaylistMetadata(@Nullable androidx.media2.common.MediaMetadata metadata)
Deprecated.- Specified by:
updatePlaylistMetadata
in classandroidx.media2.common.SessionPlayer
-
setRepeatMode
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setRepeatMode(int repeatMode)
Deprecated.- Specified by:
setRepeatMode
in classandroidx.media2.common.SessionPlayer
-
setShuffleMode
public ListenableFuture<androidx.media2.common.SessionPlayer.PlayerResult> setShuffleMode(int shuffleMode)
Deprecated.- Specified by:
setShuffleMode
in classandroidx.media2.common.SessionPlayer
-
getPlaylist
@Nullable public List<androidx.media2.common.MediaItem> getPlaylist()
Deprecated.- Specified by:
getPlaylist
in classandroidx.media2.common.SessionPlayer
-
getPlaylistMetadata
@Nullable public androidx.media2.common.MediaMetadata getPlaylistMetadata()
Deprecated.- Specified by:
getPlaylistMetadata
in classandroidx.media2.common.SessionPlayer
-
getRepeatMode
public int getRepeatMode()
Deprecated.- Specified by:
getRepeatMode
in classandroidx.media2.common.SessionPlayer
-
getShuffleMode
public int getShuffleMode()
Deprecated.- Specified by:
getShuffleMode
in classandroidx.media2.common.SessionPlayer
-
getCurrentMediaItem
@Nullable public androidx.media2.common.MediaItem getCurrentMediaItem()
Deprecated.- Specified by:
getCurrentMediaItem
in classandroidx.media2.common.SessionPlayer
-
getCurrentMediaItemIndex
public int getCurrentMediaItemIndex()
Deprecated.- Specified by:
getCurrentMediaItemIndex
in classandroidx.media2.common.SessionPlayer
-
getPreviousMediaItemIndex
public int getPreviousMediaItemIndex()
Deprecated.- Specified by:
getPreviousMediaItemIndex
in classandroidx.media2.common.SessionPlayer
-
getNextMediaItemIndex
public int getNextMediaItemIndex()
Deprecated.- Specified by:
getNextMediaItemIndex
in classandroidx.media2.common.SessionPlayer
-
close
public void close()
Deprecated.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classandroidx.media2.common.SessionPlayer
-
-