HlsMediaPlaylist.create constructor
HlsMediaPlaylist.create({
- required int playlistType,
- required int? startOffsetUs,
- required int? startTimeUs,
- required bool hasDiscontinuitySequence,
- required int discontinuitySequence,
- required int? mediaSequence,
- required int? version,
- required int? targetDurationUs,
- required bool hasEndTag,
- required bool hasProgramDateTime,
- required DrmInitData? protectionSchemes,
- required List<
Segment> segments, - required String baseUri,
- required List<
String> tags, - required bool hasIndependentSegments,
Implementation
factory HlsMediaPlaylist.create({
required int playlistType,
required int? startOffsetUs,
required int? startTimeUs,
required bool hasDiscontinuitySequence,
required int discontinuitySequence,
required int? mediaSequence,
required int? version,
required int? targetDurationUs,
required bool hasEndTag,
required bool hasProgramDateTime,
required DrmInitData? protectionSchemes,
required List<Segment> segments,
required String baseUri,
required List<String> tags,
required bool hasIndependentSegments,
}) {
final int? durationUs = segments.isNotEmpty
? segments.last.relativeStartTimeUs ?? 0 + segments.last.durationUs!
: null;
if (startOffsetUs != null && startOffsetUs < 0) {
startOffsetUs = durationUs ?? 0 + startOffsetUs;
}
return HlsMediaPlaylist._(
playlistType: playlistType,
startOffsetUs: startOffsetUs,
startTimeUs: startTimeUs,
hasDiscontinuitySequence: hasDiscontinuitySequence,
discontinuitySequence: discontinuitySequence,
mediaSequence: mediaSequence,
version: version,
targetDurationUs: targetDurationUs,
hasEndTag: hasEndTag,
hasProgramDateTime: hasProgramDateTime,
protectionSchemes: protectionSchemes,
segments: segments,
durationUs: durationUs,
baseUri: baseUri,
tags: tags,
hasIndependentSegments: hasIndependentSegments,
);
}