public final class

Player.PositionInfo

extends java.lang.Object

 java.lang.Object

↳androidx.media3.common.Player.PositionInfo

Overview

Position info describing a playback position involved in a discontinuity.

Summary

Fields
public final intadGroupIndex

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

public final intadIndexInAdGroup

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

public final longcontentPositionMs

The content position, in milliseconds.

public final MediaItemmediaItem

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

public final intmediaItemIndex

The media item index.

public final intperiodIndex

The period index.

public final java.lang.ObjectperiodUid

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

public final longpositionMs

The playback position, in milliseconds.

public final intwindowIndex

public final java.lang.ObjectwindowUid

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

Constructors
publicPositionInfo(java.lang.Object windowUid, int mediaItemIndex, MediaItem mediaItem, java.lang.Object periodUid, int periodIndex, long positionMs, long contentPositionMs, int adGroupIndex, int adIndexInAdGroup)

Creates an instance.

publicPositionInfo(java.lang.Object windowUid, int mediaItemIndex, java.lang.Object periodUid, int periodIndex, long positionMs, long contentPositionMs, int adGroupIndex, int adIndexInAdGroup)

Methods
public booleanequals(java.lang.Object o)

public booleanequalsForBundling(Player.PositionInfo other)

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

public Player.PositionInfofilterByAvailableCommands(boolean canAccessCurrentMediaItem, boolean canAccessTimeline)

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

public static Player.PositionInfofromBundle(Bundle bundle)

Restores a PositionInfo from a .

public inthashCode()

public BundletoBundle()

public BundletoBundle(int controllerInterfaceVersion)

Returns a representing the information stored in this object.

from java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Fields

public final java.lang.Object windowUid

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

public final int windowIndex

Deprecated: Use Player.PositionInfo.mediaItemIndex instead.

public final int mediaItemIndex

The media item index.

public final MediaItem mediaItem

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

public final java.lang.Object periodUid

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

public final int periodIndex

The period index.

public final long positionMs

The playback position, in milliseconds.

public final long contentPositionMs

The content position, in milliseconds.

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

public final int adGroupIndex

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

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.

Constructors

public PositionInfo(java.lang.Object windowUid, int mediaItemIndex, java.lang.Object periodUid, int periodIndex, long positionMs, long contentPositionMs, int adGroupIndex, int adIndexInAdGroup)

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

public PositionInfo(java.lang.Object windowUid, int mediaItemIndex, MediaItem mediaItem, java.lang.Object periodUid, int periodIndex, long positionMs, long contentPositionMs, int adGroupIndex, int adIndexInAdGroup)

Creates an instance.

Methods

public boolean equals(java.lang.Object o)

public int hashCode()

public boolean equalsForBundling(Player.PositionInfo other)

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

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:

canAccessCurrentMediaItem: Whether Player.COMMAND_GET_CURRENT_MEDIA_ITEM is available.
canAccessTimeline: Whether Player.COMMAND_GET_TIMELINE is available.

Returns:

The filtered position info.

public Bundle toBundle(int controllerInterfaceVersion)

Returns a representing the information stored in this object.

It omits the Player.PositionInfo.windowUid and Player.PositionInfo.periodUid fields. The Player.PositionInfo.windowUid and Player.PositionInfo.periodUid of an instance restored by Player.PositionInfo.fromBundle(Bundle) will always be null.

Parameters:

controllerInterfaceVersion: The interface version of the media controller this Bundle will be sent to.

public Bundle toBundle()

Deprecated: Use Player.PositionInfo.toBundle(int) instead.

public static Player.PositionInfo fromBundle(Bundle bundle)

Restores a PositionInfo from a .