Package com.google.android.exoplayer2.ext.cast

## Class CastPlayer

- java.lang.Object
- - com.google.android.exoplayer2.BasePlayer
  - - com.google.android.exoplayer2.ext.cast.CastPlayer

- All Implemented Interfaces:
    `Player`

      public final class CastPlayer
      extends BasePlayer

  `Player` implementation that communicates with a Cast receiver app.

  The behavior of this class depends on the underlying Cast session, which is obtained from the injected `CastContext`. To keep track of the session, `isCastSessionAvailable()` can be queried and `SessionAvailabilityListener` can be implemented and attached to the player.

  If no session is available, the player state will remain unchanged and calls to methods that alter it will be ignored. Querying the player state is possible even when no session is available, in which case, the last observed receiver app state is reported.

  Methods should be called on the application's main thread.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Player

      `Player.Command, Player.Commands, Player.DiscontinuityReason, Player.EventFlags, Player.EventListener, Player.Events, Player.Listener, Player.MediaItemTransitionReason, Player.PlaybackSuppressionReason, Player.PlayWhenReadyChangeReason, Player.PositionInfo, Player.RepeatMode, Player.State, Player.TimelineChangeReason`

  - ### Field Summary

    - ### Fields inherited from class com.google.android.exoplayer2.BasePlayer

      `window`

    - ### Fields inherited from interface com.google.android.exoplayer2.Player

      `COMMAND_ADJUST_DEVICE_VOLUME, COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_GET_AUDIO_ATTRIBUTES, COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_DEVICE_VOLUME, COMMAND_GET_MEDIA_ITEMS, COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_TEXT, COMMAND_GET_VOLUME, COMMAND_PLAY_PAUSE, COMMAND_PREPARE_STOP, COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM, COMMAND_SEEK_TO_DEFAULT_POSITION, COMMAND_SEEK_TO_MEDIA_ITEM, COMMAND_SEEK_TO_NEXT_MEDIA_ITEM, COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM, COMMAND_SET_DEVICE_VOLUME, COMMAND_SET_REPEAT_MODE, COMMAND_SET_SHUFFLE_MODE, COMMAND_SET_SPEED_AND_PITCH, COMMAND_SET_VIDEO_SURFACE, COMMAND_SET_VOLUME, DISCONTINUITY_REASON_AUTO_TRANSITION, DISCONTINUITY_REASON_INTERNAL, DISCONTINUITY_REASON_REMOVE, DISCONTINUITY_REASON_SEEK, DISCONTINUITY_REASON_SEEK_ADJUSTMENT, DISCONTINUITY_REASON_SKIP, EVENT_AVAILABLE_COMMANDS_CHANGED, EVENT_IS_LOADING_CHANGED, EVENT_IS_PLAYING_CHANGED, EVENT_MEDIA_ITEM_TRANSITION, EVENT_MEDIA_METADATA_CHANGED, EVENT_PLAY_WHEN_READY_CHANGED, EVENT_PLAYBACK_PARAMETERS_CHANGED, EVENT_PLAYBACK_STATE_CHANGED, EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED, EVENT_PLAYER_ERROR, EVENT_POSITION_DISCONTINUITY, EVENT_REPEAT_MODE_CHANGED, EVENT_SHUFFLE_MODE_ENABLED_CHANGED, EVENT_STATIC_METADATA_CHANGED, EVENT_TIMELINE_CHANGED, EVENT_TRACKS_CHANGED, MEDIA_ITEM_TRANSITION_REASON_AUTO, MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED, MEDIA_ITEM_TRANSITION_REASON_REPEAT, MEDIA_ITEM_TRANSITION_REASON_SEEK, PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY, PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS, PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM, PLAY_WHEN_READY_CHANGE_REASON_REMOTE, PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST, PLAYBACK_SUPPRESSION_REASON_NONE, PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS, REPEAT_MODE_ALL, REPEAT_MODE_OFF, REPEAT_MODE_ONE, STATE_BUFFERING, STATE_ENDED, STATE_IDLE, STATE_READY, TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, TIMELINE_CHANGE_REASON_SOURCE_UPDATE`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CastPlayer​(com.google.android.gms.cast.framework.CastContext castContext)` | Creates a new cast player that uses a `DefaultMediaItemConverter`.
    `CastPlayer​(com.google.android.gms.cast.framework.CastContext castContext, MediaItemConverter mediaItemConverter)` | Creates a new cast player.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `addItems​(int periodId, com.google.android.gms.cast.MediaQueueItem... items)` | Deprecated. Use `addMediaItems(int, List)` instead.
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `addItems​(com.google.android.gms.cast.MediaQueueItem... items)` | Deprecated. Use `BasePlayer.addMediaItems(List)` instead.
    `void` | `addListener​(Player.EventListener listener)` | Registers a listener to receive events from the player.
    `void` | `addListener​(Player.Listener listener)` | Registers a listener to receive all events from the player.
    `void` | `addMediaItems​(int index, List<MediaItem> mediaItems)` | Adds a list of media items at the given index of the playlist.
    `void` | `clearVideoSurface()` | This method is not supported and does nothing.
    `void` | `clearVideoSurface​(Surface surface)` | This method is not supported and does nothing.
    `void` | `clearVideoSurfaceHolder​(SurfaceHolder surfaceHolder)` | This method is not supported and does nothing.
    `void` | `clearVideoSurfaceView​(SurfaceView surfaceView)` | This method is not supported and does nothing.
    `void` | `clearVideoTextureView​(TextureView textureView)` | This method is not supported and does nothing.
    `void` | `decreaseDeviceVolume()` | This method is not supported and does nothing.
    `Looper` | `getApplicationLooper()` | Returns the `Looper` associated with the application thread that's used to access the player and on which player events are received.
    `AudioAttributes` | `getAudioAttributes()` | This method is not supported and returns `AudioAttributes.DEFAULT`.
    `Player.Commands` | `getAvailableCommands()` | Returns the player's currently available `Player.Commands`.
    `long` | `getBufferedPosition()` | Returns an estimate of the position in the current content window or ad up to which data is buffered, in milliseconds.
    `long` | `getContentBufferedPosition()` | If `Player.isPlayingAd()` returns `true`, returns an estimate of the content position in the current content window up to which data is buffered, in milliseconds.
    `long` | `getContentPosition()` | If `Player.isPlayingAd()` returns `true`, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds.
    `int` | `getCurrentAdGroupIndex()` | If `Player.isPlayingAd()` returns true, returns the index of the ad group in the period currently being played.
    `int` | `getCurrentAdIndexInAdGroup()` | If `Player.isPlayingAd()` returns true, returns the index of the ad in its ad group.
    `ImmutableList<Cue>` | `getCurrentCues()` | This method is not supported and returns an empty list.
    `int` | `getCurrentPeriodIndex()` | Returns the index of the period currently being played.
    `long` | `getCurrentPosition()` | Returns the playback position in the current content window or ad, in milliseconds, or the prospective position in milliseconds if the `current timeline` is empty.
    `ImmutableList<Metadata>` | `getCurrentStaticMetadata()` | Returns the current static metadata for the track selections.
    `Timeline` | `getCurrentTimeline()` | Returns the current `Timeline`.
    `TrackGroupArray` | `getCurrentTrackGroups()` | Returns the available track groups.
    `TrackSelectionArray` | `getCurrentTrackSelections()` | Returns the current track selections.
    `int` | `getCurrentWindowIndex()` | Returns the index of the current `window` in the `timeline`, or the prospective window index if the `current timeline` is empty.
    `DeviceInfo` | `getDeviceInfo()` | This method is not supported and always returns `DeviceInfo.UNKNOWN`.
    `int` | `getDeviceVolume()` | This method is not supported and always returns `0`.
    `long` | `getDuration()` | Returns the duration of the current content window or ad in milliseconds, or `C.TIME_UNSET` if the duration is not known.
    `com.google.android.gms.cast.MediaQueueItem` | `getItem​(int periodId)` | Returns the item that corresponds to the period with the given id, or null if no media queue or period with id `periodId` exist.
    `MediaMetadata` | `getMediaMetadata()` | Returns the current combined `MediaMetadata`, or `MediaMetadata.EMPTY` if not supported.
    `PlaybackParameters` | `getPlaybackParameters()` | Returns the currently active playback parameters.
    `int` | `getPlaybackState()` | Returns the current `playback state` of the player.
    `int` | `getPlaybackSuppressionReason()` | Returns the reason why playback is suppressed even though `Player.getPlayWhenReady()` is `true`, or `Player.PLAYBACK_SUPPRESSION_REASON_NONE` if playback is not suppressed.
    `ExoPlaybackException` | `getPlayerError()` | Returns the error that caused playback to fail.
    `boolean` | `getPlayWhenReady()` | Whether playback will proceed when `Player.getPlaybackState()` == `Player.STATE_READY`.
    `int` | `getRepeatMode()` | Returns the current `Player.RepeatMode` used for playback.
    `boolean` | `getShuffleModeEnabled()` | Returns whether shuffling of windows is enabled.
    `long` | `getTotalBufferedDuration()` | Returns an estimate of the total buffered duration from the current position, in milliseconds.
    `VideoSize` | `getVideoSize()` | This method is not supported and returns `VideoSize.UNKNOWN`.
    `float` | `getVolume()` | This method is not supported and returns 1.
    `void` | `increaseDeviceVolume()` | This method is not supported and does nothing.
    `boolean` | `isCastSessionAvailable()` | Returns whether a cast session is available.
    `boolean` | `isDeviceMuted()` | This method is not supported and always returns `false`.
    `boolean` | `isLoading()` | Whether the player is currently loading the source.
    `boolean` | `isPlayingAd()` | Returns whether the player is currently playing an ad.
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `loadItem​(com.google.android.gms.cast.MediaQueueItem item, long positionMs)` | Deprecated. Use `setMediaItems(List, int, long)` instead.
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `loadItems​(com.google.android.gms.cast.MediaQueueItem[] items, int startIndex, long positionMs, int repeatMode)` | Deprecated. Use `setMediaItems(List, int, long)` and `setRepeatMode(int)` instead.
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `moveItem​(int periodId, int newIndex)` | Deprecated. Use `BasePlayer.moveMediaItem(int, int)` instead.
    `void` | `moveMediaItems​(int fromIndex, int toIndex, int newIndex)` | Moves the media item range to the new index.
    `void` | `prepare()` | Prepares the player.
    `void` | `release()` | Releases the player.
    `com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult>` | `removeItem​(int periodId)` | Deprecated. Use `BasePlayer.removeMediaItem(int)` instead.
    `void` | `removeListener​(Player.EventListener listener)` | Unregister a listener registered through `Player.addListener(EventListener)`.
    `void` | `removeListener​(Player.Listener listener)` | Unregister a listener registered through `Player.addListener(Listener)`.
    `void` | `removeMediaItems​(int fromIndex, int toIndex)` | Removes a range of media items from the playlist.
    `void` | `seekTo​(int windowIndex, long positionMs)` | Seeks to a position specified in milliseconds in the specified window.
    `void` | `setDeviceMuted​(boolean muted)` | This method is not supported and does nothing.
    `void` | `setDeviceVolume​(int volume)` | This method is not supported and does nothing.
    `void` | `setMediaItems​(List<MediaItem> mediaItems, boolean resetPosition)` | Clears the playlist and adds the specified `MediaItems`.
    `void` | `setMediaItems​(List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs)` | Clears the playlist and adds the specified `MediaItems`.
    `void` | `setPlaybackParameters​(PlaybackParameters playbackParameters)` | Attempts to set the playback parameters.
    `void` | `setPlayWhenReady​(boolean playWhenReady)` | Sets whether playback should proceed when `Player.getPlaybackState()` == `Player.STATE_READY`.
    `void` | `setRepeatMode​(int repeatMode)` | Sets the `Player.RepeatMode` to be used for playback.
    `void` | `setSessionAvailabilityListener​(SessionAvailabilityListener listener)` | Sets a listener for updates on the cast session availability.
    `void` | `setShuffleModeEnabled​(boolean shuffleModeEnabled)` | Sets whether shuffling of windows is enabled.
    `void` | `setVideoSurface​(Surface surface)` | This method is not supported and does nothing.
    `void` | `setVideoSurfaceHolder​(SurfaceHolder surfaceHolder)` | This method is not supported and does nothing.
    `void` | `setVideoSurfaceView​(SurfaceView surfaceView)` | This method is not supported and does nothing.
    `void` | `setVideoTextureView​(TextureView textureView)` | This method is not supported and does nothing.
    `void` | `setVolume​(float audioVolume)` | This method is not supported and does nothing.
    `void` | `stop​(boolean reset)` |

    - ### Methods inherited from class com.google.android.exoplayer2.BasePlayer

      `addMediaItem, addMediaItem, addMediaItems, clearMediaItems, getAvailableCommands, getBufferedPercentage, getContentDuration, getCurrentLiveOffset, getCurrentManifest, getCurrentMediaItem, getCurrentTag, getMediaItemAt, getMediaItemCount, getNextWindowIndex, getPlaybackError, getPreviousWindowIndex, hasNext, hasPrevious, isCommandAvailable, isCurrentWindowDynamic, isCurrentWindowLive, isCurrentWindowSeekable, isPlaying, moveMediaItem, next, pause, play, previous, removeMediaItem, seekTo, seekToDefaultPosition, seekToDefaultPosition, setMediaItem, setMediaItem, setMediaItem, setMediaItems, setPlaybackSpeed, stop`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### CastPlayer

          public CastPlayer​(com.google.android.gms.cast.framework.CastContext castContext)

      Creates a new cast player that uses a `DefaultMediaItemConverter`.
      Parameters:
        `castContext` - The context from which the cast session is obtained.

    - #### CastPlayer

          public CastPlayer​(com.google.android.gms.cast.framework.CastContext castContext,
                            MediaItemConverter mediaItemConverter)

      Creates a new cast player.
      Parameters:
        `castContext` - The context from which the cast session is obtained.
        `mediaItemConverter` - The `MediaItemConverter` to use.

  - ### Method Detail

    - #### loadItem

          @Deprecated
          @Nullable
          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> loadItem​(com.google.android.gms.cast.MediaQueueItem item,
                                                                                                                                                            long positionMs)

      Deprecated.
      Use `setMediaItems(List, int, long)` instead.

    - #### loadItems

          @Deprecated
          @Nullable
          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> loadItems​(com.google.android.gms.cast.MediaQueueItem[] items,
                                                                                                                                                             int startIndex,
                                                                                                                                                             long positionMs,
                                                                                                                                                             @RepeatMode
                                                                                                                                                             int repeatMode)

      Deprecated.
      Use `setMediaItems(List, int, long)` and `setRepeatMode(int)` instead.

    - #### addItems

          @Deprecated
          @Nullable
          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> addItems​(com.google.android.gms.cast.MediaQueueItem... items)

      Deprecated.
      Use `BasePlayer.addMediaItems(List)` instead.

    - #### addItems

          @Deprecated
          @Nullable
          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> addItems​(int periodId,
                                                                                                                                                            com.google.android.gms.cast.MediaQueueItem... items)

      Deprecated.
      Use `addMediaItems(int, List)` instead.

    - #### removeItem

          @Deprecated
          @Nullable
          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> removeItem​(int periodId)

      Deprecated.
      Use `BasePlayer.removeMediaItem(int)` instead.

    - #### moveItem

          @Deprecated
          @Nullable
          public com.google.android.gms.common.api.PendingResult<com.google.android.gms.cast.framework.media.RemoteMediaClient.MediaChannelResult> moveItem​(int periodId,
                                                                                                                                                            int newIndex)

      Deprecated.
      Use `BasePlayer.moveMediaItem(int, int)` instead.

    - #### getItem

          @Nullable
          public com.google.android.gms.cast.MediaQueueItem getItem​(int periodId)

      Returns the item that corresponds to the period with the given id, or null if no media queue or period with id `periodId` exist.
      Parameters:
        `periodId` - The id of the period (`getCurrentTimeline()`) that corresponds to the item to get.
      Returns:
        The item that corresponds to the period with the given id, or null if no media queue or period with id `periodId` exist.

    - #### isCastSessionAvailable

          public boolean isCastSessionAvailable()

      Returns whether a cast session is available.

    - #### setSessionAvailabilityListener

          public void setSessionAvailabilityListener​(@Nullable
                                                     SessionAvailabilityListener listener)

      Sets a listener for updates on the cast session availability.
      Parameters:
        `listener` - The `SessionAvailabilityListener`, or null to clear the listener.

    - #### getApplicationLooper

          public Looper getApplicationLooper()

      Description copied from interface: `Player`
      Returns the `Looper` associated with the application thread that's used to access the player and on which player events are received.

    - #### addListener

          public void addListener​(Player.Listener listener)

      Description copied from interface: `Player`
      Registers a listener to receive all events from the player.
      Parameters:
        `listener` - The listener to register.

    - #### addListener

          public void addListener​(Player.EventListener listener)

      Description copied from interface: `Player`
      Registers a listener to receive events from the player. The listener's methods will be called on the thread that was used to construct the player. However, if the thread used to construct the player does not have a `Looper`, then the listener will be called on the main thread.
      Parameters:
        `listener` - The listener to register.

    - #### removeListener

          public void removeListener​(Player.Listener listener)

      Description copied from interface: `Player`
      Unregister a listener registered through `Player.addListener(Listener)`. The listener will no longer receive events.
      Parameters:
        `listener` - The listener to unregister.

    - #### removeListener

          public void removeListener​(Player.EventListener listener)

      Description copied from interface: `Player`
      Unregister a listener registered through `Player.addListener(EventListener)`. The listener will no longer receive events from the player.
      Parameters:
        `listener` - The listener to unregister.

    - #### setMediaItems

          public void setMediaItems​(List<MediaItem> mediaItems,
                                    boolean resetPosition)

      Description copied from interface: `Player`
      Clears the playlist and adds the specified `MediaItems`.
      Parameters:
        `mediaItems` - The new `MediaItems`.
        `resetPosition` - Whether the playback position should be reset to the default position in the first `Timeline.Window`. If false, playback will start from the position defined by `Player.getCurrentWindowIndex()` and `Player.getCurrentPosition()`.

    - #### setMediaItems

          public void setMediaItems​(List<MediaItem> mediaItems,
                                    int startWindowIndex,
                                    long startPositionMs)

      Description copied from interface: `Player`
      Clears the playlist and adds the specified `MediaItems`.
      Parameters:
        `mediaItems` - The new `MediaItems`.
        `startWindowIndex` - The window index to start playback from. If `C.INDEX_UNSET` is passed, the current position is not reset.
        `startPositionMs` - The position in milliseconds to start playback from. If `C.TIME_UNSET` is passed, the default position of the given window is used. In any case, if `startWindowIndex` is set to `C.INDEX_UNSET`, this parameter is ignored and the position is not reset at all.

    - #### addMediaItems

          public void addMediaItems​(int index,
                                    List<MediaItem> mediaItems)

      Description copied from interface: `Player`
      Adds a list of media items at the given index of the playlist.
      Parameters:
        `index` - The index at which to add the media items. If the index is larger than the size of the playlist, the media items are added to the end of the playlist.
        `mediaItems` - The `MediaItems` to add.

    - #### moveMediaItems

          public void moveMediaItems​(int fromIndex,
                                     int toIndex,
                                     int newIndex)

      Description copied from interface: `Player`
      Moves the media item range to the new index.
      Parameters:
        `fromIndex` - The start of the range to move.
        `toIndex` - The first item not to be included in the range (exclusive).
        `newIndex` - The new index of the first media item of the range. If the new index is larger than the size of the remaining playlist after removing the range, the range is moved to the end of the playlist.

    - #### removeMediaItems

          public void removeMediaItems​(int fromIndex,
                                       int toIndex)

      Description copied from interface: `Player`
      Removes a range of media items from the playlist.
      Parameters:
        `fromIndex` - The index at which to start removing media items.
        `toIndex` - The index of the first item to be kept (exclusive). If the index is larger than the size of the playlist, media items to the end of the playlist are removed.

    - #### getAvailableCommands

          public Player.Commands getAvailableCommands()

      Description copied from interface: `Player`
      Returns the player's currently available `Player.Commands`.

      The returned `Player.Commands` are not updated when available commands change. Use `Player.EventListener.onAvailableCommandsChanged(Commands)` to get an update when the available commands change.

      Executing a command that is not available (for example, calling `Player.next()` if `Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM` is unavailable) will neither throw an exception nor generate a `Player.getPlayerError()` player error}.

      `Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM` and `Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM` are unavailable if there is no such `MediaItem`.

      Returns:
        The currently available `Player.Commands`.
      See Also:
        `Player.EventListener.onAvailableCommandsChanged(com.google.android.exoplayer2.Player.Commands)`

    - #### prepare

          public void prepare()

      Description copied from interface: `Player`
      Prepares the player.

    - #### getPlaybackState

          @State
          public int getPlaybackState()

      Description copied from interface: `Player`
      Returns the current `playback state` of the player.
      Returns:
        The current `playback state`.
      See Also:
        `Player.EventListener.onPlaybackStateChanged(int)`

    - #### getPlaybackSuppressionReason

          @PlaybackSuppressionReason
          public int getPlaybackSuppressionReason()

      Description copied from interface: `Player`
      Returns the reason why playback is suppressed even though `Player.getPlayWhenReady()` is `true`, or `Player.PLAYBACK_SUPPRESSION_REASON_NONE` if playback is not suppressed.
      Returns:
        The current `playback suppression reason`.
      See Also:
        `Player.EventListener.onPlaybackSuppressionReasonChanged(int)`

    - #### getPlayerError

          @Nullable
          public ExoPlaybackException getPlayerError()

      Description copied from interface: `Player`
      Returns the error that caused playback to fail. This is the same error that will have been reported via `Player.EventListener.onPlayerError(ExoPlaybackException)` at the time of failure. It can be queried using this method until the player is re-prepared.

      Note that this method will always return `null` if `Player.getPlaybackState()` is not `Player.STATE_IDLE`.

      Returns:
        The error, or `null`.
      See Also:
        `Player.EventListener.onPlayerError(ExoPlaybackException)`

    - #### setPlayWhenReady

          public void setPlayWhenReady​(boolean playWhenReady)

      Description copied from interface: `Player`
      Sets whether playback should proceed when `Player.getPlaybackState()` == `Player.STATE_READY`.

      If the player is already in the ready state then this method pauses and resumes playback.

      Parameters:
        `playWhenReady` - Whether playback should proceed when ready.

    - #### getPlayWhenReady

          public boolean getPlayWhenReady()

      Description copied from interface: `Player`
      Whether playback will proceed when `Player.getPlaybackState()` == `Player.STATE_READY`.
      Returns:
        Whether playback will proceed when ready.
      See Also:
        `Player.EventListener.onPlayWhenReadyChanged(boolean, int)`

    - #### seekTo

          public void seekTo​(int windowIndex,
                             long positionMs)

      Description copied from interface: `Player`
      Seeks to a position specified in milliseconds in the specified window.
      Parameters:
        `windowIndex` - The index of the window.
        `positionMs` - The seek position in the specified window, or `C.TIME_UNSET` to seek to the window's default position.

    - #### setPlaybackParameters

          public void setPlaybackParameters​(PlaybackParameters playbackParameters)

      Description copied from interface: `Player`
      Attempts to set the playback parameters. Passing `PlaybackParameters.DEFAULT` resets the player to the default, which means there is no speed or pitch adjustment.

      Playback parameters changes may cause the player to buffer. `Player.EventListener.onPlaybackParametersChanged(PlaybackParameters)` will be called whenever the currently active playback parameters change.

      Parameters:
        `playbackParameters` - The playback parameters.

    - #### getPlaybackParameters

          public PlaybackParameters getPlaybackParameters()

      Description copied from interface: `Player`
      Returns the currently active playback parameters.
      See Also:
        `Player.EventListener.onPlaybackParametersChanged(PlaybackParameters)`

    - #### stop

          public void stop​(boolean reset)

    - #### release

          public void release()

      Description copied from interface: `Player`
      Releases the player. This method must be called when the player is no longer required. The player must not be used after calling this method.

    - #### setRepeatMode

          public void setRepeatMode​(@RepeatMode
                                    int repeatMode)

      Description copied from interface: `Player`
      Sets the `Player.RepeatMode` to be used for playback.
      Parameters:
        `repeatMode` - The repeat mode.

    - #### getRepeatMode

          @RepeatMode
          public int getRepeatMode()

      Description copied from interface: `Player`
      Returns the current `Player.RepeatMode` used for playback.
      Returns:
        The current repeat mode.
      See Also:
        `Player.EventListener.onRepeatModeChanged(int)`

    - #### setShuffleModeEnabled

          public void setShuffleModeEnabled​(boolean shuffleModeEnabled)

      Description copied from interface: `Player`
      Sets whether shuffling of windows is enabled.
      Parameters:
        `shuffleModeEnabled` - Whether shuffling is enabled.

    - #### getShuffleModeEnabled

          public boolean getShuffleModeEnabled()

      Description copied from interface: `Player`
      Returns whether shuffling of windows is enabled.
      See Also:
        `Player.EventListener.onShuffleModeEnabledChanged(boolean)`

    - #### getCurrentTrackSelections

          public TrackSelectionArray getCurrentTrackSelections()

      Description copied from interface: `Player`
      Returns the current track selections.

      A concrete implementation may include null elements if it has a fixed number of renderer components, wishes to report a TrackSelection for each of them, and has one or more renderer components that is not assigned any selected tracks.

      See Also:
        `Player.EventListener.onTracksChanged(TrackGroupArray, TrackSelectionArray)`

    - #### getCurrentTrackGroups

          public TrackGroupArray getCurrentTrackGroups()

      Description copied from interface: `Player`
      Returns the available track groups.
      See Also:
        `Player.EventListener.onTracksChanged(TrackGroupArray, TrackSelectionArray)`

    - #### getCurrentStaticMetadata

          public ImmutableList<Metadata> getCurrentStaticMetadata()

      Description copied from interface: `Player`
      Returns the current static metadata for the track selections.

      The returned `metadataList` is an immutable list of `Metadata` instances, where the elements correspond to the `current track selections`, or an empty list if there are no track selections or the selected tracks contain no static metadata.

      This metadata is considered static in that it comes from the tracks' declared Formats, rather than being timed (or dynamic) metadata, which is represented within a metadata track.

      See Also:
        `Player.EventListener.onStaticMetadataChanged(List)`

    - #### getMediaMetadata

          public MediaMetadata getMediaMetadata()

      Description copied from interface: `Player`
      Returns the current combined `MediaMetadata`, or `MediaMetadata.EMPTY` if not supported.

      This `MediaMetadata` is a combination of the `MediaItem.mediaMetadata` and the static and dynamic metadata sourced from `Player.EventListener.onStaticMetadataChanged(List)` and `MetadataOutput.onMetadata(Metadata)`.

    - #### getCurrentTimeline

          public Timeline getCurrentTimeline()

      Description copied from interface: `Player`
      Returns the current `Timeline`. Never null, but may be empty.
      See Also:
        `Player.EventListener.onTimelineChanged(Timeline, int)`

    - #### getCurrentPeriodIndex

          public int getCurrentPeriodIndex()

      Description copied from interface: `Player`
      Returns the index of the period currently being played.

    - #### getCurrentWindowIndex

          public int getCurrentWindowIndex()

      Description copied from interface: `Player`
      Returns the index of the current `window` in the `timeline`, or the prospective window index if the `current timeline` is empty.

    - #### getDuration

          public long getDuration()

      Description copied from interface: `Player`
      Returns the duration of the current content window or ad in milliseconds, or `C.TIME_UNSET` if the duration is not known.

    - #### getCurrentPosition

          public long getCurrentPosition()

      Description copied from interface: `Player`
      Returns the playback position in the current content window or ad, in milliseconds, or the prospective position in milliseconds if the `current timeline` is empty.

    - #### getBufferedPosition

          public long getBufferedPosition()

      Description copied from interface: `Player`
      Returns an estimate of the position in the current content window or ad up to which data is buffered, in milliseconds.

    - #### getTotalBufferedDuration

          public long getTotalBufferedDuration()

      Description copied from interface: `Player`
      Returns an estimate of the total buffered duration from the current position, in milliseconds. This includes pre-buffered data for subsequent ads and windows.

    - #### isPlayingAd

          public boolean isPlayingAd()

      Description copied from interface: `Player`
      Returns whether the player is currently playing an ad.

    - #### getCurrentAdGroupIndex

          public int getCurrentAdGroupIndex()

      Description copied from interface: `Player`
      If `Player.isPlayingAd()` returns true, returns the index of the ad group in the period currently being played. Returns `C.INDEX_UNSET` otherwise.

    - #### getCurrentAdIndexInAdGroup

          public int getCurrentAdIndexInAdGroup()

      Description copied from interface: `Player`
      If `Player.isPlayingAd()` returns true, returns the index of the ad in its ad group. Returns `C.INDEX_UNSET` otherwise.

    - #### isLoading

          public boolean isLoading()

      Description copied from interface: `Player`
      Whether the player is currently loading the source.
      Returns:
        Whether the player is currently loading the source.
      See Also:
        `Player.EventListener.onIsLoadingChanged(boolean)`

    - #### getContentPosition

          public long getContentPosition()

      Description copied from interface: `Player`
      If `Player.isPlayingAd()` returns `true`, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds. If there is no ad playing, the returned position is the same as that returned by `Player.getCurrentPosition()`.

    - #### getContentBufferedPosition

          public long getContentBufferedPosition()

      Description copied from interface: `Player`
      If `Player.isPlayingAd()` returns `true`, returns an estimate of the content position in the current content window up to which data is buffered, in milliseconds. If there is no ad playing, the returned position is the same as that returned by `Player.getBufferedPosition()`.

    - #### getAudioAttributes

          public AudioAttributes getAudioAttributes()

      This method is not supported and returns `AudioAttributes.DEFAULT`.

    - #### setVolume

          public void setVolume​(float audioVolume)

      This method is not supported and does nothing.
      Parameters:
        `audioVolume` - Linear output gain to apply to all audio channels.

    - #### getVolume

          public float getVolume()

      This method is not supported and returns 1.
      Returns:
        The linear gain applied to all audio channels.

    - #### clearVideoSurface

          public void clearVideoSurface()

      This method is not supported and does nothing.

    - #### clearVideoSurface

          public void clearVideoSurface​(@Nullable
                                        Surface surface)

      This method is not supported and does nothing.
      Parameters:
        `surface` - The surface to clear.

    - #### setVideoSurface

          public void setVideoSurface​(@Nullable
                                      Surface surface)

      This method is not supported and does nothing.
      Parameters:
        `surface` - The `Surface`.

    - #### setVideoSurfaceHolder

          public void setVideoSurfaceHolder​(@Nullable
                                            SurfaceHolder surfaceHolder)

      This method is not supported and does nothing.
      Parameters:
        `surfaceHolder` - The surface holder.

    - #### clearVideoSurfaceHolder

          public void clearVideoSurfaceHolder​(@Nullable
                                              SurfaceHolder surfaceHolder)

      This method is not supported and does nothing.
      Parameters:
        `surfaceHolder` - The surface holder to clear.

    - #### setVideoSurfaceView

          public void setVideoSurfaceView​(@Nullable
                                          SurfaceView surfaceView)

      This method is not supported and does nothing.
      Parameters:
        `surfaceView` - The surface view.

    - #### clearVideoSurfaceView

          public void clearVideoSurfaceView​(@Nullable
                                            SurfaceView surfaceView)

      This method is not supported and does nothing.
      Parameters:
        `surfaceView` - The texture view to clear.

    - #### setVideoTextureView

          public void setVideoTextureView​(@Nullable
                                          TextureView textureView)

      This method is not supported and does nothing.
      Parameters:
        `textureView` - The texture view.

    - #### clearVideoTextureView

          public void clearVideoTextureView​(@Nullable
                                            TextureView textureView)

      This method is not supported and does nothing.
      Parameters:
        `textureView` - The texture view to clear.

    - #### getVideoSize

          public VideoSize getVideoSize()

      This method is not supported and returns `VideoSize.UNKNOWN`.
      See Also:
        `VideoListener.onVideoSizeChanged(VideoSize)`

    - #### getCurrentCues

          public ImmutableList<Cue> getCurrentCues()

      This method is not supported and returns an empty list.

    - #### getDeviceInfo

          public DeviceInfo getDeviceInfo()

      This method is not supported and always returns `DeviceInfo.UNKNOWN`.

    - #### getDeviceVolume

          public int getDeviceVolume()

      This method is not supported and always returns `0`.

    - #### isDeviceMuted

          public boolean isDeviceMuted()

      This method is not supported and always returns `false`.

    - #### setDeviceVolume

          public void setDeviceVolume​(int volume)

      This method is not supported and does nothing.
      Parameters:
        `volume` - The volume to set.

    - #### increaseDeviceVolume

          public void increaseDeviceVolume()

      This method is not supported and does nothing.

    - #### decreaseDeviceVolume

          public void decreaseDeviceVolume()

      This method is not supported and does nothing.

    - #### setDeviceMuted

          public void setDeviceMuted​(boolean muted)

      This method is not supported and does nothing.