Back to Exoplayer

Player.PositionInfo (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/Player.PositionInfo.html

latest9.9 KB
Original Source

Package com.google.android.exoplayer2

Class Player.PositionInfo

  • java.lang.Object

    • com.google.android.exoplayer2.Player.PositionInfo
  • All Implemented Interfaces:BundleableEnclosing interface:Player


public static final classPlayer.PositionInfoextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Bundleable](Bundleable.html "interface in com.google.android.exoplayer2")

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](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")windowUid

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

- 

windowIndex

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final int windowIndex

Deprecated. Use mediaItemIndex instead.

- 

mediaItemIndex

public final int mediaItemIndex

The media item index.

- 

mediaItem

@Nullable
public final[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem

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

- 

periodUid

@Nullable
public final[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")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](Bundleable.Creator.html "interface in com.google.android.exoplayer2")<[Player.PositionInfo](Player.PositionInfo.html "class in com.google.android.exoplayer2")> CREATOR

Object that can restore Player.PositionInfo from a Bundle.

Constructor Detail

- 

PositionInfo

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public PositionInfo​(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")windowUid,
                    int mediaItemIndex,
                    @Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")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](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")windowUid,
                    int mediaItemIndex,
                    @Nullable[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem,
                    @Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")periodUid,
                    int periodIndex,
                    long positionMs,
                    long contentPositionMs,
                    int adGroupIndex,
                    int adIndexInAdGroup)

Creates an instance.

Method Detail

- 

equals

public boolean equals​(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")o)

Overrides:equals in class Object

- 

hashCode

public int hashCode()

Overrides:hashCode in class Object

- 

toBundle

public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")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](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")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.