Skip to content

Commit 4f8d516

Browse files
authored
Add parse/stringify for EXT-X-DATERANGE CUE attribute (#165)
* Add parse/stringify for EXT-X-DATERANGE CUE attribute * clean code * clean code
1 parent b5d9b45 commit 4f8d516

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

parse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ function parseSegment(lines: Line[], uri: string, start: number, end: number, me
563563
id: attributes['ID'],
564564
classId: attributes['CLASS'],
565565
start: attributes['START-DATE'],
566+
cue: attributes['CUE'],
566567
end: attributes['END-DATE'],
567568
duration: attributes['DURATION'],
568569
plannedDuration: attributes['PLANNED-DURATION'],

stringify.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ function buildDateRange(dateRange: DateRange) {
408408
if (dateRange.start) {
409409
attrs.push(`START-DATE="${utils.formatDate(dateRange.start)}"`);
410410
}
411+
if (dateRange.cue) {
412+
attrs.push(`CUE="${dateRange.cue}"`);
413+
}
411414
if (dateRange.end) {
412415
attrs.push(`END-DATE="${utils.formatDate(dateRange.end)}"`);
413416
}

types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class DateRange {
204204
id: string;
205205
classId?: string;
206206
start?: Date;
207+
cue?: string;
207208
end?: Date;
208209
duration?: number;
209210
plannedDuration?: number;
@@ -214,6 +215,7 @@ class DateRange {
214215
id, // required
215216
classId, // required if endOnNext is true
216217
start,
218+
cue,
217219
end,
218220
duration,
219221
plannedDuration,
@@ -226,6 +228,7 @@ class DateRange {
226228
this.id = id;
227229
this.classId = classId;
228230
this.start = start;
231+
this.cue = cue;
229232
this.end = end;
230233
this.duration = duration;
231234
this.plannedDuration = plannedDuration;

0 commit comments

Comments
 (0)