@ac-kit/format-hls 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/LICENSE +28 -0
- package/README.md +145 -2
- package/dist/_date-range-fields.d.ts +14 -0
- package/dist/_date-range-fields.d.ts.map +1 -0
- package/dist/_date-range-fields.js +53 -0
- package/dist/_date-range-fields.js.map +1 -0
- package/dist/_key-scope.d.ts +8 -0
- package/dist/_key-scope.d.ts.map +1 -0
- package/dist/_key-scope.js +14 -0
- package/dist/_key-scope.js.map +1 -0
- package/dist/_temporal.d.ts +3 -0
- package/dist/_temporal.d.ts.map +1 -0
- package/dist/_temporal.js +14 -0
- package/dist/_temporal.js.map +1 -0
- package/dist/attribute/_print-attribute.d.ts +10 -0
- package/dist/attribute/_print-attribute.d.ts.map +1 -0
- package/dist/attribute/_print-attribute.js +31 -0
- package/dist/attribute/_print-attribute.js.map +1 -0
- package/dist/attribute/_scan-attribute-list.d.ts +24 -0
- package/dist/attribute/_scan-attribute-list.d.ts.map +1 -0
- package/dist/attribute/_scan-attribute-list.js +147 -0
- package/dist/attribute/_scan-attribute-list.js.map +1 -0
- package/dist/attribute/hls-attribute.d.ts +38 -0
- package/dist/attribute/hls-attribute.d.ts.map +1 -0
- package/dist/attribute/hls-attribute.js +42 -0
- package/dist/attribute/hls-attribute.js.map +1 -0
- package/dist/document/hls-document.d.ts +52 -0
- package/dist/document/hls-document.d.ts.map +1 -0
- package/dist/document/hls-document.js +2 -0
- package/dist/document/hls-document.js.map +1 -0
- package/dist/document/parse-hls-document.d.ts +14 -0
- package/dist/document/parse-hls-document.d.ts.map +1 -0
- package/dist/document/parse-hls-document.js +79 -0
- package/dist/document/parse-hls-document.js.map +1 -0
- package/dist/document/print-hls-document.d.ts +10 -0
- package/dist/document/print-hls-document.d.ts.map +1 -0
- package/dist/document/print-hls-document.js +28 -0
- package/dist/document/print-hls-document.js.map +1 -0
- package/dist/errors.d.ts +92 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +67 -0
- package/dist/errors.js.map +1 -0
- package/dist/hls-playlist-queries.d.ts +16 -0
- package/dist/hls-playlist-queries.d.ts.map +1 -0
- package/dist/hls-playlist-queries.js +28 -0
- package/dist/hls-playlist-queries.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/limits.d.ts +48 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +24 -0
- package/dist/limits.js.map +1 -0
- package/dist/live/apply-hls-delta-update.d.ts +49 -0
- package/dist/live/apply-hls-delta-update.d.ts.map +1 -0
- package/dist/live/apply-hls-delta-update.js +298 -0
- package/dist/live/apply-hls-delta-update.js.map +1 -0
- package/dist/model/hls-key.d.ts +29 -0
- package/dist/model/hls-key.d.ts.map +1 -0
- package/dist/model/hls-key.js +2 -0
- package/dist/model/hls-key.js.map +1 -0
- package/dist/model/hls-media-playlist.d.ts +202 -0
- package/dist/model/hls-media-playlist.d.ts.map +1 -0
- package/dist/model/hls-media-playlist.js +2 -0
- package/dist/model/hls-media-playlist.js.map +1 -0
- package/dist/model/hls-multivariant-playlist.d.ts +142 -0
- package/dist/model/hls-multivariant-playlist.d.ts.map +1 -0
- package/dist/model/hls-multivariant-playlist.js +2 -0
- package/dist/model/hls-multivariant-playlist.js.map +1 -0
- package/dist/model/hls-playlist.d.ts +77 -0
- package/dist/model/hls-playlist.d.ts.map +1 -0
- package/dist/model/hls-playlist.js +2 -0
- package/dist/model/hls-playlist.js.map +1 -0
- package/dist/parse/_attribute-reader.d.ts +106 -0
- package/dist/parse/_attribute-reader.d.ts.map +1 -0
- package/dist/parse/_attribute-reader.js +266 -0
- package/dist/parse/_attribute-reader.js.map +1 -0
- package/dist/parse/_context.d.ts +87 -0
- package/dist/parse/_context.d.ts.map +1 -0
- package/dist/parse/_context.js +179 -0
- package/dist/parse/_context.js.map +1 -0
- package/dist/parse/_interpret-media.d.ts +18 -0
- package/dist/parse/_interpret-media.d.ts.map +1 -0
- package/dist/parse/_interpret-media.js +677 -0
- package/dist/parse/_interpret-media.js.map +1 -0
- package/dist/parse/_interpret-multivariant.d.ts +9 -0
- package/dist/parse/_interpret-multivariant.d.ts.map +1 -0
- package/dist/parse/_interpret-multivariant.js +435 -0
- package/dist/parse/_interpret-multivariant.js.map +1 -0
- package/dist/parse/_media-validation.d.ts +14 -0
- package/dist/parse/_media-validation.d.ts.map +1 -0
- package/dist/parse/_media-validation.js +50 -0
- package/dist/parse/_media-validation.js.map +1 -0
- package/dist/parse/_prepare-lines.d.ts +12 -0
- package/dist/parse/_prepare-lines.d.ts.map +1 -0
- package/dist/parse/_prepare-lines.js +118 -0
- package/dist/parse/_prepare-lines.js.map +1 -0
- package/dist/parse/_sink.d.ts +30 -0
- package/dist/parse/_sink.d.ts.map +1 -0
- package/dist/parse/_sink.js +53 -0
- package/dist/parse/_sink.js.map +1 -0
- package/dist/parse/_values.d.ts +31 -0
- package/dist/parse/_values.d.ts.map +1 -0
- package/dist/parse/_values.js +89 -0
- package/dist/parse/_values.js.map +1 -0
- package/dist/parse/_variables.d.ts +34 -0
- package/dist/parse/_variables.d.ts.map +1 -0
- package/dist/parse/_variables.js +65 -0
- package/dist/parse/_variables.js.map +1 -0
- package/dist/parse/parse-hls-date-time.d.ts +13 -0
- package/dist/parse/parse-hls-date-time.d.ts.map +1 -0
- package/dist/parse/parse-hls-date-time.js +36 -0
- package/dist/parse/parse-hls-date-time.js.map +1 -0
- package/dist/parse/parse-hls-playlist.d.ts +58 -0
- package/dist/parse/parse-hls-playlist.d.ts.map +1 -0
- package/dist/parse/parse-hls-playlist.js +119 -0
- package/dist/parse/parse-hls-playlist.js.map +1 -0
- package/dist/parse-stream.d.ts +19 -0
- package/dist/parse-stream.d.ts.map +1 -0
- package/dist/parse-stream.js +54 -0
- package/dist/parse-stream.js.map +1 -0
- package/dist/print/print-hls-playlist.d.ts +39 -0
- package/dist/print/print-hls-playlist.d.ts.map +1 -0
- package/dist/print/print-hls-playlist.js +504 -0
- package/dist/print/print-hls-playlist.js.map +1 -0
- package/dist/print-stream.d.ts +11 -0
- package/dist/print-stream.d.ts.map +1 -0
- package/dist/print-stream.js +13 -0
- package/dist/print-stream.js.map +1 -0
- package/dist/resolve/_href.d.ts +13 -0
- package/dist/resolve/_href.d.ts.map +1 -0
- package/dist/resolve/_href.js +26 -0
- package/dist/resolve/_href.js.map +1 -0
- package/dist/resolve/hls-resolve-diagnostic.d.ts +26 -0
- package/dist/resolve/hls-resolve-diagnostic.d.ts.map +1 -0
- package/dist/resolve/hls-resolve-diagnostic.js +2 -0
- package/dist/resolve/hls-resolve-diagnostic.js.map +1 -0
- package/dist/resolve/resolve-hls-segments.d.ts +74 -0
- package/dist/resolve/resolve-hls-segments.d.ts.map +1 -0
- package/dist/resolve/resolve-hls-segments.js +179 -0
- package/dist/resolve/resolve-hls-segments.js.map +1 -0
- package/dist/resolve/resolve-hls-variants.d.ts +105 -0
- package/dist/resolve/resolve-hls-variants.d.ts.map +1 -0
- package/dist/resolve/resolve-hls-variants.js +162 -0
- package/dist/resolve/resolve-hls-variants.js.map +1 -0
- package/package.json +63 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hls-resolve-diagnostic.d.ts","sourceRoot":"","sources":["../../src/resolve/hls-resolve-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,CAAC,IAAI,EACV,aAAa,GACb,4BAA4B,GAC5B,oBAAoB,GACpB,uBAAuB,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hls-resolve-diagnostic.js","sourceRoot":"","sources":["../../src/resolve/hls-resolve-diagnostic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { HlsKey } from "../model/hls-key.js";
|
|
2
|
+
import type { HlsMediaPlaylist, HlsSegment } from "../model/hls-media-playlist.js";
|
|
3
|
+
import type { HlsResolveDiagnostic } from "./hls-resolve-diagnostic.js";
|
|
4
|
+
/** An absolute byte range: request `bytes=offset-(offset + length - 1)`. */
|
|
5
|
+
export type HlsResolvedByteRange = {
|
|
6
|
+
readonly offset: number;
|
|
7
|
+
readonly length: number;
|
|
8
|
+
};
|
|
9
|
+
/** A media segment with everything needed to fetch and place it. */
|
|
10
|
+
export type HlsResolvedSegment = {
|
|
11
|
+
readonly segment: HlsSegment;
|
|
12
|
+
/** Absolute URL; `null` when it cannot be resolved (see `warnings`). */
|
|
13
|
+
readonly href: string | null;
|
|
14
|
+
readonly mediaSequence: number;
|
|
15
|
+
readonly discontinuitySequence: number;
|
|
16
|
+
/** Seconds from the first listed segment: the sum of earlier `EXTINF`s. */
|
|
17
|
+
readonly startTime: number;
|
|
18
|
+
/**
|
|
19
|
+
* The segment's own `EXT-X-PROGRAM-DATE-TIME`, or the previous segment's date
|
|
20
|
+
* plus its duration (§6.3.3); `null` before the first date, after a
|
|
21
|
+
* discontinuity with no date of its own, or when the date does not read.
|
|
22
|
+
*/
|
|
23
|
+
readonly programDateTime: Temporal.Instant | null;
|
|
24
|
+
/** Every offset filled in (§4.4.4.2). */
|
|
25
|
+
readonly byteRange: HlsResolvedByteRange | null;
|
|
26
|
+
/**
|
|
27
|
+
* The Media Initialization Section in effect; `href` is `null` when its URI
|
|
28
|
+
* or its byte range cannot be used.
|
|
29
|
+
*/
|
|
30
|
+
readonly init: {
|
|
31
|
+
readonly href: string | null;
|
|
32
|
+
readonly byteRange: HlsResolvedByteRange | null;
|
|
33
|
+
} | null;
|
|
34
|
+
/**
|
|
35
|
+
* The keys in effect, one per `KEYFORMAT`, as plain data: nothing here
|
|
36
|
+
* fetches a key, resolves its URI or decrypts. The array is shared by
|
|
37
|
+
* consecutive segments under the same keys.
|
|
38
|
+
*/
|
|
39
|
+
readonly keys: readonly HlsKey[];
|
|
40
|
+
/** Whether any key is in effect: `keys.length > 0`. */
|
|
41
|
+
readonly encrypted: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** What {@link resolveHlsSegments} answers. */
|
|
44
|
+
export type HlsResolvedSegments = {
|
|
45
|
+
readonly segments: readonly HlsResolvedSegment[];
|
|
46
|
+
readonly warnings: readonly HlsResolveDiagnostic[];
|
|
47
|
+
};
|
|
48
|
+
/** Options of {@link resolveHlsSegments}. */
|
|
49
|
+
export type HlsResolveSegmentsOptions = {
|
|
50
|
+
/**
|
|
51
|
+
* Most key entries the view may materialise in total, 1 048 576 by default.
|
|
52
|
+
* Each change of the keys in effect copies them once, so a playlist rotating
|
|
53
|
+
* through many key formats would otherwise cost quadratic memory.
|
|
54
|
+
*/
|
|
55
|
+
readonly maxKeyScopeEntries?: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolves every segment of a media playlist against `playlistUrl`, which must
|
|
59
|
+
* be the URL after redirects (§4.1). One item that cannot be resolved gets
|
|
60
|
+
* `href: null` and a diagnostic of its own; the others are unaffected. A byte
|
|
61
|
+
* range continues the previous segment's when both resolve to the same URL.
|
|
62
|
+
*
|
|
63
|
+
* Partial segments and preload hints are not resolved. Requires a `Temporal`
|
|
64
|
+
* global. O(segments + key declarations + key entries materialised), one URL
|
|
65
|
+
* parse per URI.
|
|
66
|
+
*
|
|
67
|
+
* @throws {TypeError} When `playlistUrl` is not an absolute URL.
|
|
68
|
+
* @throws {HlsPlaylistError} `unrepresentable-value` when a Media Sequence or
|
|
69
|
+
* Discontinuity Sequence Number would pass 2^53−1 (a hand-built model; the
|
|
70
|
+
* parser rejects such playlists).
|
|
71
|
+
* @throws {HlsLimitError} `maxKeyScopeEntries`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function resolveHlsSegments(playlist: Pick<HlsMediaPlaylist, "segments" | "mediaSequence" | "discontinuitySequence" | "skip">, playlistUrl: string | URL, options?: HlsResolveSegmentsOptions): HlsResolvedSegments;
|
|
74
|
+
//# sourceMappingURL=resolve-hls-segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-hls-segments.d.ts","sourceRoot":"","sources":["../../src/resolve/resolve-hls-segments.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAEX,gBAAgB,EAChB,UAAU,EACV,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAAG;IAChC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;IAClD,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,QAAQ,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAAC;KAChD,GAAG,IAAI,CAAC;IACT;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,mBAAmB,GAAG;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACnD,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,yBAAyB,GAAG;IACvC;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACrC,CAAC;AAWF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,IAAI,CACb,gBAAgB,EAChB,UAAU,GAAG,eAAe,GAAG,uBAAuB,GAAG,MAAM,CAC/D,EACD,WAAW,EAAE,MAAM,GAAG,GAAG,EACzB,OAAO,CAAC,EAAE,yBAAyB,GACjC,mBAAmB,CA4IrB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { applyKeyTag } from "../_key-scope.js";
|
|
2
|
+
import { addSeconds } from "../_temporal.js";
|
|
3
|
+
import { HlsLimitError, HlsPlaylistError } from "../errors.js";
|
|
4
|
+
import { parseHlsDateTime } from "../parse/parse-hls-date-time.js";
|
|
5
|
+
import { baseUrl, resolveHref } from "./_href.js";
|
|
6
|
+
const DEFAULT_MAX_KEY_SCOPE_ENTRIES_ = 1048576;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves every segment of a media playlist against `playlistUrl`, which must
|
|
9
|
+
* be the URL after redirects (§4.1). One item that cannot be resolved gets
|
|
10
|
+
* `href: null` and a diagnostic of its own; the others are unaffected. A byte
|
|
11
|
+
* range continues the previous segment's when both resolve to the same URL.
|
|
12
|
+
*
|
|
13
|
+
* Partial segments and preload hints are not resolved. Requires a `Temporal`
|
|
14
|
+
* global. O(segments + key declarations + key entries materialised), one URL
|
|
15
|
+
* parse per URI.
|
|
16
|
+
*
|
|
17
|
+
* @throws {TypeError} When `playlistUrl` is not an absolute URL.
|
|
18
|
+
* @throws {HlsPlaylistError} `unrepresentable-value` when a Media Sequence or
|
|
19
|
+
* Discontinuity Sequence Number would pass 2^53−1 (a hand-built model; the
|
|
20
|
+
* parser rejects such playlists).
|
|
21
|
+
* @throws {HlsLimitError} `maxKeyScopeEntries`.
|
|
22
|
+
*/
|
|
23
|
+
export function resolveHlsSegments(playlist, playlistUrl, options) {
|
|
24
|
+
const base = baseUrl(playlistUrl);
|
|
25
|
+
const warnings = [];
|
|
26
|
+
const maxKeyEntries = options?.maxKeyScopeEntries ?? DEFAULT_MAX_KEY_SCOPE_ENTRIES_;
|
|
27
|
+
if (playlist.skip !== null) {
|
|
28
|
+
warnings.push({
|
|
29
|
+
code: "unmerged-delta-update",
|
|
30
|
+
message: "The playlist is a delta update; merge it with applyHlsDeltaUpdate first",
|
|
31
|
+
index: -1,
|
|
32
|
+
uri: null,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const firstSequence = playlist.mediaSequence + (playlist.skip?.skippedSegments ?? 0);
|
|
36
|
+
const discontinuities = playlist.segments.filter((segment) => segment.discontinuity).length;
|
|
37
|
+
if (!Number.isSafeInteger(firstSequence + Math.max(playlist.segments.length - 1, 0)) ||
|
|
38
|
+
!Number.isSafeInteger(playlist.discontinuitySequence + discontinuities)) {
|
|
39
|
+
throw new HlsPlaylistError("unrepresentable-value", "A Media Sequence or Discontinuity Sequence Number of this playlist is past 2^53-1");
|
|
40
|
+
}
|
|
41
|
+
const segments = [];
|
|
42
|
+
let discontinuitySequence = playlist.discontinuitySequence;
|
|
43
|
+
let startTime = 0;
|
|
44
|
+
let keys = [];
|
|
45
|
+
let keyEntries = 0;
|
|
46
|
+
let previous = null;
|
|
47
|
+
let previousDate = null;
|
|
48
|
+
const inits = new Map();
|
|
49
|
+
for (const [index, segment] of playlist.segments.entries()) {
|
|
50
|
+
if (segment.discontinuity) {
|
|
51
|
+
discontinuitySequence++;
|
|
52
|
+
}
|
|
53
|
+
for (const key of segment.keyTags) {
|
|
54
|
+
const next = applyKeyTag(keys, key);
|
|
55
|
+
if (next !== keys) {
|
|
56
|
+
keyEntries += next.length;
|
|
57
|
+
if (keyEntries > maxKeyEntries) {
|
|
58
|
+
throw new HlsLimitError("maxKeyScopeEntries", maxKeyEntries, 0);
|
|
59
|
+
}
|
|
60
|
+
keys = next;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
let href = resolveHref(segment.uri, base, index, warnings);
|
|
64
|
+
let byteRange = null;
|
|
65
|
+
const range = segment.byteRange;
|
|
66
|
+
if (range !== null) {
|
|
67
|
+
let offset = range.offset;
|
|
68
|
+
if (offset === null) {
|
|
69
|
+
const sameResource = previous !== null &&
|
|
70
|
+
previous.byteRange !== null &&
|
|
71
|
+
(previous.href !== null && href !== null
|
|
72
|
+
? previous.href === href
|
|
73
|
+
: previous.segment.uri === segment.uri);
|
|
74
|
+
if (sameResource) {
|
|
75
|
+
offset = previous.byteRange.offset + previous.byteRange.length;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
warnings.push({
|
|
79
|
+
code: "byterange-without-previous",
|
|
80
|
+
message: `Segment ${index} continues a byte range with no previous sub-range of "${segment.uri}"`,
|
|
81
|
+
index,
|
|
82
|
+
uri: segment.uri,
|
|
83
|
+
});
|
|
84
|
+
href = null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (offset !== null) {
|
|
88
|
+
byteRange = checkedRange_(offset, range.length);
|
|
89
|
+
if (byteRange === null) {
|
|
90
|
+
warnings.push({
|
|
91
|
+
code: "invalid-byte-range",
|
|
92
|
+
message: `Segment ${index}'s byte range ends past 2^53-1`,
|
|
93
|
+
index,
|
|
94
|
+
uri: segment.uri,
|
|
95
|
+
});
|
|
96
|
+
href = null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let programDateTime = null;
|
|
101
|
+
if (segment.programDateTime !== null) {
|
|
102
|
+
programDateTime = parseHlsDateTime(segment.programDateTime);
|
|
103
|
+
}
|
|
104
|
+
else if (previousDate !== null &&
|
|
105
|
+
previous !== null &&
|
|
106
|
+
!segment.discontinuity) {
|
|
107
|
+
programDateTime = addSeconds(previousDate, previous.segment.duration);
|
|
108
|
+
}
|
|
109
|
+
let init = null;
|
|
110
|
+
if (segment.map !== null) {
|
|
111
|
+
let resolved = inits.get(segment.map);
|
|
112
|
+
if (resolved === undefined) {
|
|
113
|
+
resolved = resolveInit_(segment.map, base);
|
|
114
|
+
inits.set(segment.map, resolved);
|
|
115
|
+
}
|
|
116
|
+
if (resolved.problem !== null) {
|
|
117
|
+
warnings.push({ ...resolved.problem, index });
|
|
118
|
+
}
|
|
119
|
+
init = { href: resolved.href, byteRange: resolved.byteRange };
|
|
120
|
+
}
|
|
121
|
+
segments.push({
|
|
122
|
+
segment,
|
|
123
|
+
href,
|
|
124
|
+
mediaSequence: firstSequence + index,
|
|
125
|
+
discontinuitySequence,
|
|
126
|
+
startTime,
|
|
127
|
+
programDateTime,
|
|
128
|
+
byteRange,
|
|
129
|
+
init,
|
|
130
|
+
keys,
|
|
131
|
+
encrypted: keys.length > 0,
|
|
132
|
+
});
|
|
133
|
+
startTime += segment.duration;
|
|
134
|
+
previous = { segment, href, byteRange };
|
|
135
|
+
previousDate = programDateTime;
|
|
136
|
+
}
|
|
137
|
+
return { segments, warnings };
|
|
138
|
+
}
|
|
139
|
+
function resolveInit_(map, base) {
|
|
140
|
+
const problems = [];
|
|
141
|
+
const href = resolveHref(map.uri, base, 0, problems);
|
|
142
|
+
if (problems.length > 0) {
|
|
143
|
+
return {
|
|
144
|
+
href: null,
|
|
145
|
+
byteRange: null,
|
|
146
|
+
problem: {
|
|
147
|
+
code: "invalid-uri",
|
|
148
|
+
message: problems[0].message,
|
|
149
|
+
uri: map.uri,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
const unreadable = map.unknownAttributes.some((attribute) => attribute.name === "BYTERANGE");
|
|
154
|
+
const byteRange = map.byteRange === null
|
|
155
|
+
? null
|
|
156
|
+
: checkedRange_(map.byteRange.offset, map.byteRange.length);
|
|
157
|
+
if (unreadable || (map.byteRange !== null && byteRange === null)) {
|
|
158
|
+
return {
|
|
159
|
+
href: null,
|
|
160
|
+
byteRange: null,
|
|
161
|
+
problem: {
|
|
162
|
+
code: "invalid-byte-range",
|
|
163
|
+
message: `The BYTERANGE of initialization section "${map.uri}" cannot be used`,
|
|
164
|
+
uri: map.uri,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return { href, byteRange, problem: null };
|
|
169
|
+
}
|
|
170
|
+
/** `{ offset, length }` when its inclusive end is at most 2^53−1. */
|
|
171
|
+
function checkedRange_(offset, length) {
|
|
172
|
+
if (!Number.isSafeInteger(offset) ||
|
|
173
|
+
!Number.isSafeInteger(length) ||
|
|
174
|
+
length - 1 > Number.MAX_SAFE_INTEGER - offset) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return { offset, length };
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=resolve-hls-segments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-hls-segments.js","sourceRoot":"","sources":["../../src/resolve/resolve-hls-segments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAO/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAA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C,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;QAC7B,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;QAC7B,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,gBAAgB,GAAG,MAAM,EAC5C,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { HlsKey } from "../model/hls-key.js";
|
|
2
|
+
import type { HlsContentSteering, HlsIFrameVariant, HlsMultivariantPlaylist, HlsRendition, HlsSessionData, HlsVariant } from "../model/hls-multivariant-playlist.js";
|
|
3
|
+
import type { HlsResolveDiagnostic } from "./hls-resolve-diagnostic.js";
|
|
4
|
+
/** The pathway a variant with no `PATHWAY-ID` belongs to (§4.4.6.2). */
|
|
5
|
+
export declare const HLS_DEFAULT_PATHWAY_ID = ".";
|
|
6
|
+
/** Options of {@link resolveHlsVariants}. */
|
|
7
|
+
export type HlsResolveVariantsOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Drop what §6.3.1 tells a client to ignore: a variant, I-frame variant or
|
|
10
|
+
* rendition with an unrecognized `REQ-` attribute or an enumerated value it
|
|
11
|
+
* does not recognize. `false` by default: everything is kept and flagged with
|
|
12
|
+
* `supported`.
|
|
13
|
+
*/
|
|
14
|
+
readonly skipUnsupported?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Keep only the variants and I-frame variants of this Content Steering
|
|
17
|
+
* pathway (§7); every pathway by default.
|
|
18
|
+
*/
|
|
19
|
+
readonly pathwayId?: string;
|
|
20
|
+
};
|
|
21
|
+
/** An `EXT-X-MEDIA` with its URI resolved. */
|
|
22
|
+
export type HlsResolvedRendition = {
|
|
23
|
+
readonly rendition: HlsRendition;
|
|
24
|
+
/** `null` when the rendition has no URI, or it does not resolve. */
|
|
25
|
+
readonly href: string | null;
|
|
26
|
+
/** `false` when §6.3.1 tells a client to ignore the rendition. */
|
|
27
|
+
readonly supported: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A referenced group with no usable rendition: no matching type or unknown type
|
|
31
|
+
* declares the group ID (`absent`), or only unsupported renditions declare it
|
|
32
|
+
* (`unsupported`).
|
|
33
|
+
*/
|
|
34
|
+
export type HlsUnresolvedGroup = {
|
|
35
|
+
readonly type: "AUDIO" | "VIDEO" | "SUBTITLES" | "CLOSED-CAPTIONS";
|
|
36
|
+
readonly groupId: string;
|
|
37
|
+
readonly reason: "absent" | "unsupported";
|
|
38
|
+
};
|
|
39
|
+
/** Fields both kinds of resolved variant carry. */
|
|
40
|
+
export type HlsResolvedVariantBase = {
|
|
41
|
+
/** Absolute URL; `null` when it does not resolve (see `warnings`). */
|
|
42
|
+
readonly href: string | null;
|
|
43
|
+
/** `PATHWAY-ID`, or {@link HLS_DEFAULT_PATHWAY_ID}. */
|
|
44
|
+
readonly pathwayId: string;
|
|
45
|
+
/** `false` when §6.3.1 tells a client to ignore the variant. */
|
|
46
|
+
readonly supported: boolean;
|
|
47
|
+
/** Members of the `VIDEO` group, in playlist order. */
|
|
48
|
+
readonly video: readonly HlsResolvedRendition[];
|
|
49
|
+
/** Referenced groups with no usable member, in attribute order. */
|
|
50
|
+
readonly unresolvedGroups: readonly HlsUnresolvedGroup[];
|
|
51
|
+
};
|
|
52
|
+
/** An `EXT-X-STREAM-INF` joined to its rendition groups. */
|
|
53
|
+
export type HlsResolvedVariant = HlsResolvedVariantBase & {
|
|
54
|
+
readonly variant: HlsVariant;
|
|
55
|
+
/**
|
|
56
|
+
* Members of the `AUDIO` group, in playlist order; empty with no reference or
|
|
57
|
+
* an unknown group. The same for the other groups.
|
|
58
|
+
*/
|
|
59
|
+
readonly audio: readonly HlsResolvedRendition[];
|
|
60
|
+
readonly subtitles: readonly HlsResolvedRendition[];
|
|
61
|
+
readonly closedCaptions: readonly HlsResolvedRendition[];
|
|
62
|
+
};
|
|
63
|
+
/** An `EXT-X-I-FRAME-STREAM-INF` joined to its `VIDEO` group. */
|
|
64
|
+
export type HlsResolvedIFrameVariant = HlsResolvedVariantBase & {
|
|
65
|
+
readonly variant: HlsIFrameVariant;
|
|
66
|
+
};
|
|
67
|
+
/** An `EXT-X-SESSION-DATA` with its URI resolved. */
|
|
68
|
+
export type HlsResolvedSessionData = {
|
|
69
|
+
readonly sessionData: HlsSessionData;
|
|
70
|
+
readonly href: string | null;
|
|
71
|
+
};
|
|
72
|
+
/** What {@link resolveHlsVariants} answers. */
|
|
73
|
+
export type HlsResolvedMultivariant = {
|
|
74
|
+
readonly variants: readonly HlsResolvedVariant[];
|
|
75
|
+
readonly iFrameVariants: readonly HlsResolvedIFrameVariant[];
|
|
76
|
+
readonly renditions: readonly HlsResolvedRendition[];
|
|
77
|
+
readonly sessionData: readonly HlsResolvedSessionData[];
|
|
78
|
+
/**
|
|
79
|
+
* `EXT-X-SESSION-KEY`s as plain data, so a caller can tell an encrypted
|
|
80
|
+
* presentation up front. Their URIs are deliberately not resolved.
|
|
81
|
+
*/
|
|
82
|
+
readonly sessionKeys: readonly HlsKey[];
|
|
83
|
+
/**
|
|
84
|
+
* Every pathway of the playlist, in order of first appearance, before
|
|
85
|
+
* filtering.
|
|
86
|
+
*/
|
|
87
|
+
readonly pathways: readonly string[];
|
|
88
|
+
/** `EXT-X-CONTENT-STEERING` with the steering manifest URL resolved. */
|
|
89
|
+
readonly contentSteering: (HlsContentSteering & {
|
|
90
|
+
readonly href: string | null;
|
|
91
|
+
}) | null;
|
|
92
|
+
readonly warnings: readonly HlsResolveDiagnostic[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Joins each variant to its rendition groups and resolves every URI against
|
|
96
|
+
* `playlistUrl`, the URL after redirects. One item that cannot be resolved gets
|
|
97
|
+
* `href: null` and a diagnostic; the others are unaffected.
|
|
98
|
+
*
|
|
99
|
+
* O(variants + renditions), one URL parse per URI. Each variant's group lists
|
|
100
|
+
* are shared between variants naming the same group.
|
|
101
|
+
*
|
|
102
|
+
* @throws {TypeError} When `playlistUrl` is not an absolute URL.
|
|
103
|
+
*/
|
|
104
|
+
export declare function resolveHlsVariants(playlist: Pick<HlsMultivariantPlaylist, "variants" | "iFrameVariants" | "renditions" | "sessionData" | "sessionKeys" | "contentSteering">, playlistUrl: string | URL, options?: HlsResolveVariantsOptions): HlsResolvedMultivariant;
|
|
105
|
+
//# sourceMappingURL=resolve-hls-variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-hls-variants.d.ts","sourceRoot":"","sources":["../../src/resolve/resolve-hls-variants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EACX,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,MAAM,uCAAuC,CAAC;AAE/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,6CAA6C;AAC7C,MAAM,MAAM,yBAAyB,GAAG;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,8CAA8C;AAC9C,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW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,CAAC,cAAc,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC7D,QAAQ,CAAC,UAAU,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACxD;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,wEAAwE;IACxE,QAAQ,CAAC,eAAe,EACrB,CAAC,kBAAkB,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,GACvD,IAAI,CAAC;IACR,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACnD,CAAC;AAcF;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,IAAI,CACb,uBAAuB,EACrB,UAAU,GACV,gBAAgB,GAChB,YAAY,GACZ,aAAa,GACb,aAAa,GACb,iBAAiB,CACnB,EACD,WAAW,EAAE,MAAM,GAAG,GAAG,EACzB,OAAO,CAAC,EAAE,yBAAyB,GACjC,uBAAuB,CAwJzB"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { baseUrl, resolveHref } from "./_href.js";
|
|
2
|
+
/** The pathway a variant with no `PATHWAY-ID` belongs to (§4.4.6.2). */
|
|
3
|
+
export const HLS_DEFAULT_PATHWAY_ID = ".";
|
|
4
|
+
const VARIANT_ENUMERATED_ = new Set([
|
|
5
|
+
"HDCP-LEVEL",
|
|
6
|
+
"VIDEO-RANGE",
|
|
7
|
+
"CLOSED-CAPTIONS",
|
|
8
|
+
]);
|
|
9
|
+
const RENDITION_ENUMERATED_ = new Set([
|
|
10
|
+
"TYPE",
|
|
11
|
+
"DEFAULT",
|
|
12
|
+
"AUTOSELECT",
|
|
13
|
+
"FORCED",
|
|
14
|
+
]);
|
|
15
|
+
/**
|
|
16
|
+
* Joins each variant to its rendition groups and resolves every URI against
|
|
17
|
+
* `playlistUrl`, the URL after redirects. One item that cannot be resolved gets
|
|
18
|
+
* `href: null` and a diagnostic; the others are unaffected.
|
|
19
|
+
*
|
|
20
|
+
* O(variants + renditions), one URL parse per URI. Each variant's group lists
|
|
21
|
+
* are shared between variants naming the same group.
|
|
22
|
+
*
|
|
23
|
+
* @throws {TypeError} When `playlistUrl` is not an absolute URL.
|
|
24
|
+
*/
|
|
25
|
+
export function resolveHlsVariants(playlist, playlistUrl, options) {
|
|
26
|
+
const base = baseUrl(playlistUrl);
|
|
27
|
+
const skipUnsupported = options?.skipUnsupported === true;
|
|
28
|
+
const pathwayFilter = options?.pathwayId;
|
|
29
|
+
const warnings = [];
|
|
30
|
+
const renditions = [];
|
|
31
|
+
const groups = new Map();
|
|
32
|
+
const supportedCount = new Map();
|
|
33
|
+
const unknownTypeGroups = new Set();
|
|
34
|
+
for (const [index, rendition] of playlist.renditions.entries()) {
|
|
35
|
+
const resolved = {
|
|
36
|
+
rendition,
|
|
37
|
+
href: rendition.uri === null
|
|
38
|
+
? null
|
|
39
|
+
: resolveHref(rendition.uri, base, index, warnings),
|
|
40
|
+
supported: rendition.type !== null &&
|
|
41
|
+
!isIgnorable_(rendition.unknownAttributes, RENDITION_ENUMERATED_),
|
|
42
|
+
};
|
|
43
|
+
if (rendition.type === null) {
|
|
44
|
+
unknownTypeGroups.add(rendition.groupId);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const key = groupKey_(rendition.type, rendition.groupId);
|
|
48
|
+
supportedCount.set(key, (supportedCount.get(key) ?? 0) + (resolved.supported ? 1 : 0));
|
|
49
|
+
if (!skipUnsupported || resolved.supported) {
|
|
50
|
+
const members = groups.get(key);
|
|
51
|
+
if (members === undefined) {
|
|
52
|
+
groups.set(key, [resolved]);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
members.push(resolved);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!skipUnsupported || resolved.supported) {
|
|
60
|
+
renditions.push(resolved);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const join = (type, groupId, unresolved) => {
|
|
64
|
+
if (groupId === null) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const key = groupKey_(type, groupId);
|
|
68
|
+
const supported = supportedCount.get(key);
|
|
69
|
+
if (!supported) {
|
|
70
|
+
unresolved.push({
|
|
71
|
+
type,
|
|
72
|
+
groupId,
|
|
73
|
+
reason: supported === 0 || unknownTypeGroups.has(groupId)
|
|
74
|
+
? "unsupported"
|
|
75
|
+
: "absent",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return groups.get(key) ?? [];
|
|
79
|
+
};
|
|
80
|
+
const pathways = [];
|
|
81
|
+
const seenPathways = new Set();
|
|
82
|
+
const pathwayOf = (pathwayId) => {
|
|
83
|
+
const pathway = pathwayId ?? HLS_DEFAULT_PATHWAY_ID;
|
|
84
|
+
if (!seenPathways.has(pathway)) {
|
|
85
|
+
seenPathways.add(pathway);
|
|
86
|
+
pathways.push(pathway);
|
|
87
|
+
}
|
|
88
|
+
return pathway;
|
|
89
|
+
};
|
|
90
|
+
const keep = (pathway, supported) => (pathwayFilter === undefined || pathway === pathwayFilter) &&
|
|
91
|
+
(supported || !skipUnsupported);
|
|
92
|
+
const variants = [];
|
|
93
|
+
for (const [index, variant] of playlist.variants.entries()) {
|
|
94
|
+
const pathwayId = pathwayOf(variant.pathwayId);
|
|
95
|
+
const supported = !isIgnorable_(variant.unknownAttributes, VARIANT_ENUMERATED_);
|
|
96
|
+
if (!keep(pathwayId, supported)) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const captions = variant.closedCaptions;
|
|
100
|
+
const unresolvedGroups = [];
|
|
101
|
+
variants.push({
|
|
102
|
+
variant,
|
|
103
|
+
href: resolveHref(variant.uri, base, index, warnings),
|
|
104
|
+
pathwayId,
|
|
105
|
+
supported,
|
|
106
|
+
audio: join("AUDIO", variant.audio, unresolvedGroups),
|
|
107
|
+
video: join("VIDEO", variant.video, unresolvedGroups),
|
|
108
|
+
subtitles: join("SUBTITLES", variant.subtitles, unresolvedGroups),
|
|
109
|
+
closedCaptions: join("CLOSED-CAPTIONS", captions === null || captions === "NONE" ? null : captions.groupId, unresolvedGroups),
|
|
110
|
+
unresolvedGroups,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const iFrameVariants = [];
|
|
114
|
+
for (const [index, variant] of playlist.iFrameVariants.entries()) {
|
|
115
|
+
const pathwayId = pathwayOf(variant.pathwayId);
|
|
116
|
+
const supported = !isIgnorable_(variant.unknownAttributes, VARIANT_ENUMERATED_);
|
|
117
|
+
if (!keep(pathwayId, supported)) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const unresolvedGroups = [];
|
|
121
|
+
iFrameVariants.push({
|
|
122
|
+
variant,
|
|
123
|
+
href: resolveHref(variant.uri, base, index, warnings),
|
|
124
|
+
pathwayId,
|
|
125
|
+
supported,
|
|
126
|
+
video: join("VIDEO", variant.video, unresolvedGroups),
|
|
127
|
+
unresolvedGroups,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const sessionData = playlist.sessionData.map((data, index) => ({
|
|
131
|
+
sessionData: data,
|
|
132
|
+
href: data.uri === null ? null : resolveHref(data.uri, base, index, warnings),
|
|
133
|
+
}));
|
|
134
|
+
const steering = playlist.contentSteering;
|
|
135
|
+
return {
|
|
136
|
+
variants,
|
|
137
|
+
iFrameVariants,
|
|
138
|
+
renditions,
|
|
139
|
+
sessionData,
|
|
140
|
+
sessionKeys: playlist.sessionKeys,
|
|
141
|
+
pathways,
|
|
142
|
+
contentSteering: steering === null
|
|
143
|
+
? null
|
|
144
|
+
: {
|
|
145
|
+
...steering,
|
|
146
|
+
href: resolveHref(steering.serverUri, base, 0, warnings),
|
|
147
|
+
},
|
|
148
|
+
warnings,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function groupKey_(type, groupId) {
|
|
152
|
+
return `${type}\u0000${groupId}`;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Whether §6.3.1 tells a client to ignore the tag: an unrecognized `REQ-`
|
|
156
|
+
* attribute, or a recognized enumerated attribute whose value the parser did
|
|
157
|
+
* not recognize — both of which the parser keeps in `unknownAttributes`.
|
|
158
|
+
*/
|
|
159
|
+
function isIgnorable_(unknownAttributes, enumerated) {
|
|
160
|
+
return unknownAttributes.some((attribute) => attribute.name.startsWith("REQ-") || enumerated.has(attribute.name));
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=resolve-hls-variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-hls-variants.js","sourceRoot":"","sources":["../../src/resolve/resolve-hls-variants.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGlD,wEAAwE;AACxE,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAkG1C,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACnC,YAAY;IACZ,aAAa;IACb,iBAAiB;CACjB,CAAC,CAAC;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACrC,MAAM;IACN,SAAS;IACT,YAAY;IACZ,QAAQ;CACR,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CACjC,QAQC,EACD,WAAyB,EACzB,OAAmC;IAEnC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAClC,MAAM,eAAe,GAAG,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1D,MAAM,aAAa,GAAG,OAAO,EAAE,SAAS,CAAC;IACzC,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAE5C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,M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E,QAAQ,CAAC,WAAW;QACjC,QAAQ;QACR,eAAe,EACd,QAAQ,KAAK,IAAI;YAChB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC;gBACA,GAAG,QAAQ;gBACX,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC;aACxD;QACJ,QAAQ;KACR,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,OAAe;IAC/C,OAAO,GAAG,IAAI,SAAS,OAAO,EAAE,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CACpB,iBAA0C,EAC1C,UAA+B;IAE/B,OAAO,iBAAiB,CAAC,IAAI,CAC5B,CAAC,SAAS,EAAE,EAAE,CACb,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CACpE,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/format-hls",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "HLS playlists (RFC 8216 and its successor draft): parse, model, resolve and print.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hls",
|
|
7
|
+
"m3u8",
|
|
8
|
+
"playlist",
|
|
9
|
+
"streaming"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://anthochamp.pages.grenadine.io/node-essentials/api/format-hls/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://git.grenadine.io/anthochamp/node-essentials/issues"
|
|
14
|
+
},
|
|
15
|
+
"license": "BSD-3-Clause",
|
|
16
|
+
"author": "Anthony Champagne <dev@anthonychampagne.fr>",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://git.grenadine.io/anthochamp/node-essentials.git",
|
|
20
|
+
"directory": "packages/format-hls"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"compile": "tsc -p ./tsconfig.build.json -outDir dist",
|
|
40
|
+
"compile:check": "tsc -noEmit -p ./tsconfig.json",
|
|
41
|
+
"clean": "rimraf dist",
|
|
42
|
+
"build": "yarn clean && yarn compile",
|
|
43
|
+
"test": "yarn run -T vitest run",
|
|
44
|
+
"prepack": "yarn build"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@ac-kit/core": "^0.10.0",
|
|
48
|
+
"@ac-kit/format-core": "^0.4.0",
|
|
49
|
+
"@ac-kit/math-numbers": "^0.2.7",
|
|
50
|
+
"@types/web": "^0.0.367"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@ac-kit/math-random": "0.2.0",
|
|
54
|
+
"@ac-kit/test-util": "0.3.0",
|
|
55
|
+
"@ac-kit/tsconfig": "0.1.0",
|
|
56
|
+
"@ac-kit/typedoc-config": "0.1.0",
|
|
57
|
+
"@ac-kit/vitest-config": "0.1.1",
|
|
58
|
+
"@typescript/native": "typescript@7.0.2",
|
|
59
|
+
"rimraf": "6.1.4",
|
|
60
|
+
"typedoc": "0.28.20",
|
|
61
|
+
"typescript": "@typescript/typescript6@6.0.2"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=24"
|
|
65
|
+
}
|
|
6
66
|
}
|