HlsMediaPlaylist
@UnstableApi
public final class HlsMediaPlaylist extends HlsPlaylist
| java.lang.Object | ||
| ↳ | androidx.media3.exoplayer.hls.playlist.HlsPlaylist | |
| ↳ | androidx.media3.exoplayer.hls.playlist.HlsMediaPlaylist |
Represents an HLS media playlist.
Summary
Constants |
|
|---|---|
static final int |
|
static final int |
|
static final int |
Public fields |
|
|---|---|
final int |
The discontinuity sequence number of the first media segment in the playlist, as defined by #EXT-X-DISCONTINUITY-SEQUENCE. |
final long |
The total duration of the playlist in microseconds. |
final boolean |
Whether the playlist contains the #EXT-X-DISCONTINUITY-SEQUENCE tag. |
final boolean |
Whether the playlist contains the #EXT-X-ENDLIST tag. |
final boolean |
Whether the |
final boolean |
Whether the playlist contains a #EXT-X-PROGRAM-DATE-TIME tag. |
final ImmutableList<HlsMediaPlaylist.Interstitial> |
The interstitials declared as |
final long |
The media sequence number of the first media segment in the playlist, as defined by #EXT-X-MEDIA-SEQUENCE. |
final long |
The target duration for segment parts, as defined by #EXT-X-PART-INF, or |
final int |
The type of the playlist. |
final boolean |
Whether the start position should be precise, as defined by #EXT-X-START. |
final @Nullable DrmInitData |
Contains the CDM protection schemes used by segments in this playlist. |
final Map<Uri, HlsMediaPlaylist.RenditionReport> |
The rendition reports of alternative rendition playlists. |
final List<HlsMediaPlaylist.Segment> |
The list of segments in the playlist. |
final HlsMediaPlaylist.ServerControl |
The attributes of the #EXT-X-SERVER-CONTROL header. |
final long |
The start offset in microseconds from the beginning of the playlist, as defined by #EXT-X-START, or |
final long |
If |
final long |
The target duration in microseconds, as defined by #EXT-X-TARGETDURATION. |
final List<HlsMediaPlaylist.Part> |
The list of parts at the end of the playlist for which the segment is not in the playlist yet. |
final int |
The compatibility version, as defined by #EXT-X-VERSION. |
Public constructors |
|---|
HlsMediaPlaylist(Constructs an instance. |
Public methods |
|
|---|---|
HlsMediaPlaylist |
Returns a copy of the manifest including only the streams specified by the given keys. |
HlsMediaPlaylist |
copyWith(long startTimeUs, int discontinuitySequence)Returns a playlist identical to this one except for the start time, the discontinuity sequence and |
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 |
isNewerThan(@Nullable HlsMediaPlaylist other)Returns whether this playlist is newer than |
Inherited fields |
|---|
Constants
Public fields
discontinuitySequence
public final int discontinuitySequence
The discontinuity sequence number of the first media segment in the playlist, as defined by #EXT-X-DISCONTINUITY-SEQUENCE.
hasDiscontinuitySequence
public final boolean hasDiscontinuitySequence
Whether the playlist contains the #EXT-X-DISCONTINUITY-SEQUENCE tag.
hasPositiveStartOffset
public final boolean hasPositiveStartOffset
Whether the startOffsetUs was explicitly defined by #EXT-X-START as a positive value or zero.
hasProgramDateTime
public final boolean hasProgramDateTime
Whether the playlist contains a #EXT-X-PROGRAM-DATE-TIME tag.
interstitials
public final ImmutableList<HlsMediaPlaylist.Interstitial> interstitials
The interstitials declared as #EXT-X-DATERANGE with
CLASS="com.apple.hls.interstitial"
mediaSequence
public final long mediaSequence
The media sequence number of the first media segment in the playlist, as defined by #EXT-X-MEDIA-SEQUENCE.
partTargetDurationUs
public final long partTargetDurationUs
The target duration for segment parts, as defined by #EXT-X-PART-INF, or TIME_UNSET if undefined.
playlistType
@HlsMediaPlaylist.PlaylistType
public final int playlistType
The type of the playlist. See PlaylistType.
preciseStart
public final boolean preciseStart
Whether the start position should be precise, as defined by #EXT-X-START.
protectionSchemes
public final @Nullable DrmInitData protectionSchemes
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
public final Map<Uri, HlsMediaPlaylist.RenditionReport> renditionReports
The rendition reports of alternative rendition playlists.
serverControl
public final HlsMediaPlaylist.ServerControl serverControl
The attributes of the #EXT-X-SERVER-CONTROL header.
startOffsetUs
public final long startOffsetUs
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
public final long startTimeUs
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
public final long targetDurationUs
The target duration in microseconds, as defined by #EXT-X-TARGETDURATION.
trailingParts
public final List<HlsMediaPlaylist.Part> trailingParts
The list of parts at the end of the playlist for which the segment is not in the playlist yet.
Public constructors
HlsMediaPlaylist
public HlsMediaPlaylist(
@HlsMediaPlaylist.PlaylistType int playlistType,
String baseUri,
List<String> tags,
long startOffsetUs,
boolean preciseStart,
long startTimeUs,
boolean hasDiscontinuitySequence,
int discontinuitySequence,
long mediaSequence,
int version,
long targetDurationUs,
long partTargetDurationUs,
boolean hasIndependentSegments,
boolean hasEndTag,
boolean hasProgramDateTime,
@Nullable DrmInitData protectionSchemes,
List<HlsMediaPlaylist.Segment> segments,
List<HlsMediaPlaylist.Part> trailingParts,
HlsMediaPlaylist.ServerControl serverControl,
Map<Uri, HlsMediaPlaylist.RenditionReport> renditionReports,
List<HlsMediaPlaylist.Interstitial> interstitials
)
Constructs an instance.
| Parameters | |
|---|---|
@HlsMediaPlaylist.PlaylistType int playlistType |
See |
String baseUri |
See |
List<String> tags |
See |
long startOffsetUs |
See |
boolean preciseStart |
See |
long startTimeUs |
See |
boolean hasDiscontinuitySequence |
|
int discontinuitySequence |
|
long mediaSequence |
See |
int version |
See |
long targetDurationUs |
See |
long partTargetDurationUs |
See |
boolean hasIndependentSegments |
|
boolean hasEndTag |
See |
boolean hasProgramDateTime |
See |
@Nullable DrmInitData protectionSchemes |
See |
List<HlsMediaPlaylist.Segment> segments |
See |
List<HlsMediaPlaylist.Part> trailingParts |
See |
HlsMediaPlaylist.ServerControl serverControl |
See |
Map<Uri, HlsMediaPlaylist.RenditionReport> renditionReports |
See |
List<HlsMediaPlaylist.Interstitial> interstitials |
See |
Public methods
copy
public HlsMediaPlaylist copy(List<StreamKey> streamKeys)
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.
| Returns | |
|---|---|
HlsMediaPlaylist |
The filtered manifest. |
copyWith
public HlsMediaPlaylist copyWith(long startTimeUs, int discontinuitySequence)
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 | |
|---|---|
long startTimeUs |
The start time for the returned playlist. |
int discontinuitySequence |
The discontinuity sequence for the returned playlist. |
| Returns | |
|---|---|
HlsMediaPlaylist |
An identical playlist including the provided discontinuity and timing information. |
copyWithEndTag
public HlsMediaPlaylist copyWithEndTag()
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
public long getEndTimeUs()
Returns the result of adding the duration of the playlist to its start time.
isNewerThan
public boolean isNewerThan(@Nullable HlsMediaPlaylist other)
Returns whether this playlist is newer than other.
| Parameters | |
|---|---|
@Nullable HlsMediaPlaylist other |
The playlist to compare. |
| Returns | |
|---|---|
boolean |
Whether this playlist is newer than |