Class HlsMediaPlaylist
- java.lang.Object
-
- com.google.android.exoplayer2.source.hls.playlist.HlsPlaylist
-
- com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist
-
- All Implemented Interfaces:
FilterableManifest<HlsPlaylist>
public final class HlsMediaPlaylist extends HlsPlaylist
Represents an HLS media playlist.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHlsMediaPlaylist.PartA media part.static interfaceHlsMediaPlaylist.PlaylistTypeType of the playlist, as defined by #EXT-X-PLAYLIST-TYPE.static classHlsMediaPlaylist.RenditionReportA rendition report for an alternative rendition defined in another media playlist.static classHlsMediaPlaylist.SegmentMedia segment reference.static classHlsMediaPlaylist.SegmentBaseThe base for aHlsMediaPlaylist.Segmentor aHlsMediaPlaylist.Partrequired for playback.static classHlsMediaPlaylist.ServerControlServer control attributes.
-
Field Summary
Fields Modifier and Type Field Description intdiscontinuitySequenceThe discontinuity sequence number of the first media segment in the playlist, as defined by #EXT-X-DISCONTINUITY-SEQUENCE.longdurationUsThe total duration of the playlist in microseconds.booleanhasDiscontinuitySequenceWhether the playlist contains the #EXT-X-DISCONTINUITY-SEQUENCE tag.booleanhasEndTagWhether the playlist contains the #EXT-X-ENDLIST tag.booleanhasPositiveStartOffsetWhether thestartOffsetUswas explicitly defined by #EXT-X-START as a positive value or zero.booleanhasProgramDateTimeWhether the playlist contains a #EXT-X-PROGRAM-DATE-TIME tag.longmediaSequenceThe media sequence number of the first media segment in the playlist, as defined by #EXT-X-MEDIA-SEQUENCE.longpartTargetDurationUsThe target duration for segment parts, as defined by #EXT-X-PART-INF, orC.TIME_UNSETif undefined.static intPLAYLIST_TYPE_EVENTstatic intPLAYLIST_TYPE_UNKNOWNstatic intPLAYLIST_TYPE_VOD@com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist.PlaylistType intplaylistTypeThe type of the playlist.booleanpreciseStartWhether the start position should be precise, as defined by #EXT-X-START.DrmInitDataprotectionSchemesContains the CDM protection schemes used by segments in this playlist.Map<Uri,HlsMediaPlaylist.RenditionReport>renditionReportsThe rendition reports of alternative rendition playlists.List<HlsMediaPlaylist.Segment>segmentsThe list of segments in the playlist.HlsMediaPlaylist.ServerControlserverControlThe attributes of the #EXT-X-SERVER-CONTROL header.longstartOffsetUsThe start offset in microseconds from the beginning of the playlist, as defined by #EXT-X-START, orC.TIME_UNSETif undefined.longstartTimeUsIfhasProgramDateTimeis true, contains the datetime as microseconds since epoch.longtargetDurationUsThe target duration in microseconds, as defined by #EXT-X-TARGETDURATION.List<HlsMediaPlaylist.Part>trailingPartsThe list of parts at the end of the playlist for which the segment is not in the playlist yet.intversionThe compatibility version, as defined by #EXT-X-VERSION.-
Fields inherited from class com.google.android.exoplayer2.source.hls.playlist.HlsPlaylist
baseUri, hasIndependentSegments, tags
-
-
Constructor Summary
Constructors Constructor Description HlsMediaPlaylist(@com.google.android.exoplayer2.source.hls.playlist.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, DrmInitData protectionSchemes, List<HlsMediaPlaylist.Segment> segments, List<HlsMediaPlaylist.Part> trailingParts, HlsMediaPlaylist.ServerControl serverControl, Map<Uri,HlsMediaPlaylist.RenditionReport> renditionReports)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HlsMediaPlaylistcopy(List<StreamKey> streamKeys)Returns a copy of the manifest including only the streams specified by the given keys.HlsMediaPlaylistcopyWith(long startTimeUs, int discontinuitySequence)Returns a playlist identical to this one except for the start time, the discontinuity sequence andhasDiscontinuitySequencevalues.HlsMediaPlaylistcopyWithEndTag()Returns a playlist identical to this one except that an end tag is added.longgetEndTimeUs()Returns the result of adding the duration of the playlist to its start time.booleanisNewerThan(HlsMediaPlaylist other)Returns whether this playlist is newer thanother.
-
-
-
Field Detail
-
PLAYLIST_TYPE_UNKNOWN
public static final int PLAYLIST_TYPE_UNKNOWN
- See Also:
- Constant Field Values
-
PLAYLIST_TYPE_VOD
public static final int PLAYLIST_TYPE_VOD
- See Also:
- Constant Field Values
-
PLAYLIST_TYPE_EVENT
public static final int PLAYLIST_TYPE_EVENT
- See Also:
- Constant Field Values
-
playlistType
public final @com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist.PlaylistType int playlistType
The type of the playlist. SeeHlsMediaPlaylist.PlaylistType.
-
startOffsetUs
public final long startOffsetUs
The start offset in microseconds from the beginning of the playlist, as defined by #EXT-X-START, orC.TIME_UNSETif undefined. The value is guaranteed to be between 0 anddurationUs, inclusive.
-
hasPositiveStartOffset
public final boolean hasPositiveStartOffset
Whether thestartOffsetUswas explicitly defined by #EXT-X-START as a positive value or zero.
-
preciseStart
public final boolean preciseStart
Whether the start position should be precise, as defined by #EXT-X-START.
-
startTimeUs
public final long startTimeUs
IfhasProgramDateTimeis true, contains the datetime as microseconds since epoch. Otherwise, contains the aggregated duration of removed segments up to this snapshot of the playlist.
-
hasDiscontinuitySequence
public final boolean hasDiscontinuitySequence
Whether the playlist contains the #EXT-X-DISCONTINUITY-SEQUENCE tag.
-
discontinuitySequence
public final int discontinuitySequence
The discontinuity sequence number of the first media segment in the playlist, as defined by #EXT-X-DISCONTINUITY-SEQUENCE.
-
mediaSequence
public final long mediaSequence
The media sequence number of the first media segment in the playlist, as defined by #EXT-X-MEDIA-SEQUENCE.
-
version
public final int version
The compatibility version, as defined by #EXT-X-VERSION.
-
targetDurationUs
public final long targetDurationUs
The target duration in microseconds, as defined by #EXT-X-TARGETDURATION.
-
partTargetDurationUs
public final long partTargetDurationUs
The target duration for segment parts, as defined by #EXT-X-PART-INF, orC.TIME_UNSETif undefined.
-
hasEndTag
public final boolean hasEndTag
Whether the playlist contains the #EXT-X-ENDLIST tag.
-
hasProgramDateTime
public final boolean hasProgramDateTime
Whether the playlist contains a #EXT-X-PROGRAM-DATE-TIME tag.
-
protectionSchemes
@Nullable public final 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.
-
segments
public final List<HlsMediaPlaylist.Segment> segments
The list of segments in the playlist.
-
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.
-
renditionReports
public final Map<Uri,HlsMediaPlaylist.RenditionReport> renditionReports
The rendition reports of alternative rendition playlists.
-
durationUs
public final long durationUs
The total duration of the playlist in microseconds.
-
serverControl
public final HlsMediaPlaylist.ServerControl serverControl
The attributes of the #EXT-X-SERVER-CONTROL header.
-
-
Constructor Detail
-
HlsMediaPlaylist
public HlsMediaPlaylist(@com.google.android.exoplayer2.source.hls.playlist.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)- Parameters:
playlistType- SeeplaylistType.baseUri- SeeHlsPlaylist.baseUri.tags- SeeHlsPlaylist.tags.startOffsetUs- SeestartOffsetUs.startTimeUs- SeestartTimeUs.hasDiscontinuitySequence- SeehasDiscontinuitySequence.discontinuitySequence- SeediscontinuitySequence.mediaSequence- SeemediaSequence.version- Seeversion.targetDurationUs- SeetargetDurationUs.hasIndependentSegments- SeeHlsPlaylist.hasIndependentSegments.hasEndTag- SeehasEndTag.hasProgramDateTime- SeehasProgramDateTime.protectionSchemes- SeeprotectionSchemes.segments- Seesegments.trailingParts- SeetrailingParts.serverControl- SeeserverControlrenditionReports- SeerenditionReports.
-
-
Method Detail
-
copy
public HlsMediaPlaylist copy(List<StreamKey> streamKeys)
Description copied from interface:FilterableManifestReturns 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- A non-empty list of stream keys.- Returns:
- The filtered manifest.
-
isNewerThan
public boolean isNewerThan(@Nullable HlsMediaPlaylist other)Returns whether this playlist is newer thanother.- Parameters:
other- The playlist to compare.- Returns:
- Whether this playlist is newer than
other.
-
getEndTimeUs
public long getEndTimeUs()
Returns the result of adding the duration of the playlist to its start time.
-
copyWith
public HlsMediaPlaylist copyWith(long startTimeUs, int discontinuitySequence)
Returns a playlist identical to this one except for the start time, the discontinuity sequence andhasDiscontinuitySequencevalues. The first two are set to the specified values,hasDiscontinuitySequenceis set to true.- Parameters:
startTimeUs- The start time for the returned playlist.discontinuitySequence- The discontinuity sequence for the returned playlist.- Returns:
- 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.
-
-