Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb977ad

Browse files
committedJul 7, 2024·
Support #EXT-X-GAP at stringify()
1 parent cc2963a commit eb977ad

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ This section describes the structure of the object returned by `parse()` method.
210210
| `dateRange` | `DateRange` | No | undefined | See [EXT-X-DATERANGE](https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.7) |
211211
| `markers` | [`SpliceInfo`] | No | [] | SCTE-35 messages associated with this segment|
212212
| `parts` | [`PartialSegment`] | No | [] | Partial Segments that constitute this segment |
213+
| `gap` | boolean | No | undefined | See [EXT-X-GAP](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.4.7) |
213214

214215
### `PartialSegment` (extends `Data`)
215216
| Property | Type | Required | Default | Description |

‎stringify.ts

+3
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ function buildSegment(lines: LineArray, segment: Segment, lastKey: string, lastM
331331
if (segment.discontinuity) {
332332
lines.push(`#EXT-X-DISCONTINUITY`);
333333
}
334+
if (segment.gap) {
335+
lines.push(`#EXT-X-GAP`);
336+
}
334337
if (segment.key) {
335338
const line = buildKey(segment.key);
336339
if (line !== lastKey) {

‎test/spec/4_Playlists/4.3_Playlist-Tags/4.3.2_Media-Segment-Tags/4.4.4.7_EXT-X-GAP.spec.js

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const test = require("ava");
2+
const HLS = require('../../../../..');
23
const utils = require("../../../../helpers/utils");
4+
const {equalPlaylist} = require("../../../../helpers/matchers");
35

46
// https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.4.7
57

@@ -38,3 +40,17 @@ test('#EXT-X-TAG_02', t => {
3840
#EXT-X-ENDLIST
3941
`);
4042
});
43+
44+
test('#EXT-X-TAG_03', t => {
45+
const txt = `
46+
#EXTM3U
47+
#EXT-X-VERSION:8
48+
#EXT-X-TARGETDURATION:5
49+
#EXT-X-GAP
50+
#EXTINF:4,
51+
1.ts
52+
`;
53+
const playlist = HLS.parse(txt);
54+
t.truthy(playlist.segments[0].gap);
55+
equalPlaylist(t, txt, HLS.stringify(playlist));
56+
});

0 commit comments

Comments
 (0)
Please sign in to comment.