Representation.MultiSegmentRepresentation


class Representation.MultiSegmentRepresentation : Representation, DashSegmentIndex


A DASH representation consisting of multiple segments.

Summary

Public constructors

MultiSegmentRepresentation(
    revisionId: Long,
    format: Format!,
    baseUrls: (Mutable)List<BaseUrl!>!,
    segmentBase: SegmentBase.MultiSegmentBase!,
    inbandEventStreams: (Mutable)List<Descriptor!>?,
    essentialProperties: (Mutable)List<Descriptor!>!,
    supplementalProperties: (Mutable)List<Descriptor!>!
)

Creates the multi-segment Representation.

Public functions

Long
getAvailableSegmentCount(periodDurationUs: Long, nowUnixTimeUs: Long)

Returns the number of available segments in the index.

String?

Returns a cache key for the representation if set, or null.

Long
getDurationUs(segmentNum: Long, periodDurationUs: Long)

Returns the duration of a segment.

Long
getFirstAvailableSegmentNum(periodDurationUs: Long, nowUnixTimeUs: Long)

Returns the segment number of the first available segment in the index.

Long

Returns the segment number of the first defined segment in the index.

DashSegmentIndex!

Returns an index if the representation provides one directly, or null otherwise.

RangedUri?

Returns a RangedUri defining the location of the representation's segment index, or null if the representation provides an index directly.

Long
getNextSegmentAvailableTimeUs(
    periodDurationUs: Long,
    nowUnixTimeUs: Long
)

Returns the time, in microseconds, at which a new segment becomes available, or TIME_UNSET if not applicable.

Long
getSegmentCount(periodDurationUs: Long)

Returns the number of segments defined in the index, or INDEX_UNBOUNDED.

Long
getSegmentNum(timeUs: Long, periodDurationUs: Long)

Returns getFirstSegmentNum() if the index has no segments or if the given media time is earlier than the start of the first segment.

RangedUri!
getSegmentUrl(segmentNum: Long)

Returns a RangedUri defining the location of a segment.

Long
getTimeUs(segmentNum: Long)

Returns the start time of a segment.

Boolean

Returns true if segments are defined explicitly by the index.

Inherited functions

From androidx.media3.exoplayer.dash.manifest.Representation
java-static Representation!
newInstance(
    revisionId: Long,
    format: Format!,
    baseUrls: (Mutable)List<BaseUrl!>!,
    segmentBase: SegmentBase!
)

Constructs a new instance.

java-static Representation!
newInstance(
    revisionId: Long,
    format: Format!,
    baseUrls: (Mutable)List<BaseUrl!>!,
    segmentBase: SegmentBase!,
    inbandEventStreams: (Mutable)List<Descriptor!>?,
    essentialProperties: (Mutable)List<Descriptor!>!,
    supplementalProperties: (Mutable)List<Descriptor!>!,
    cacheKey: String?
)

Constructs a new instance.

Inherited properties

From androidx.media3.exoplayer.dash.manifest.Representation
ImmutableList<BaseUrl!>!

The base URLs of the representation.

(Mutable)List<Descriptor!>!

Essential properties in the representation.

Format!

The format of the representation.

(Mutable)List<Descriptor!>!

The in-band event streams in the representation.

RangedUri?
Long

The offset of the presentation timestamps in the media stream relative to media time.

Long

Identifies the revision of the media contained within the representation.

(Mutable)List<Descriptor!>!

Supplemental properties in the adaptation set.

Public constructors

MultiSegmentRepresentation

MultiSegmentRepresentation(
    revisionId: Long,
    format: Format!,
    baseUrls: (Mutable)List<BaseUrl!>!,
    segmentBase: SegmentBase.MultiSegmentBase!,
    inbandEventStreams: (Mutable)List<Descriptor!>?,
    essentialProperties: (Mutable)List<Descriptor!>!,
    supplementalProperties: (Mutable)List<Descriptor!>!
)

Creates the multi-segment Representation.

Parameters
revisionId: Long

Identifies the revision of the content.

format: Format!

The format of the representation.

baseUrls: (Mutable)List<BaseUrl!>!

The base URLs of the representation.

segmentBase: SegmentBase.MultiSegmentBase!

The segment base underlying the representation.

inbandEventStreams: (Mutable)List<Descriptor!>?

The in-band event streams in the representation. May be null.

essentialProperties: (Mutable)List<Descriptor!>!

Essential properties in the representation. May be empty.

supplementalProperties: (Mutable)List<Descriptor!>!

Supplemental properties in the representation. May be empty.

Public functions

getAvailableSegmentCount

fun getAvailableSegmentCount(periodDurationUs: Long, nowUnixTimeUs: Long): Long

Returns the number of available segments in the index.

Parameters
periodDurationUs: Long

The duration of the enclosing period in microseconds, or TIME_UNSET if the period's duration is not yet known.

nowUnixTimeUs: Long

The current time in milliseconds since the Unix epoch.

Returns
Long

The number of available segments in the index.

getCacheKey

fun getCacheKey(): String?

Returns a cache key for the representation if set, or null.

getDurationUs

fun getDurationUs(segmentNum: Long, periodDurationUs: Long): Long

Returns the duration of a segment.

Parameters
segmentNum: Long

The segment number.

periodDurationUs: Long

The duration of the enclosing period in microseconds, or TIME_UNSET if the period's duration is not yet known.

Returns
Long

The duration of the segment, in microseconds.

getFirstAvailableSegmentNum

fun getFirstAvailableSegmentNum(periodDurationUs: Long, nowUnixTimeUs: Long): Long

Returns the segment number of the first available segment in the index.

Parameters
periodDurationUs: Long

The duration of the enclosing period in microseconds, or TIME_UNSET if the period's duration is not yet known.

nowUnixTimeUs: Long

The current time in milliseconds since the Unix epoch.

Returns
Long

The number of the first available segment.

getFirstSegmentNum

fun getFirstSegmentNum(): Long

Returns the segment number of the first defined segment in the index.

getIndex

fun getIndex(): DashSegmentIndex!

Returns an index if the representation provides one directly, or null otherwise.

getIndexUri

fun getIndexUri(): RangedUri?

Returns a RangedUri defining the location of the representation's segment index, or null if the representation provides an index directly.

getNextSegmentAvailableTimeUs

fun getNextSegmentAvailableTimeUs(
    periodDurationUs: Long,
    nowUnixTimeUs: Long
): Long

Returns the time, in microseconds, at which a new segment becomes available, or TIME_UNSET if not applicable.

Parameters
periodDurationUs: Long

The duration of the enclosing period in microseconds, or TIME_UNSET if the period's duration is not yet known.

nowUnixTimeUs: Long

The current time in milliseconds since the Unix epoch.

Returns
Long

The time, in microseconds, at which a new segment becomes available, or TIME_UNSET if not applicable.

getSegmentCount

fun getSegmentCount(periodDurationUs: Long): Long

Returns the number of segments defined in the index, or INDEX_UNBOUNDED.

An unbounded index occurs if a dynamic manifest uses SegmentTemplate elements without a SegmentTimeline element, and if the period duration is not yet known. In this case the caller can query the available segment using getFirstAvailableSegmentNum and getAvailableSegmentCount.

Parameters
periodDurationUs: Long

The duration of the enclosing period in microseconds, or TIME_UNSET if the period's duration is not yet known.

Returns
Long

The number of segments in the index, or INDEX_UNBOUNDED.

getSegmentNum

fun getSegmentNum(timeUs: Long, periodDurationUs: Long): Long

Returns getFirstSegmentNum() if the index has no segments or if the given media time is earlier than the start of the first segment. Returns getFirstSegmentNum() + getSegmentCount() - 1 if the given media time is later than the end of the last segment. Otherwise, returns the segment number of the segment containing the given media time.

Parameters
timeUs: Long

The time in microseconds.

periodDurationUs: Long

The duration of the enclosing period in microseconds, or TIME_UNSET if the period's duration is not yet known.

Returns
Long

The segment number of the corresponding segment.

getSegmentUrl

fun getSegmentUrl(segmentNum: Long): RangedUri!

Returns a RangedUri defining the location of a segment.

Parameters
segmentNum: Long

The segment number.

Returns
RangedUri!

The RangedUri defining the location of the data.

getTimeUs

fun getTimeUs(segmentNum: Long): Long

Returns the start time of a segment.

Parameters
segmentNum: Long

The segment number.

Returns
Long

The corresponding start time in microseconds.

isExplicit

fun isExplicit(): Boolean

Returns true if segments are defined explicitly by the index.

If true is returned, each segment is defined explicitly by the index data, and all of the listed segments are guaranteed to be available at the time when the index was obtained.

If false is returned then segment information was derived from properties such as a fixed segment duration. If the presentation is dynamic, it's possible that only a subset of the segments are available.

Returns
Boolean

Whether segments are defined explicitly by the index.