@UnstableApi
class HlsMediaPlaylist : HlsPlaylist


Represents an HLS media playlist.

Summary

Nested types

A media part.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
annotation HlsMediaPlaylist.PlaylistType

Type of the playlist, as defined by #EXT-X-PLAYLIST-TYPE.

A rendition report for an alternative rendition defined in another media playlist.

Media segment reference.

The base for a Segment or a Part required for playback.

Server control attributes.

Constants

const Int
const Int
const Int

Public constructors

HlsMediaPlaylist(
    @HlsMediaPlaylist.PlaylistType playlistType: Int,
    baseUri: String!,
    tags: (Mutable)List<String!>!,
    startOffsetUs: Long,
    preciseStart: Boolean,
    startTimeUs: Long,
    hasDiscontinuitySequence: Boolean,
    discontinuitySequence: Int,
    mediaSequence: Long,
    version: Int,
    targetDurationUs: Long,
    partTargetDurationUs: Long,
    hasIndependentSegments: Boolean,
    hasEndTag: Boolean,
    hasProgramDateTime: Boolean,
    protectionSchemes: DrmInitData?,
    segments: (Mutable)List<HlsMediaPlaylist.Segment!>!,
    trailingParts: (Mutable)List<HlsMediaPlaylist.Part!>!,
    serverControl: HlsMediaPlaylist.ServerControl!,
    renditionReports: (Mutable)Map<Uri!, HlsMediaPlaylist.RenditionReport!>!
)

Constructs an instance.

Public functions

HlsMediaPlaylist!
copy(streamKeys: (Mutable)List<StreamKey!>!)

Returns a copy of the manifest including only the streams specified by the given keys.

HlsMediaPlaylist!
copyWith(startTimeUs: Long, discontinuitySequence: Int)

Returns a playlist identical to this one except for the start time, the discontinuity sequence and hasDiscontinuitySequence values.

HlsMediaPlaylist!

Returns a playlist identical to this one except that an end tag is added.

Long

Returns the result of adding the duration of the playlist to its start time.

Boolean

Returns whether this playlist is newer than other.

Public properties

Int

The discontinuity sequence number of the first media segment in the playlist, as defined by #EXT-X-DISCONTINUITY-SEQUENCE.

Long

The total duration of the playlist in microseconds.

Boolean

Whether the playlist contains the #EXT-X-DISCONTINUITY-SEQUENCE tag.

Boolean

Whether the playlist contains the #EXT-X-ENDLIST tag.

Boolean

Whether the startOffsetUs was explicitly defined by #EXT-X-START as a positive value or zero.

Boolean

Whether the playlist contains a #EXT-X-PROGRAM-DATE-TIME tag.

Long

The media sequence number of the first media segment in the playlist, as defined by #EXT-X-MEDIA-SEQUENCE.

Long

The target duration for segment parts, as defined by #EXT-X-PART-INF, or TIME_UNSET if undefined.

Int

The type of the playlist.

Boolean

Whether the start position should be precise, as defined by #EXT-X-START.

DrmInitData?

Contains the CDM protection schemes used by segments in this playlist.

(Mutable)Map<Uri!, HlsMediaPlaylist.RenditionReport!>!

The rendition reports of alternative rendition playlists.

(Mutable)List<HlsMediaPlaylist.Segment!>!

The list of segments in the playlist.

HlsMediaPlaylist.ServerControl!

The attributes of the #EXT-X-SERVER-CONTROL header.

Long

The start offset in microseconds from the beginning of the playlist, as defined by #EXT-X-START, or TIME_UNSET if undefined.

Long

If hasProgramDateTime is true, contains the datetime as microseconds since epoch.

Long

The target duration in microseconds, as defined by #EXT-X-TARGETDURATION.

(Mutable)List<HlsMediaPlaylist.Part!>!

The list of parts at the end of the playlist for which the segment is not in the playlist yet.

Int

The compatibility version, as defined by #EXT-X-VERSION.

Inherited properties

From androidx.media3.exoplayer.hls.playlist.HlsPlaylist
String!

The base uri.

Boolean

Whether the media is formed of independent segments, as defined by the #EXT-X-INDEPENDENT-SEGMENTS tag.

(Mutable)List<String!>!

The list of tags in the playlist.

Constants

PLAYLIST_TYPE_EVENT

const val PLAYLIST_TYPE_EVENT = 2: Int

PLAYLIST_TYPE_UNKNOWN

const val PLAYLIST_TYPE_UNKNOWN = 0: Int

PLAYLIST_TYPE_VOD

const val PLAYLIST_TYPE_VOD = 1: Int

Public constructors

HlsMediaPlaylist

HlsMediaPlaylist(
    @HlsMediaPlaylist.PlaylistType playlistType: Int,
    baseUri: String!,
    tags: (Mutable)List<String!>!,
    startOffsetUs: Long,
    preciseStart: Boolean,
    startTimeUs: Long,
    hasDiscontinuitySequence: Boolean,
    discontinuitySequence: Int,
    mediaSequence: Long,
    version: Int,
    targetDurationUs: Long,
    partTargetDurationUs: Long,
    hasIndependentSegments: Boolean,
    hasEndTag: Boolean,
    hasProgramDateTime: Boolean,
    protectionSchemes: DrmInitData?,
    segments: (Mutable)List<HlsMediaPlaylist.Segment!>!,
    trailingParts: (Mutable)List<HlsMediaPlaylist.Part!>!,
    serverControl: HlsMediaPlaylist.ServerControl!,
    renditionReports: (Mutable)Map<Uri!, HlsMediaPlaylist.RenditionReport!>!
)

Constructs an instance.

Parameters
@HlsMediaPlaylist.PlaylistType playlistType: Int

See playlistType.

baseUri: String!

See baseUri.

tags: (Mutable)List<String!>!

See tags.

startOffsetUs: Long

See startOffsetUs.

preciseStart: Boolean

See preciseStart.

startTimeUs: Long

See startTimeUs.

hasDiscontinuitySequence: Boolean

See hasDiscontinuitySequence.

discontinuitySequence: Int

See discontinuitySequence.

mediaSequence: Long

See mediaSequence.

version: Int

See version.

targetDurationUs: Long

See targetDurationUs.

partTargetDurationUs: Long

See partTargetDurationUs.

hasIndependentSegments: Boolean

See hasIndependentSegments.

hasEndTag: Boolean

See hasEndTag.

hasProgramDateTime: Boolean

See hasProgramDateTime.

protectionSchemes: DrmInitData?

See protectionSchemes.

segments: (Mutable)List<HlsMediaPlaylist.Segment!>!

See segments.

trailingParts: (Mutable)List<HlsMediaPlaylist.Part!>!

See trailingParts.

serverControl: HlsMediaPlaylist.ServerControl!

See serverControl

renditionReports: (Mutable)Map<Uri!, HlsMediaPlaylist.RenditionReport!>!

See renditionReports.

Public functions

copy

fun copy(streamKeys: (Mutable)List<StreamKey!>!): HlsMediaPlaylist!

Returns a copy of the manifest including only the streams specified by the given keys. If the manifest is unchanged then the instance may return itself.

Parameters
streamKeys: (Mutable)List<StreamKey!>!

A non-empty list of stream keys.

Returns
HlsMediaPlaylist!

The filtered manifest.

copyWith

fun copyWith(startTimeUs: Long, discontinuitySequence: Int): HlsMediaPlaylist!

Returns a playlist identical to this one except for the start time, the discontinuity sequence and hasDiscontinuitySequence values. The first two are set to the specified values, hasDiscontinuitySequence is set to true.

Parameters
startTimeUs: Long

The start time for the returned playlist.

discontinuitySequence: Int

The discontinuity sequence for the returned playlist.

Returns
HlsMediaPlaylist!

An identical playlist including the provided discontinuity and timing information.

copyWithEndTag

fun copyWithEndTag(): HlsMediaPlaylist!

Returns a playlist identical to this one except that an end tag is added. If an end tag is already present then the playlist will return itself.

getEndTimeUs

fun getEndTimeUs(): Long

Returns the result of adding the duration of the playlist to its start time.

isNewerThan

fun isNewerThan(other: HlsMediaPlaylist?): Boolean

Returns whether this playlist is newer than other.

Parameters
other: HlsMediaPlaylist?

The playlist to compare.

Returns
Boolean

Whether this playlist is newer than other.

Public properties

discontinuitySequence

val discontinuitySequenceInt

The discontinuity sequence number of the first media segment in the playlist, as defined by #EXT-X-DISCONTINUITY-SEQUENCE.

durationUs

val durationUsLong

The total duration of the playlist in microseconds.

hasDiscontinuitySequence

val hasDiscontinuitySequenceBoolean

Whether the playlist contains the #EXT-X-DISCONTINUITY-SEQUENCE tag.

hasEndTag

val hasEndTagBoolean

Whether the playlist contains the #EXT-X-ENDLIST tag.

hasPositiveStartOffset

val hasPositiveStartOffsetBoolean

Whether the startOffsetUs was explicitly defined by #EXT-X-START as a positive value or zero.

hasProgramDateTime

val hasProgramDateTimeBoolean

Whether the playlist contains a #EXT-X-PROGRAM-DATE-TIME tag.

mediaSequence

val mediaSequenceLong

The media sequence number of the first media segment in the playlist, as defined by #EXT-X-MEDIA-SEQUENCE.

partTargetDurationUs

val partTargetDurationUsLong

The target duration for segment parts, as defined by #EXT-X-PART-INF, or TIME_UNSET if undefined.

playlistType

@HlsMediaPlaylist.PlaylistType
val playlistTypeInt

The type of the playlist. See PlaylistType.

preciseStart

val preciseStartBoolean

Whether the start position should be precise, as defined by #EXT-X-START.

protectionSchemes

val protectionSchemesDrmInitData?

Contains the CDM protection schemes used by segments in this playlist. Does not contain any key acquisition data. Null if none of the segments in the playlist is CDM-encrypted.

renditionReports

val renditionReports: (Mutable)Map<Uri!, HlsMediaPlaylist.RenditionReport!>!

The rendition reports of alternative rendition playlists.

segments

val segments: (Mutable)List<HlsMediaPlaylist.Segment!>!

The list of segments in the playlist.

serverControl

val serverControlHlsMediaPlaylist.ServerControl!

The attributes of the #EXT-X-SERVER-CONTROL header.

startOffsetUs

val startOffsetUsLong

The start offset in microseconds from the beginning of the playlist, as defined by #EXT-X-START, or TIME_UNSET if undefined. The value is guaranteed to be between 0 and durationUs, inclusive.

startTimeUs

val startTimeUsLong

If hasProgramDateTime is true, contains the datetime as microseconds since epoch. Otherwise, contains the aggregated duration of removed segments up to this snapshot of the playlist.

targetDurationUs

val targetDurationUsLong

The target duration in microseconds, as defined by #EXT-X-TARGETDURATION.

trailingParts

val trailingParts: (Mutable)List<HlsMediaPlaylist.Part!>!

The list of parts at the end of the playlist for which the segment is not in the playlist yet.

version

val versionInt

The compatibility version, as defined by #EXT-X-VERSION.