Package com.google.android.exoplayer2

## Class Player.PositionInfo

- java.lang.Object
- - com.google.android.exoplayer2.Player.PositionInfo

- All Implemented Interfaces:
    `Bundleable`
  Enclosing interface:
    Player

      public static final class Player.PositionInfo
      extends Object
      implements Bundleable

  Position info describing a playback position involved in a discontinuity.

- - ### Nested Class Summary

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

      `Bundleable.Creator<T extends Bundleable>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `int` | `adGroupIndex` | The ad group index if the playback position is within an ad, `C.INDEX_UNSET` otherwise.
    `int` | `adIndexInAdGroup` | The index of the ad within the ad group if the playback position is within an ad, `C.INDEX_UNSET` otherwise.
    `long` | `contentPositionMs` | The content position, in milliseconds.
    `static Bundleable.Creator<Player.PositionInfo>` | `CREATOR` | Object that can restore `Player.PositionInfo` from a `Bundle`.
    `MediaItem` | `mediaItem` | The media item, or `null` if the timeline is `empty`.
    `int` | `mediaItemIndex` | The media item index.
    `int` | `periodIndex` | The period index.
    `Object` | `periodUid` | The UID of the period, or `null` if the timeline is `empty`.
    `long` | `positionMs` | The playback position, in milliseconds.
    `int` | `windowIndex` | Deprecated. Use `mediaItemIndex` instead.
    `Object` | `windowUid` | The UID of the window, or `null` if the timeline is `empty`.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PositionInfo​(Object windowUid, int mediaItemIndex, MediaItem mediaItem, Object periodUid, int periodIndex, long positionMs, long contentPositionMs, int adGroupIndex, int adIndexInAdGroup)` | Creates an instance.
    `PositionInfo​(Object windowUid, int mediaItemIndex, Object periodUid, int periodIndex, long positionMs, long contentPositionMs, int adGroupIndex, int adIndexInAdGroup)` | Deprecated. Use `PositionInfo(Object, int, MediaItem, Object, int, long, long, int, int)` instead.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object o)` |
    `int` | `hashCode()` |
    `Bundle` | `toBundle()` | Returns a `Bundle` representing the information stored in this object.
    `Bundle` | `toBundle​(boolean canAccessCurrentMediaItem, boolean canAccessTimeline)` | Returns a `Bundle` representing the information stored in this object, filtered by available commands.

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

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

- - ### Field Detail

    - #### windowUid

          @Nullable
          public final Object windowUid

      The UID of the window, or `null` if the timeline is `empty`.

    - #### windowIndex

          @Deprecated
          public final int windowIndex

      Deprecated.
      Use `mediaItemIndex` instead.

    - #### mediaItemIndex

          public final int mediaItemIndex

      The media item index.

    - #### mediaItem

          @Nullable
          public final MediaItem mediaItem

      The media item, or `null` if the timeline is `empty`.

    - #### periodUid

          @Nullable
          public final Object periodUid

      The UID of the period, or `null` if the timeline is `empty`.

    - #### periodIndex

          public final int periodIndex

      The period index.

    - #### positionMs

          public final long positionMs

      The playback position, in milliseconds.

    - #### contentPositionMs

          public final long contentPositionMs

      The content position, in milliseconds.

      If `adGroupIndex` is `C.INDEX_UNSET`, this is the same as `positionMs`.

    - #### adGroupIndex

          public final int adGroupIndex

      The ad group index if the playback position is within an ad, `C.INDEX_UNSET` otherwise.

    - #### adIndexInAdGroup

          public final int adIndexInAdGroup

      The index of the ad within the ad group if the playback position is within an ad, `C.INDEX_UNSET` otherwise.

    - #### CREATOR

          public static final Bundleable.Creator<Player.PositionInfo> CREATOR

      Object that can restore `Player.PositionInfo` from a `Bundle`.

  - ### Constructor Detail

    - #### PositionInfo

          @Deprecated
          public PositionInfo​(@Nullable
                              Object windowUid,
                              int mediaItemIndex,
                              @Nullable
                              Object periodUid,
                              int periodIndex,
                              long positionMs,
                              long contentPositionMs,
                              int adGroupIndex,
                              int adIndexInAdGroup)

      Deprecated.
      Use `PositionInfo(Object, int, MediaItem, Object, int, long, long, int, int)` instead.

    - #### PositionInfo

          public PositionInfo​(@Nullable
                              Object windowUid,
                              int mediaItemIndex,
                              @Nullable
                              MediaItem mediaItem,
                              @Nullable
                              Object periodUid,
                              int periodIndex,
                              long positionMs,
                              long contentPositionMs,
                              int adGroupIndex,
                              int adIndexInAdGroup)

      Creates an instance.

  - ### Method Detail

    - #### equals

          public boolean equals​(@Nullable
                                Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toBundle

          public Bundle toBundle()

      Returns a `Bundle` representing the information stored in this object.

      It omits the `windowUid` and `periodUid` fields. The `windowUid` and `periodUid` of an instance restored by `CREATOR` will always be `null`.

      Specified by:
        `toBundle` in interface `Bundleable`

    - #### toBundle

          public Bundle toBundle​(boolean canAccessCurrentMediaItem,
                                 boolean canAccessTimeline)

      Returns a `Bundle` representing the information stored in this object, filtered by available commands.
      Parameters:
        `canAccessCurrentMediaItem` - Whether the `Bundle` should contain information accessbile with `Player.COMMAND_GET_CURRENT_MEDIA_ITEM`.
        `canAccessTimeline` - Whether the `Bundle` should contain information accessbile with `Player.COMMAND_GET_TIMELINE`.