ForwardingPlayer
@UnstableApi
class ForwardingPlayer : Player
CastPlayer |
|
A Player that forwards method calls to another Player. Applications can use this class to suppress or modify specific operations, by overriding the respective methods.
Subclasses must ensure they maintain consistency with the Player interface, including interactions with Player.Listener, which can be quite fiddly. For example, if removing an available Player.Command and disabling the corresponding method, subclasses need to:
- Override
isCommandAvailableandgetAvailableCommands - Override and no-op the method itself
- Override
addListenerand wrap the providedPlayer.Listenerwith an implementation that drops calls toonAvailableCommandsChangedandonEventsif they were only triggered by a change in command availability that is 'invisible' after the command removal.
Many customization use-cases are instead better served by ForwardingSimpleBasePlayer, which allows subclasses to more concisely modify the behavior of an operation, or disallow a Player.Command. In many cases ForwardingSimpleBasePlayer should be used in preference to ForwardingPlayer.
Summary
Public constructors |
|---|
ForwardingPlayer(player: Player!)Creates a new instance that forwards all operations to |
Public functions |
|
|---|---|
Unit |
addListener(listener: Player.Listener!)Calls |
Unit |
addMediaItem(mediaItem: MediaItem!)Calls |
Unit |
addMediaItem(index: Int, mediaItem: MediaItem!)Calls |
Unit |
addMediaItems(mediaItems: (Mutable)List<MediaItem!>!)Calls |
Unit |
addMediaItems(index: Int, mediaItems: (Mutable)List<MediaItem!>!)Calls |
Boolean |
Calls |
Unit |
Calls |
Unit |
Calls |
Unit |
clearVideoSurface(surface: Surface?)Calls |
Unit |
clearVideoSurfaceHolder(surfaceHolder: SurfaceHolder?)Calls |
Unit |
clearVideoSurfaceView(surfaceView: SurfaceView?)Calls |
Unit |
clearVideoTextureView(textureView: TextureView?)Calls |
Unit |
This function is deprecated. Use |
Unit |
decreaseDeviceVolume(@C.VolumeFlags flags: Int)Calls |
Looper! |
Calls |
AudioAttributes! |
Calls |
Int |
Calls |
Player.Commands! |
Calls |
Int |
Calls |
Long |
Calls |
Long |
Calls |
Long |
Calls |
Long |
Calls |
Int |
Calls |
Int |
Calls |
CueGroup! |
Calls |
Long |
Calls |
Any? |
Calls |
MediaItem? |
Calls |
Int |
Calls |
Int |
Calls |
Long |
Calls |
Timeline! |
Calls |
Tracks! |
Calls |
Int |
This function is deprecated. Use |
DeviceInfo! |
Calls |
Int |
Calls |
Long |
Calls |
Long |
Calls |
MediaItem! |
getMediaItemAt(index: Int)Calls |
Int |
Calls |
MediaMetadata! |
Calls |
Int |
Calls |
Int |
This function is deprecated. Use |
Boolean |
Calls |
PlaybackParameters! |
Calls |
Int |
Calls |
Int |
Calls |
PlaybackException? |
Calls |
MediaMetadata! |
Calls |
Int |
Calls |
Int |
This function is deprecated. Use |
Int |
Calls |
Long |
Calls |
Long |
Calls |
Boolean |
Calls |
Size! |
Calls |
Long |
Calls |
TrackSelectionParameters! |
Calls |
VideoSize! |
Calls |
Float |
Calls |
Player! |
Returns the |
Boolean |
Calls |
Boolean |
Calls |
Unit |
This function is deprecated. Use |
Unit |
increaseDeviceVolume(@C.VolumeFlags flags: Int)Calls |
Boolean |
isCommandAvailable(@Player.Command command: Int)Calls |
Boolean |
Calls |
Boolean |
Calls |
Boolean |
Calls |
Boolean |
This function is deprecated. Use |
Boolean |
This function is deprecated. Use |
Boolean |
This function is deprecated. Use |
Boolean |
Calls |
Boolean |
Calls |
Boolean |
Calls |
Boolean |
Calls |
Unit |
moveMediaItem(currentIndex: Int, newIndex: Int)Calls |
Unit |
moveMediaItems(fromIndex: Int, toIndex: Int, newIndex: Int)Calls |
Unit |
mute()Calls |
Unit |
pause()Calls |
Unit |
play()Calls |
Unit |
prepare()Calls |
Unit |
release()Calls |
Unit |
removeListener(listener: Player.Listener!)Calls |
Unit |
removeMediaItem(index: Int)Calls |
Unit |
removeMediaItems(fromIndex: Int, toIndex: Int)Calls |
Unit |
replaceMediaItem(index: Int, mediaItem: MediaItem!)Calls |
Unit |
Calls |
Unit |
seekBack()Calls |
Unit |
Calls |
Unit |
Calls |
Unit |
Calls |
Unit |
Calls |
Unit |
seekToDefaultPosition(mediaItemIndex: Int)Calls |
Unit |
Calls |
Unit |
Calls |
Unit |
Calls |
Unit |
Calls |
Unit |
setAudioAttributes(Calls |
Unit |
This function is deprecated. Use |
Unit |
setDeviceMuted(muted: Boolean, @C.VolumeFlags flags: Int)Calls |
Unit |
This function is deprecated. Use |
Unit |
setDeviceVolume(volume: Int, @C.VolumeFlags flags: Int)Calls |
Unit |
setMediaItem(mediaItem: MediaItem!)Calls |
Unit |
setMediaItem(mediaItem: MediaItem!, resetPosition: Boolean)Calls |
Unit |
setMediaItem(mediaItem: MediaItem!, startPositionMs: Long)Calls |
Unit |
setMediaItems(mediaItems: (Mutable)List<MediaItem!>!)Calls |
Unit |
setMediaItems(Calls |
Unit |
Calls |
Unit |
setPlayWhenReady(playWhenReady: Boolean)Calls |
Unit |
setPlaybackParameters(playbackParameters: PlaybackParameters!)Calls |
Unit |
setPlaybackSpeed(speed: Float)Calls |
Unit |
setPlaylistMetadata(mediaMetadata: MediaMetadata!)Calls |
Unit |
setRepeatMode(@Player.RepeatMode repeatMode: Int)Calls |
Unit |
setShuffleModeEnabled(shuffleModeEnabled: Boolean)Calls |
Unit |
setTrackSelectionParameters(parameters: TrackSelectionParameters!)Calls |
Unit |
setVideoSurface(surface: Surface?)Calls |
Unit |
setVideoSurfaceHolder(surfaceHolder: SurfaceHolder?)Calls |
Unit |
setVideoSurfaceView(surfaceView: SurfaceView?)Calls |
Unit |
setVideoTextureView(textureView: TextureView?)Calls |
Unit |
Calls |
Unit |
stop()Calls |
Unit |
unmute()Calls |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
ForwardingPlayer
ForwardingPlayer(player: Player!)
Creates a new instance that forwards all operations to player.
Public functions
addListener
fun addListener(listener: Player.Listener!): Unit
Calls addListener on the delegate.
Overrides of this method must not directly call
delegate.addListener. If the override wants to pass the Player.Listener instance to the delegate Player, it must do so by calling super.addListener instead. This ensures the correct Player instance is passed to onEvents (i.e. this forwarding instance, and not the underlying delegate instance).
addMediaItem
fun addMediaItem(index: Int, mediaItem: MediaItem!): Unit
Calls addMediaItem on the delegate.
addMediaItems
fun addMediaItems(mediaItems: (Mutable)List<MediaItem!>!): Unit
Calls addMediaItems on the delegate.
addMediaItems
fun addMediaItems(index: Int, mediaItems: (Mutable)List<MediaItem!>!): Unit
Calls addMediaItems on the delegate.
canAdvertiseSession
fun canAdvertiseSession(): Boolean
Calls canAdvertiseSession on the delegate and returns the result.
clearVideoSurface
fun clearVideoSurface(surface: Surface?): Unit
Calls clearVideoSurface on the delegate.
clearVideoSurfaceHolder
fun clearVideoSurfaceHolder(surfaceHolder: SurfaceHolder?): Unit
Calls clearVideoSurfaceHolder on the delegate.
clearVideoSurfaceView
fun clearVideoSurfaceView(surfaceView: SurfaceView?): Unit
Calls clearVideoSurfaceView on the delegate.
clearVideoTextureView
fun clearVideoTextureView(textureView: TextureView?): Unit
Calls clearVideoTextureView on the delegate.
decreaseDeviceVolume
fun decreaseDeviceVolume(@C.VolumeFlags flags: Int): Unit
Calls decreaseDeviceVolume on the delegate.
getApplicationLooper
fun getApplicationLooper(): Looper!
Calls getApplicationLooper on the delegate and returns the result.
getAudioAttributes
fun getAudioAttributes(): AudioAttributes!
Calls getAudioAttributes on the delegate and returns the result.
getAudioSessionId
fun getAudioSessionId(): Int
Calls getAudioSessionId on the delegate and returns the result.
getAvailableCommands
fun getAvailableCommands(): Player.Commands!
Calls getAvailableCommands on the delegate and returns the result.
getBufferedPercentage
fun getBufferedPercentage(): Int
Calls getBufferedPercentage on the delegate and returns the result.
getBufferedPosition
fun getBufferedPosition(): Long
Calls getBufferedPosition on the delegate and returns the result.
getContentBufferedPosition
fun getContentBufferedPosition(): Long
Calls getContentBufferedPosition on the delegate and returns the result.
getContentDuration
fun getContentDuration(): Long
Calls getContentDuration on the delegate and returns the result.
getContentPosition
fun getContentPosition(): Long
Calls getContentPosition on the delegate and returns the result.
getCurrentAdGroupIndex
fun getCurrentAdGroupIndex(): Int
Calls getCurrentAdGroupIndex on the delegate and returns the result.
getCurrentAdIndexInAdGroup
fun getCurrentAdIndexInAdGroup(): Int
Calls getCurrentAdIndexInAdGroup on the delegate and returns the result.
getCurrentCues
fun getCurrentCues(): CueGroup!
Calls getCurrentCues on the delegate and returns the result.
getCurrentLiveOffset
fun getCurrentLiveOffset(): Long
Calls getCurrentLiveOffset on the delegate and returns the result.
getCurrentManifest
fun getCurrentManifest(): Any?
Calls getCurrentManifest on the delegate and returns the result.
getCurrentMediaItem
fun getCurrentMediaItem(): MediaItem?
Calls getCurrentMediaItem on the delegate and returns the result.
getCurrentMediaItemIndex
fun getCurrentMediaItemIndex(): Int
Calls getCurrentMediaItemIndex on the delegate and returns the result.
getCurrentPeriodIndex
fun getCurrentPeriodIndex(): Int
Calls getCurrentPeriodIndex on the delegate and returns the result.
getCurrentPosition
fun getCurrentPosition(): Long
Calls getCurrentPosition on the delegate and returns the result.
getCurrentTimeline
fun getCurrentTimeline(): Timeline!
Calls getCurrentTimeline on the delegate and returns the result.
getCurrentTracks
fun getCurrentTracks(): Tracks!
Calls getCurrentTracks on the delegate and returns the result.
getCurrentWindowIndex
fungetCurrentWindowIndex(): Int
Calls getCurrentWindowIndex on the delegate and returns the result.
getDeviceInfo
fun getDeviceInfo(): DeviceInfo!
Calls getDeviceInfo on the delegate and returns the result.
getDeviceVolume
fun getDeviceVolume(): Int
Calls getDeviceVolume on the delegate and returns the result.
getMaxSeekToPreviousPosition
fun getMaxSeekToPreviousPosition(): Long
Calls getMaxSeekToPreviousPosition on the delegate and returns the result.
getMediaItemAt
fun getMediaItemAt(index: Int): MediaItem!
Calls getMediaItemAt on the delegate and returns the result.
getMediaItemCount
fun getMediaItemCount(): Int
Calls getMediaItemCount on the delegate and returns the result.
getMediaMetadata
fun getMediaMetadata(): MediaMetadata!
Calls getMediaMetadata on the delegate and returns the result.
getNextMediaItemIndex
fun getNextMediaItemIndex(): Int
Calls getNextMediaItemIndex on the delegate and returns the result.
getNextWindowIndex
fungetNextWindowIndex(): Int
Calls getNextWindowIndex on the delegate and returns the result.
getPlayWhenReady
fun getPlayWhenReady(): Boolean
Calls getPlayWhenReady on the delegate and returns the result.
getPlaybackParameters
fun getPlaybackParameters(): PlaybackParameters!
Calls getPlaybackParameters on the delegate and returns the result.
getPlaybackState
fun getPlaybackState(): Int
Calls getPlaybackState on the delegate and returns the result.
getPlaybackSuppressionReason
fun getPlaybackSuppressionReason(): Int
Calls getPlaybackSuppressionReason on the delegate and returns the result.
getPlayerError
fun getPlayerError(): PlaybackException?
Calls getPlayerError on the delegate and returns the result.
getPlaylistMetadata
fun getPlaylistMetadata(): MediaMetadata!
Calls getPlaylistMetadata on the delegate and returns the result.
getPreviousMediaItemIndex
fun getPreviousMediaItemIndex(): Int
Calls getPreviousMediaItemIndex on the delegate and returns the result.
getPreviousWindowIndex
fungetPreviousWindowIndex(): Int
Calls getPreviousWindowIndex on the delegate and returns the result.
getSeekBackIncrement
fun getSeekBackIncrement(): Long
Calls getSeekBackIncrement on the delegate and returns the result.
getSeekForwardIncrement
fun getSeekForwardIncrement(): Long
Calls getSeekForwardIncrement on the delegate and returns the result.
getShuffleModeEnabled
fun getShuffleModeEnabled(): Boolean
Calls getShuffleModeEnabled on the delegate and returns the result.
getSurfaceSize
fun getSurfaceSize(): Size!
Calls getSurfaceSize on the delegate and returns the result.
getTotalBufferedDuration
fun getTotalBufferedDuration(): Long
Calls getTotalBufferedDuration on the delegate and returns the result.
getTrackSelectionParameters
fun getTrackSelectionParameters(): TrackSelectionParameters!
Calls getTrackSelectionParameters on the delegate and returns the result.
getVideoSize
fun getVideoSize(): VideoSize!
Calls getVideoSize on the delegate and returns the result.
getWrappedPlayer
fun getWrappedPlayer(): Player!
Returns the Player to which operations are forwarded.
hasNextMediaItem
fun hasNextMediaItem(): Boolean
Calls hasNextMediaItem on the delegate and returns the result.
hasPreviousMediaItem
fun hasPreviousMediaItem(): Boolean
Calls hasPreviousMediaItem on the delegate and returns the result.
increaseDeviceVolume
fun increaseDeviceVolume(@C.VolumeFlags flags: Int): Unit
Calls increaseDeviceVolume on the delegate.
isCommandAvailable
fun isCommandAvailable(@Player.Command command: Int): Boolean
Calls isCommandAvailable on the delegate and returns the result.
isCurrentMediaItemDynamic
fun isCurrentMediaItemDynamic(): Boolean
Calls isCurrentMediaItemDynamic on the delegate and returns the result.
isCurrentMediaItemLive
fun isCurrentMediaItemLive(): Boolean
Calls isCurrentMediaItemLive on the delegate and returns the result.
isCurrentMediaItemSeekable
fun isCurrentMediaItemSeekable(): Boolean
Calls isCurrentMediaItemSeekable on the delegate and returns the result.
isCurrentWindowDynamic
funisCurrentWindowDynamic(): Boolean
Calls isCurrentWindowDynamic on the delegate and returns the result.
isCurrentWindowLive
funisCurrentWindowLive(): Boolean
Calls isCurrentWindowLive on the delegate and returns the result.
isCurrentWindowSeekable
funisCurrentWindowSeekable(): Boolean
Calls isCurrentWindowSeekable on the delegate and returns the result.
isDeviceMuted
fun isDeviceMuted(): Boolean
Calls isDeviceMuted on the delegate and returns the result.
moveMediaItem
fun moveMediaItem(currentIndex: Int, newIndex: Int): Unit
Calls moveMediaItem on the delegate.
moveMediaItems
fun moveMediaItems(fromIndex: Int, toIndex: Int, newIndex: Int): Unit
Calls moveMediaItems on the delegate.
removeListener
fun removeListener(listener: Player.Listener!): Unit
Calls removeListener on the delegate.
Overrides of this method must not directly call
delegate.removeListener. If the override wants to pass the Player.Listener instance to the delegate Player, it must do so by calling super.removeListener instead.
removeMediaItems
fun removeMediaItems(fromIndex: Int, toIndex: Int): Unit
Calls removeMediaItems on the delegate.
replaceMediaItem
fun replaceMediaItem(index: Int, mediaItem: MediaItem!): Unit
Calls replaceMediaItem on the delegate.
replaceMediaItems
fun replaceMediaItems(
fromIndex: Int,
toIndex: Int,
mediaItems: (Mutable)List<MediaItem!>!
): Unit
Calls replaceMediaItems on the delegate.
seekToDefaultPosition
fun seekToDefaultPosition(): Unit
Calls seekToDefaultPosition on the delegate.
seekToDefaultPosition
fun seekToDefaultPosition(mediaItemIndex: Int): Unit
Calls seekToDefaultPosition on the delegate.
seekToPreviousMediaItem
fun seekToPreviousMediaItem(): Unit
Calls seekToPreviousMediaItem on the delegate.
setAudioAttributes
fun setAudioAttributes(
audioAttributes: AudioAttributes!,
handleAudioFocus: Boolean
): Unit
Calls setAudioAttributes on the delegate.
setDeviceMuted
fun setDeviceMuted(muted: Boolean, @C.VolumeFlags flags: Int): Unit
Calls setDeviceMuted on the delegate.
setDeviceVolume
fun setDeviceVolume(volume: Int, @C.VolumeFlags flags: Int): Unit
Calls setDeviceVolume on the delegate.
setMediaItem
fun setMediaItem(mediaItem: MediaItem!, resetPosition: Boolean): Unit
Calls setMediaItem on the delegate.
setMediaItem
fun setMediaItem(mediaItem: MediaItem!, startPositionMs: Long): Unit
Calls setMediaItem on the delegate.
setMediaItems
fun setMediaItems(mediaItems: (Mutable)List<MediaItem!>!): Unit
Calls setMediaItems on the delegate.
setMediaItems
fun setMediaItems(
mediaItems: (Mutable)List<MediaItem!>!,
resetPosition: Boolean
): Unit
Calls setMediaItems ()} on the delegate.
setMediaItems
fun setMediaItems(
mediaItems: (Mutable)List<MediaItem!>!,
startIndex: Int,
startPositionMs: Long
): Unit
Calls setMediaItems on the delegate.
setPlayWhenReady
fun setPlayWhenReady(playWhenReady: Boolean): Unit
Calls setPlayWhenReady on the delegate.
setPlaybackParameters
fun setPlaybackParameters(playbackParameters: PlaybackParameters!): Unit
Calls setPlaybackParameters on the delegate.
setPlaylistMetadata
fun setPlaylistMetadata(mediaMetadata: MediaMetadata!): Unit
Calls setPlaylistMetadata on the delegate.
setRepeatMode
fun setRepeatMode(@Player.RepeatMode repeatMode: Int): Unit
Calls setRepeatMode on the delegate.
setShuffleModeEnabled
fun setShuffleModeEnabled(shuffleModeEnabled: Boolean): Unit
Calls setShuffleModeEnabled on the delegate.
setTrackSelectionParameters
fun setTrackSelectionParameters(parameters: TrackSelectionParameters!): Unit
Calls setTrackSelectionParameters on the delegate.
setVideoSurfaceHolder
fun setVideoSurfaceHolder(surfaceHolder: SurfaceHolder?): Unit
Calls setVideoSurfaceHolder on the delegate.
setVideoSurfaceView
fun setVideoSurfaceView(surfaceView: SurfaceView?): Unit
Calls setVideoSurfaceView on the delegate.
setVideoTextureView
fun setVideoTextureView(textureView: TextureView?): Unit
Calls setVideoTextureView on the delegate.