Stay organized with collections Save and categorize content based on your preferences.

MediaPeriodId

@UnstableApi
public class MediaPeriodId

Known direct subclasses

Identifies a specific playback of a Timeline.Period.

A Timeline.Period can be played multiple times, for example if it is repeated. Each instances of this class identifies a specific playback of a Timeline.Period.

In ExoPlayer's implementation, MediaPeriodId identifies a MediaPeriod.

Summary

Public fields

final int

If the media period is in an ad group, the index of the ad group in the period.

final int

If the media period is in an ad group, the index of the ad in its ad group in the period.

final int

The index of the next ad group to which the media period's content is clipped, or INDEX_UNSET if there is no following ad group or if this media period is an ad.

final Object

The unique id of the timeline period.

final long

The sequence number of the window in the buffered sequence of windows this media period is part of.

Public constructors

MediaPeriodId(Object periodUid)

Creates a media period identifier for a period which is not part of a buffered sequence of windows.

MediaPeriodId(Object periodUid, long windowSequenceNumber)

Creates a media period identifier for the specified period in the timeline.

MediaPeriodId(
    Object periodUid,
    long windowSequenceNumber,
    int nextAdGroupIndex
)

Creates a media period identifier for the specified clipped period in the timeline.

MediaPeriodId(
    Object periodUid,
    int adGroupIndex,
    int adIndexInAdGroup,
    long windowSequenceNumber
)

Creates a media period identifier that identifies an ad within an ad group at the specified timeline period.

Protected constructors

Copy constructor for inheritance.

Public methods

MediaPeriodId
copyWithPeriodUid(Object newPeriodUid)

Returns a copy of this period identifier but with newPeriodUid as its period uid.

MediaPeriodId
copyWithWindowSequenceNumber(long windowSequenceNumber)

Returns a copy of this period identifier with a new windowSequenceNumber.

boolean
int
boolean

Returns whether this period identifier identifies an ad in an ad group in a period.

Public fields

adGroupIndex

public final int adGroupIndex

If the media period is in an ad group, the index of the ad group in the period. INDEX_UNSET otherwise.

adIndexInAdGroup

public final int adIndexInAdGroup

If the media period is in an ad group, the index of the ad in its ad group in the period. INDEX_UNSET otherwise.

nextAdGroupIndex

public final int nextAdGroupIndex

The index of the next ad group to which the media period's content is clipped, or INDEX_UNSET if there is no following ad group or if this media period is an ad.

periodUid

public final Object periodUid

The unique id of the timeline period.

windowSequenceNumber

public final long windowSequenceNumber

The sequence number of the window in the buffered sequence of windows this media period is part of. INDEX_UNSET if the media period id is not part of a buffered sequence of windows.

Public constructors

MediaPeriodId

public MediaPeriodId(Object periodUid)

Creates a media period identifier for a period which is not part of a buffered sequence of windows.

Parameters
Object periodUid

The unique id of the timeline period.

MediaPeriodId

public MediaPeriodId(Object periodUid, long windowSequenceNumber)

Creates a media period identifier for the specified period in the timeline.

Parameters
Object periodUid

The unique id of the timeline period.

long windowSequenceNumber

The sequence number of the window in the buffered sequence of windows this media period is part of.

MediaPeriodId

public MediaPeriodId(
    Object periodUid,
    long windowSequenceNumber,
    int nextAdGroupIndex
)

Creates a media period identifier for the specified clipped period in the timeline.

Parameters
Object periodUid

The unique id of the timeline period.

long windowSequenceNumber

The sequence number of the window in the buffered sequence of windows this media period is part of.

int nextAdGroupIndex

The index of the next ad group to which the media period's content is clipped.

MediaPeriodId

public MediaPeriodId(
    Object periodUid,
    int adGroupIndex,
    int adIndexInAdGroup,
    long windowSequenceNumber
)

Creates a media period identifier that identifies an ad within an ad group at the specified timeline period.

Parameters
Object periodUid

The unique id of the timeline period that contains the ad group.

int adGroupIndex

The index of the ad group.

int adIndexInAdGroup

The index of the ad in the ad group.

long windowSequenceNumber

The sequence number of the window in the buffered sequence of windows this media period is part of.

Protected constructors

MediaPeriodId

protected MediaPeriodId(MediaPeriodId mediaPeriodId)

Copy constructor for inheritance.

Public methods

copyWithPeriodUid

public MediaPeriodId copyWithPeriodUid(Object newPeriodUid)

Returns a copy of this period identifier but with newPeriodUid as its period uid.

copyWithWindowSequenceNumber

public MediaPeriodId copyWithWindowSequenceNumber(long windowSequenceNumber)

Returns a copy of this period identifier with a new windowSequenceNumber.

equals

public boolean equals(@Nullable Object obj)

hashCode

public int hashCode()

isAd

public boolean isAd()

Returns whether this period identifier identifies an ad in an ad group in a period.