Player.PositionInfo
public final class Player.PositionInfo
Position info describing a playback position involved in a discontinuity.
Summary
Public fields |
|
|---|---|
final int |
The ad group index if the playback position is within an ad, |
final int |
The index of the ad within the ad group if the playback position is within an ad, |
final long |
The content position, in milliseconds. |
final @Nullable MediaItem |
The media item, or |
final int |
The media item index. |
final int |
The period index. |
final @Nullable Object |
The UID of the period, or |
final long |
The playback position, in milliseconds. |
final int |
This field is deprecated. Use |
final @Nullable Object |
The UID of the window, or |
Public constructors |
|---|
@UnstableApiThis method is deprecated. Use |
@UnstableApiCreates an instance. |
Public methods |
|
|---|---|
boolean |
|
boolean |
Returns whether this position info and the other position info would result in the same |
Player.PositionInfo |
@UnstableApiReturns a copy of this position info, filtered by the specified available commands. |
static Player.PositionInfo |
@UnstableApiRestores a |
int |
hashCode() |
Bundle |
This method is deprecated. Use |
Bundle |
@UnstableApiReturns a |
String |
toString() |
Public fields
adGroupIndex
public final int adGroupIndex
The ad group index if the playback position is within an ad, 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, INDEX_UNSET otherwise.
contentPositionMs
public final long contentPositionMs
The content position, in milliseconds.
If adGroupIndex is INDEX_UNSET, this is the same as positionMs.
mediaItem
@UnstableApi
public final @Nullable MediaItem mediaItem
The media item, or null if the timeline is empty.
Public constructors
PositionInfo
@UnstableApi
publicPositionInfo(
@Nullable Object windowUid,
int mediaItemIndex,
@Nullable Object periodUid,
int periodIndex,
long positionMs,
long contentPositionMs,
int adGroupIndex,
int adIndexInAdGroup
)
PositionInfo
@UnstableApi
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.
Public methods
equalsForBundling
@UnstableApi
public boolean equalsForBundling(Player.PositionInfo other)
Returns whether this position info and the other position info would result in the same Bundle.
filterByAvailableCommands
@UnstableApi
public Player.PositionInfo filterByAvailableCommands(
boolean canAccessCurrentMediaItem,
boolean canAccessTimeline
)
Returns a copy of this position info, filtered by the specified available commands.
The filtered fields are reset to their default values.
The return value may be the same object if nothing is filtered.
| Parameters | |
|---|---|
boolean canAccessCurrentMediaItem |
Whether |
boolean canAccessTimeline |
Whether |
| Returns | |
|---|---|
Player.PositionInfo |
The filtered position info. |
fromBundle
@UnstableApi
public static Player.PositionInfo fromBundle(Bundle bundle)
Restores a PositionInfo from a Bundle.
toBundle
@UnstableApi
public Bundle toBundle(int controllerInterfaceVersion)
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 fromBundle will always be null.
| Parameters | |
|---|---|
int controllerInterfaceVersion |
The interface version of the media controller this Bundle will be sent to. |