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, INDEX_UNSET otherwise.

final int

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

final long

The content position, in milliseconds.

final @Nullable MediaItem

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

final int

The media item index.

final int

The period index.

final @Nullable Object

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

final long

The playback position, in milliseconds.

final int

This field is deprecated.

Use mediaItemIndex instead.

final @Nullable Object

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

Public constructors

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

This method is deprecated.

Use PositionInfo instead.

@UnstableApi
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

boolean
boolean

Returns whether this position info and the other position info would result in the same Bundle.

Player.PositionInfo
@UnstableApi
filterByAvailableCommands(
    boolean canAccessCurrentMediaItem,
    boolean canAccessTimeline
)

Returns a copy of this position info, filtered by the specified available commands.

static Player.PositionInfo

Restores a PositionInfo from a Bundle.

int
Bundle

This method is deprecated.

Use toBundle instead.

Bundle
@UnstableApi
toBundle(int controllerInterfaceVersion)

Returns a Bundle representing the information stored in this object.

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.

mediaItemIndex

public final int mediaItemIndex

The media item index.

periodIndex

public final int periodIndex

The period index.

periodUid

public final @Nullable Object periodUid

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

positionMs

public final long positionMs

The playback position, in milliseconds.

windowIndex

@UnstableApi
public final int windowIndex

windowUid

public final @Nullable Object windowUid

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

Public constructors

PositionInfo

@UnstableApi
public PositionInfo(
    @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

equals

public boolean equals(@Nullable Object o)

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 COMMAND_GET_CURRENT_MEDIA_ITEM is available.

boolean canAccessTimeline

Whether COMMAND_GET_TIMELINE is available.

Returns
Player.PositionInfo

The filtered position info.

fromBundle

@UnstableApi
public static Player.PositionInfo fromBundle(Bundle bundle)

Restores a PositionInfo from a Bundle.

hashCode

public int hashCode()

toBundle

@UnstableApi
public Bundle toBundle()

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.