@amazon/vinyl-hls-parser 1.1.1 → 1.2.1
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/dist/hlsTestAssets/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs +8 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +9 -2
- package/dist/index.js.map +3 -3
- package/dist/test/benchmark.es5.js +56 -248
- package/dist/test/benchmark.js +164 -972
- package/dist/test/benchmark.js.map +4 -4
- package/dist/types/current/parse/parseMainPlaylist.d.ts.map +1 -1
- package/dist/types/current/parse/parseMainPlaylist.js +16 -2
- package/dist/types/current/parse/parseMediaPlaylist.d.ts.map +1 -1
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/current/types/HlsDateRange.d.ts +51 -0
- package/dist/types/current/types/HlsDateRange.d.ts.map +1 -0
- package/dist/types/current/types/HlsDateRange.js +11 -0
- package/dist/types/current/types/HlsMainPlaylist.d.ts +22 -0
- package/dist/types/current/types/HlsMainPlaylist.d.ts.map +1 -0
- package/dist/types/current/types/HlsMainPlaylist.js +5 -0
- package/dist/types/current/types/HlsMediaPlaylist.d.ts +32 -0
- package/dist/types/current/types/HlsMediaPlaylist.d.ts.map +1 -0
- package/dist/types/current/types/HlsMediaPlaylist.js +5 -0
- package/dist/types/ts3.7/types/HlsDateRange.d.ts +51 -0
- package/dist/types/ts3.7/types/HlsMainPlaylist.d.ts +22 -0
- package/dist/types/ts3.7/types/HlsMediaPlaylist.d.ts +32 -0
- package/dist/types/ts4.1/types/HlsDateRange.d.ts +51 -0
- package/dist/types/ts4.1/types/HlsMainPlaylist.d.ts +22 -0
- package/dist/types/ts4.1/types/HlsMediaPlaylist.d.ts +32 -0
- package/dist/types/ts4.7/types/HlsDateRange.d.ts +51 -0
- package/dist/types/ts4.7/types/HlsMainPlaylist.d.ts +22 -0
- package/dist/types/ts4.7/types/HlsMediaPlaylist.d.ts +32 -0
- package/package.json +24 -14
- package/dist/test/benchmark.css +0 -71
- package/dist/test/benchmark.html +0 -67
- package/dist/test/favicon.png +0 -0
- package/dist/test/index.html +0 -61
- package/dist/test/integ.es5.js +0 -410
- package/dist/test/integ.js +0 -2127
- package/dist/test/integ.js.map +0 -7
- package/dist/test/jasmine.css +0 -304
- package/dist/test/jasmineHtml.es5.js +0 -670
- package/dist/test/jasmineHtml.js +0 -10851
- package/dist/test/jasmineHtml.js.map +0 -7
- package/dist/test/styles.css +0 -42
- package/dist/unit/types/current/index.d.ts +0 -7
- package/dist/unit/types/current/index.d.ts.map +0 -1
- package/dist/unit/types/current/index.js +0 -6
- package/dist/unit/types/current/parse/parseAttributes.test.d.ts +0 -2
- package/dist/unit/types/current/parse/parseAttributes.test.d.ts.map +0 -1
- package/dist/unit/types/current/parse/parseAttributes.test.js +0 -70
- package/dist/unit/types/current/parse/parseMainPlaylist.test.d.ts +0 -2
- package/dist/unit/types/current/parse/parseMainPlaylist.test.d.ts.map +0 -1
- package/dist/unit/types/current/parse/parseMainPlaylist.test.js +0 -194
- package/dist/unit/types/current/parse/parseMediaPlaylist.test.d.ts +0 -2
- package/dist/unit/types/current/parse/parseMediaPlaylist.test.d.ts.map +0 -1
- package/dist/unit/types/current/parse/parseMediaPlaylist.test.js +0 -401
- package/dist/unit/types/current/parse/parseUtil.test.d.ts +0 -2
- package/dist/unit/types/current/parse/parseUtil.test.d.ts.map +0 -1
- package/dist/unit/types/current/parse/parseUtil.test.js +0 -67
- package/dist/unit/types/current/setup.d.ts +0 -2
- package/dist/unit/types/current/setup.d.ts.map +0 -1
- package/dist/unit/types/current/setup.js +0 -19
- package/dist/unit/types/current/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLASS value that identifies an {@link HlsDateRange} as an HLS Interstitial,
|
|
3
|
+
* the server-guided ad insertion (SGAI) primitive defined by Apple.
|
|
4
|
+
*
|
|
5
|
+
* @see https://developer.apple.com/streaming/GettingStartedWithHLSInterstitials.pdf
|
|
6
|
+
*/
|
|
7
|
+
export declare const HLS_INTERSTITIAL_CLASS = "com.apple.hls.interstitial";
|
|
8
|
+
/**
|
|
9
|
+
* A parsed EXT-X-DATERANGE tag from an HLS Media Playlist (RFC 8216 §4.3.2.7).
|
|
10
|
+
*
|
|
11
|
+
* A Date Range associates a span of the media timeline, anchored to a wall-clock
|
|
12
|
+
* START-DATE, with a set of application-defined attributes. It is the transport
|
|
13
|
+
* for HLS Interstitials (SGAI): an interstitial is a Date Range whose
|
|
14
|
+
* {@link classId} is {@link HLS_INTERSTITIAL_CLASS} and which carries the
|
|
15
|
+
* `X-ASSET-URI` or `X-ASSET-LIST` client attributes describing the ad content.
|
|
16
|
+
*
|
|
17
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.7
|
|
18
|
+
*/
|
|
19
|
+
export interface HlsDateRange {
|
|
20
|
+
/** A unique identifier for this Date Range within the playlist (ID). */
|
|
21
|
+
readonly id: string;
|
|
22
|
+
/** The `CLASS` attribute, a client-defined category for the range, if present. */
|
|
23
|
+
readonly classId?: string;
|
|
24
|
+
/** The ISO-8601 wall-clock time at which the range begins (START-DATE). */
|
|
25
|
+
readonly startDate: string;
|
|
26
|
+
/** The ISO-8601 wall-clock time at which the range ends (END-DATE), if present. */
|
|
27
|
+
readonly endDate?: string;
|
|
28
|
+
/** The duration of the range in seconds (DURATION), if present. */
|
|
29
|
+
readonly duration?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The expected duration of the Date Range in seconds.
|
|
32
|
+
* This attribute SHOULD be used to indicate the expected duration of a Date Range whose actual
|
|
33
|
+
* duration is not yet known.
|
|
34
|
+
* It must be positive.
|
|
35
|
+
*/
|
|
36
|
+
readonly plannedDuration?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the END-DATE of a live range equals the START-DATE of the
|
|
39
|
+
* range that follows it (END-ON-NEXT=YES). Ranges with this flag must
|
|
40
|
+
* carry a {@link classId} and omit {@link duration} and {@link endDate}.
|
|
41
|
+
*/
|
|
42
|
+
readonly endOnNext?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The client-defined `X-` attributes of the range, keyed by their full
|
|
45
|
+
* attribute name (e.g. `X-ASSET-URI`). Values are the raw parsed strings
|
|
46
|
+
* with surrounding quotes removed. Numeric and hex `X-` attributes are
|
|
47
|
+
* kept verbatim so callers can interpret them per their own schema.
|
|
48
|
+
*/
|
|
49
|
+
readonly clientAttributes: Readonly<Record<string, string>>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=HlsDateRange.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AlternativeRendition } from './AlternativeRendition';
|
|
2
|
+
import { SessionData } from './SessionData';
|
|
3
|
+
import { VariantStream } from './VariantStream';
|
|
4
|
+
/**
|
|
5
|
+
* A parsed HLS Main Playlist (also called Multivariant Playlist) as defined by RFC 8216.
|
|
6
|
+
*
|
|
7
|
+
* A Main Playlist provides a set of variant streams, each representing the same content at
|
|
8
|
+
* different bitrates or resolutions, along with alternative renditions and session-level metadata.
|
|
9
|
+
*
|
|
10
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4
|
|
11
|
+
*/
|
|
12
|
+
export interface HlsMainPlaylist {
|
|
13
|
+
/** The variant streams available in this presentation (EXT-X-STREAM-INF). */
|
|
14
|
+
readonly variants: readonly VariantStream[];
|
|
15
|
+
/** Alternative renditions such as additional audio languages or subtitles (EXT-X-MEDIA). */
|
|
16
|
+
readonly alternativeRenditions: readonly AlternativeRendition[];
|
|
17
|
+
/** Session-level key/value metadata (EXT-X-SESSION-DATA). */
|
|
18
|
+
readonly sessionData: readonly SessionData[];
|
|
19
|
+
/** Variables defined via EXT-X-DEFINE. Keys are variable names, values are their resolved values. */
|
|
20
|
+
readonly defines?: Readonly<Record<string, string>>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=HlsMainPlaylist.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HlsDateRange } from './HlsDateRange';
|
|
2
|
+
import { HlsSegment } from './HlsSegment';
|
|
3
|
+
/**
|
|
4
|
+
* A parsed HLS Media Playlist as defined by RFC 8216.
|
|
5
|
+
*
|
|
6
|
+
* A Media Playlist contains a list of media segments that, when played sequentially, form a continuous stream.
|
|
7
|
+
*
|
|
8
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4
|
|
9
|
+
*/
|
|
10
|
+
export interface HlsMediaPlaylist {
|
|
11
|
+
/** The HLS protocol version required by this playlist (EXT-X-VERSION). */
|
|
12
|
+
readonly version: number;
|
|
13
|
+
/** The upper bound on the duration of any segment in the playlist, in seconds (EXT-X-TARGETDURATION). */
|
|
14
|
+
readonly targetDuration: number;
|
|
15
|
+
/** The sequence number of the first segment in the playlist (EXT-X-MEDIA-SEQUENCE). */
|
|
16
|
+
readonly mediaSequence: number;
|
|
17
|
+
/** The mutability type of the playlist: VOD (static), EVENT (append-only), or LIVE (sliding window). */
|
|
18
|
+
readonly playlistType: HlsMediaPlaylistType;
|
|
19
|
+
/** Whether the playlist is complete, indicated by the presence of EXT-X-ENDLIST. */
|
|
20
|
+
readonly ended: boolean;
|
|
21
|
+
/** The ordered list of media segments in this playlist. */
|
|
22
|
+
readonly segments: readonly HlsSegment[];
|
|
23
|
+
/**
|
|
24
|
+
* The Date Ranges declared in this playlist (EXT-X-DATERANGE), in the order
|
|
25
|
+
* they appear. HLS Interstitials (SGAI ad breaks) are carried as Date Ranges
|
|
26
|
+
* whose classId is `com.apple.hls.interstitial`.
|
|
27
|
+
*/
|
|
28
|
+
readonly dateRanges: readonly HlsDateRange[];
|
|
29
|
+
}
|
|
30
|
+
/** The mutability type of Media Playlist. */
|
|
31
|
+
export type HlsMediaPlaylistType = 'VOD' | 'EVENT' | 'LIVE';
|
|
32
|
+
//# sourceMappingURL=HlsMediaPlaylist.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLASS value that identifies an {@link HlsDateRange} as an HLS Interstitial,
|
|
3
|
+
* the server-guided ad insertion (SGAI) primitive defined by Apple.
|
|
4
|
+
*
|
|
5
|
+
* @see https://developer.apple.com/streaming/GettingStartedWithHLSInterstitials.pdf
|
|
6
|
+
*/
|
|
7
|
+
export declare const HLS_INTERSTITIAL_CLASS = "com.apple.hls.interstitial";
|
|
8
|
+
/**
|
|
9
|
+
* A parsed EXT-X-DATERANGE tag from an HLS Media Playlist (RFC 8216 §4.3.2.7).
|
|
10
|
+
*
|
|
11
|
+
* A Date Range associates a span of the media timeline, anchored to a wall-clock
|
|
12
|
+
* START-DATE, with a set of application-defined attributes. It is the transport
|
|
13
|
+
* for HLS Interstitials (SGAI): an interstitial is a Date Range whose
|
|
14
|
+
* {@link classId} is {@link HLS_INTERSTITIAL_CLASS} and which carries the
|
|
15
|
+
* `X-ASSET-URI` or `X-ASSET-LIST` client attributes describing the ad content.
|
|
16
|
+
*
|
|
17
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.7
|
|
18
|
+
*/
|
|
19
|
+
export interface HlsDateRange {
|
|
20
|
+
/** A unique identifier for this Date Range within the playlist (ID). */
|
|
21
|
+
readonly id: string;
|
|
22
|
+
/** The `CLASS` attribute, a client-defined category for the range, if present. */
|
|
23
|
+
readonly classId?: string;
|
|
24
|
+
/** The ISO-8601 wall-clock time at which the range begins (START-DATE). */
|
|
25
|
+
readonly startDate: string;
|
|
26
|
+
/** The ISO-8601 wall-clock time at which the range ends (END-DATE), if present. */
|
|
27
|
+
readonly endDate?: string;
|
|
28
|
+
/** The duration of the range in seconds (DURATION), if present. */
|
|
29
|
+
readonly duration?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The expected duration of the Date Range in seconds.
|
|
32
|
+
* This attribute SHOULD be used to indicate the expected duration of a Date Range whose actual
|
|
33
|
+
* duration is not yet known.
|
|
34
|
+
* It must be positive.
|
|
35
|
+
*/
|
|
36
|
+
readonly plannedDuration?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the END-DATE of a live range equals the START-DATE of the
|
|
39
|
+
* range that follows it (END-ON-NEXT=YES). Ranges with this flag must
|
|
40
|
+
* carry a {@link classId} and omit {@link duration} and {@link endDate}.
|
|
41
|
+
*/
|
|
42
|
+
readonly endOnNext?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The client-defined `X-` attributes of the range, keyed by their full
|
|
45
|
+
* attribute name (e.g. `X-ASSET-URI`). Values are the raw parsed strings
|
|
46
|
+
* with surrounding quotes removed. Numeric and hex `X-` attributes are
|
|
47
|
+
* kept verbatim so callers can interpret them per their own schema.
|
|
48
|
+
*/
|
|
49
|
+
readonly clientAttributes: Readonly<Record<string, string>>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=HlsDateRange.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AlternativeRendition } from './AlternativeRendition';
|
|
2
|
+
import type { SessionData } from './SessionData';
|
|
3
|
+
import type { VariantStream } from './VariantStream';
|
|
4
|
+
/**
|
|
5
|
+
* A parsed HLS Main Playlist (also called Multivariant Playlist) as defined by RFC 8216.
|
|
6
|
+
*
|
|
7
|
+
* A Main Playlist provides a set of variant streams, each representing the same content at
|
|
8
|
+
* different bitrates or resolutions, along with alternative renditions and session-level metadata.
|
|
9
|
+
*
|
|
10
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4
|
|
11
|
+
*/
|
|
12
|
+
export interface HlsMainPlaylist {
|
|
13
|
+
/** The variant streams available in this presentation (EXT-X-STREAM-INF). */
|
|
14
|
+
readonly variants: readonly VariantStream[];
|
|
15
|
+
/** Alternative renditions such as additional audio languages or subtitles (EXT-X-MEDIA). */
|
|
16
|
+
readonly alternativeRenditions: readonly AlternativeRendition[];
|
|
17
|
+
/** Session-level key/value metadata (EXT-X-SESSION-DATA). */
|
|
18
|
+
readonly sessionData: readonly SessionData[];
|
|
19
|
+
/** Variables defined via EXT-X-DEFINE. Keys are variable names, values are their resolved values. */
|
|
20
|
+
readonly defines?: Readonly<Record<string, string>>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=HlsMainPlaylist.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HlsDateRange } from './HlsDateRange';
|
|
2
|
+
import type { HlsSegment } from './HlsSegment';
|
|
3
|
+
/**
|
|
4
|
+
* A parsed HLS Media Playlist as defined by RFC 8216.
|
|
5
|
+
*
|
|
6
|
+
* A Media Playlist contains a list of media segments that, when played sequentially, form a continuous stream.
|
|
7
|
+
*
|
|
8
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4
|
|
9
|
+
*/
|
|
10
|
+
export interface HlsMediaPlaylist {
|
|
11
|
+
/** The HLS protocol version required by this playlist (EXT-X-VERSION). */
|
|
12
|
+
readonly version: number;
|
|
13
|
+
/** The upper bound on the duration of any segment in the playlist, in seconds (EXT-X-TARGETDURATION). */
|
|
14
|
+
readonly targetDuration: number;
|
|
15
|
+
/** The sequence number of the first segment in the playlist (EXT-X-MEDIA-SEQUENCE). */
|
|
16
|
+
readonly mediaSequence: number;
|
|
17
|
+
/** The mutability type of the playlist: VOD (static), EVENT (append-only), or LIVE (sliding window). */
|
|
18
|
+
readonly playlistType: HlsMediaPlaylistType;
|
|
19
|
+
/** Whether the playlist is complete, indicated by the presence of EXT-X-ENDLIST. */
|
|
20
|
+
readonly ended: boolean;
|
|
21
|
+
/** The ordered list of media segments in this playlist. */
|
|
22
|
+
readonly segments: readonly HlsSegment[];
|
|
23
|
+
/**
|
|
24
|
+
* The Date Ranges declared in this playlist (EXT-X-DATERANGE), in the order
|
|
25
|
+
* they appear. HLS Interstitials (SGAI ad breaks) are carried as Date Ranges
|
|
26
|
+
* whose classId is `com.apple.hls.interstitial`.
|
|
27
|
+
*/
|
|
28
|
+
readonly dateRanges: readonly HlsDateRange[];
|
|
29
|
+
}
|
|
30
|
+
/** The mutability type of Media Playlist. */
|
|
31
|
+
export type HlsMediaPlaylistType = 'VOD' | 'EVENT' | 'LIVE';
|
|
32
|
+
//# sourceMappingURL=HlsMediaPlaylist.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLASS value that identifies an {@link HlsDateRange} as an HLS Interstitial,
|
|
3
|
+
* the server-guided ad insertion (SGAI) primitive defined by Apple.
|
|
4
|
+
*
|
|
5
|
+
* @see https://developer.apple.com/streaming/GettingStartedWithHLSInterstitials.pdf
|
|
6
|
+
*/
|
|
7
|
+
export declare const HLS_INTERSTITIAL_CLASS = "com.apple.hls.interstitial";
|
|
8
|
+
/**
|
|
9
|
+
* A parsed EXT-X-DATERANGE tag from an HLS Media Playlist (RFC 8216 §4.3.2.7).
|
|
10
|
+
*
|
|
11
|
+
* A Date Range associates a span of the media timeline, anchored to a wall-clock
|
|
12
|
+
* START-DATE, with a set of application-defined attributes. It is the transport
|
|
13
|
+
* for HLS Interstitials (SGAI): an interstitial is a Date Range whose
|
|
14
|
+
* {@link classId} is {@link HLS_INTERSTITIAL_CLASS} and which carries the
|
|
15
|
+
* `X-ASSET-URI` or `X-ASSET-LIST` client attributes describing the ad content.
|
|
16
|
+
*
|
|
17
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.2.7
|
|
18
|
+
*/
|
|
19
|
+
export interface HlsDateRange {
|
|
20
|
+
/** A unique identifier for this Date Range within the playlist (ID). */
|
|
21
|
+
readonly id: string;
|
|
22
|
+
/** The `CLASS` attribute, a client-defined category for the range, if present. */
|
|
23
|
+
readonly classId?: string;
|
|
24
|
+
/** The ISO-8601 wall-clock time at which the range begins (START-DATE). */
|
|
25
|
+
readonly startDate: string;
|
|
26
|
+
/** The ISO-8601 wall-clock time at which the range ends (END-DATE), if present. */
|
|
27
|
+
readonly endDate?: string;
|
|
28
|
+
/** The duration of the range in seconds (DURATION), if present. */
|
|
29
|
+
readonly duration?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The expected duration of the Date Range in seconds.
|
|
32
|
+
* This attribute SHOULD be used to indicate the expected duration of a Date Range whose actual
|
|
33
|
+
* duration is not yet known.
|
|
34
|
+
* It must be positive.
|
|
35
|
+
*/
|
|
36
|
+
readonly plannedDuration?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the END-DATE of a live range equals the START-DATE of the
|
|
39
|
+
* range that follows it (END-ON-NEXT=YES). Ranges with this flag must
|
|
40
|
+
* carry a {@link classId} and omit {@link duration} and {@link endDate}.
|
|
41
|
+
*/
|
|
42
|
+
readonly endOnNext?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The client-defined `X-` attributes of the range, keyed by their full
|
|
45
|
+
* attribute name (e.g. `X-ASSET-URI`). Values are the raw parsed strings
|
|
46
|
+
* with surrounding quotes removed. Numeric and hex `X-` attributes are
|
|
47
|
+
* kept verbatim so callers can interpret them per their own schema.
|
|
48
|
+
*/
|
|
49
|
+
readonly clientAttributes: Readonly<Record<string, string>>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=HlsDateRange.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AlternativeRendition } from './AlternativeRendition';
|
|
2
|
+
import type { SessionData } from './SessionData';
|
|
3
|
+
import type { VariantStream } from './VariantStream';
|
|
4
|
+
/**
|
|
5
|
+
* A parsed HLS Main Playlist (also called Multivariant Playlist) as defined by RFC 8216.
|
|
6
|
+
*
|
|
7
|
+
* A Main Playlist provides a set of variant streams, each representing the same content at
|
|
8
|
+
* different bitrates or resolutions, along with alternative renditions and session-level metadata.
|
|
9
|
+
*
|
|
10
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4
|
|
11
|
+
*/
|
|
12
|
+
export interface HlsMainPlaylist {
|
|
13
|
+
/** The variant streams available in this presentation (EXT-X-STREAM-INF). */
|
|
14
|
+
readonly variants: readonly VariantStream[];
|
|
15
|
+
/** Alternative renditions such as additional audio languages or subtitles (EXT-X-MEDIA). */
|
|
16
|
+
readonly alternativeRenditions: readonly AlternativeRendition[];
|
|
17
|
+
/** Session-level key/value metadata (EXT-X-SESSION-DATA). */
|
|
18
|
+
readonly sessionData: readonly SessionData[];
|
|
19
|
+
/** Variables defined via EXT-X-DEFINE. Keys are variable names, values are their resolved values. */
|
|
20
|
+
readonly defines?: Readonly<Record<string, string>>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=HlsMainPlaylist.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HlsDateRange } from './HlsDateRange';
|
|
2
|
+
import type { HlsSegment } from './HlsSegment';
|
|
3
|
+
/**
|
|
4
|
+
* A parsed HLS Media Playlist as defined by RFC 8216.
|
|
5
|
+
*
|
|
6
|
+
* A Media Playlist contains a list of media segments that, when played sequentially, form a continuous stream.
|
|
7
|
+
*
|
|
8
|
+
* @see https://datatracker.ietf.org/doc/html/rfc8216#section-4
|
|
9
|
+
*/
|
|
10
|
+
export interface HlsMediaPlaylist {
|
|
11
|
+
/** The HLS protocol version required by this playlist (EXT-X-VERSION). */
|
|
12
|
+
readonly version: number;
|
|
13
|
+
/** The upper bound on the duration of any segment in the playlist, in seconds (EXT-X-TARGETDURATION). */
|
|
14
|
+
readonly targetDuration: number;
|
|
15
|
+
/** The sequence number of the first segment in the playlist (EXT-X-MEDIA-SEQUENCE). */
|
|
16
|
+
readonly mediaSequence: number;
|
|
17
|
+
/** The mutability type of the playlist: VOD (static), EVENT (append-only), or LIVE (sliding window). */
|
|
18
|
+
readonly playlistType: HlsMediaPlaylistType;
|
|
19
|
+
/** Whether the playlist is complete, indicated by the presence of EXT-X-ENDLIST. */
|
|
20
|
+
readonly ended: boolean;
|
|
21
|
+
/** The ordered list of media segments in this playlist. */
|
|
22
|
+
readonly segments: readonly HlsSegment[];
|
|
23
|
+
/**
|
|
24
|
+
* The Date Ranges declared in this playlist (EXT-X-DATERANGE), in the order
|
|
25
|
+
* they appear. HLS Interstitials (SGAI ad breaks) are carried as Date Ranges
|
|
26
|
+
* whose classId is `com.apple.hls.interstitial`.
|
|
27
|
+
*/
|
|
28
|
+
readonly dateRanges: readonly HlsDateRange[];
|
|
29
|
+
}
|
|
30
|
+
/** The mutability type of Media Playlist. */
|
|
31
|
+
export type HlsMediaPlaylistType = 'VOD' | 'EVENT' | 'LIVE';
|
|
32
|
+
//# sourceMappingURL=HlsMediaPlaylist.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amazon/vinyl-hls-parser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A fast HLS manifest parser for browser and Node.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,32 +23,48 @@
|
|
|
23
23
|
">=5.4": {
|
|
24
24
|
"*": [
|
|
25
25
|
"./dist/types/current/index.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"hlsTestAssets": [
|
|
28
|
+
"./dist/hlsTestAssets/types/current/index.d.ts"
|
|
26
29
|
]
|
|
27
30
|
},
|
|
28
31
|
">=4.7": {
|
|
29
32
|
"*": [
|
|
30
33
|
"./dist/types/ts4.7/index.d.ts"
|
|
34
|
+
],
|
|
35
|
+
"hlsTestAssets": [
|
|
36
|
+
"./dist/hlsTestAssets/types/ts4.7/index.d.ts"
|
|
31
37
|
]
|
|
32
38
|
},
|
|
33
39
|
">=4.1": {
|
|
34
40
|
"*": [
|
|
35
41
|
"./dist/types/ts4.1/index.d.ts"
|
|
42
|
+
],
|
|
43
|
+
"hlsTestAssets": [
|
|
44
|
+
"./dist/hlsTestAssets/types/ts4.1/index.d.ts"
|
|
36
45
|
]
|
|
37
46
|
},
|
|
38
47
|
">=3.7": {
|
|
39
48
|
"*": [
|
|
40
49
|
"./dist/types/ts3.7/index.d.ts"
|
|
50
|
+
],
|
|
51
|
+
"hlsTestAssets": [
|
|
52
|
+
"./dist/hlsTestAssets/types/ts3.7/index.d.ts"
|
|
41
53
|
]
|
|
42
54
|
}
|
|
43
55
|
},
|
|
44
56
|
"exports": {
|
|
45
57
|
".": {
|
|
58
|
+
"development": "./src/index.ts",
|
|
46
59
|
"types@>=5.4": "./dist/types/current/index.d.ts",
|
|
47
60
|
"types@>=4.7": "./dist/types/ts4.7/index.d.ts",
|
|
48
61
|
"require": "./dist/index.cjs",
|
|
49
62
|
"import": "./dist/index.js"
|
|
50
63
|
},
|
|
51
64
|
"./hlsTestAssets": {
|
|
65
|
+
"development": "./test/hlsTestAssets/index.ts",
|
|
66
|
+
"types@>=5.4": "./dist/hlsTestAssets/types/current/index.d.ts",
|
|
67
|
+
"types@>=4.7": "./dist/hlsTestAssets/types/ts4.7/index.d.ts",
|
|
52
68
|
"import": "./dist/hlsTestAssets/index.js"
|
|
53
69
|
}
|
|
54
70
|
},
|
|
@@ -66,24 +82,18 @@
|
|
|
66
82
|
"eslint:write": "eslint . --cache --fix",
|
|
67
83
|
"lint": "npm run indexFiles:check && npm run eslint:check && npm run prettier:check",
|
|
68
84
|
"lint:write": "npm run indexFiles:write && npm run eslint:write && npm run prettier:write",
|
|
69
|
-
"
|
|
70
|
-
"test": "tsx --tsconfig ../../tsconfig.flat.json ../../node_modules/jasmine/bin/jasmine --config=test/unit/jasmine.config.json",
|
|
85
|
+
"test": "tsx ../../node_modules/jasmine/bin/jasmine --config=test/unit/jasmine.config.json",
|
|
71
86
|
"test:coverage": "c8 npm run test",
|
|
72
|
-
"test:benchmark": "tsx
|
|
73
|
-
"test:integration": "tsx --tsconfig ../../tsconfig.flat.json ../../node_modules/jasmine/bin/jasmine test/integ/index.ts",
|
|
87
|
+
"test:benchmark": "tsx ../../node_modules/jasmine/bin/jasmine test/benchmark/index.ts",
|
|
74
88
|
"watch": "tsx buildSrc/build.ts --watch",
|
|
75
89
|
"watch:release": "tsx buildSrc/build.ts --watch --release"
|
|
76
90
|
},
|
|
77
91
|
"devDependencies": {
|
|
78
|
-
"@amazon/vinyl-build-utils": "^1.
|
|
79
|
-
"@amazon/vinyl-jasmine-wrapper": "^1.
|
|
92
|
+
"@amazon/vinyl-build-utils": "^1.2.1",
|
|
93
|
+
"@amazon/vinyl-jasmine-wrapper": "^1.2.1"
|
|
80
94
|
},
|
|
81
95
|
"dependencies": {
|
|
82
|
-
"@amazon/vinyl-util": "^1.
|
|
83
|
-
"@amazon/vinyl-validation": "^1.
|
|
84
|
-
}
|
|
85
|
-
"browserslist": [
|
|
86
|
-
"defaults, chrome 52, firefox 54, edge 15, safari 8"
|
|
87
|
-
],
|
|
88
|
-
"gitHead": "e5a3429d802564132b16808a5b8a8e15a023a548"
|
|
96
|
+
"@amazon/vinyl-util": "^1.2.1",
|
|
97
|
+
"@amazon/vinyl-validation": "^1.2.1"
|
|
98
|
+
}
|
|
89
99
|
}
|
package/dist/test/benchmark.css
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024. Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
html,
|
|
6
|
-
body {
|
|
7
|
-
font-family: 'Roboto', sans-serif;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
h1,
|
|
11
|
-
h2,
|
|
12
|
-
h3,
|
|
13
|
-
h4,
|
|
14
|
-
h5 {
|
|
15
|
-
margin-top: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#benchmarkResults {
|
|
19
|
-
padding: 5px 5px 150px;
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
align-content: center;
|
|
23
|
-
width: 540px;
|
|
24
|
-
margin: 0 auto;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.benchmarkComparison {
|
|
28
|
-
margin: 20px;
|
|
29
|
-
padding: 5px;
|
|
30
|
-
border: thin solid #b4b9c7;
|
|
31
|
-
border-radius: 8px;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.benchmarkComparison > table {
|
|
37
|
-
width: 100%;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
thead,
|
|
41
|
-
tfoot {
|
|
42
|
-
background-color: #6f7893;
|
|
43
|
-
color: #fff;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
tbody {
|
|
47
|
-
background-color: #e8eaef;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
caption {
|
|
51
|
-
padding: 10px;
|
|
52
|
-
caption-side: bottom;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
table {
|
|
56
|
-
border-collapse: collapse;
|
|
57
|
-
border: thin solid rgb(220, 220, 227);
|
|
58
|
-
letter-spacing: 1px;
|
|
59
|
-
font-family: sans-serif;
|
|
60
|
-
font-size: 0.8rem;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
td,
|
|
64
|
-
th {
|
|
65
|
-
border: thin solid rgb(195, 195, 199);
|
|
66
|
-
padding: 5px 10px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
td {
|
|
70
|
-
text-align: center;
|
|
71
|
-
}
|
package/dist/test/benchmark.html
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
~ Copyright (c) 2024. Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
3
|
-
-->
|
|
4
|
-
|
|
5
|
-
<!doctype html>
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="utf-8" />
|
|
9
|
-
<title>Vinyl Performance Benchmarks</title>
|
|
10
|
-
|
|
11
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
12
|
-
<link rel="shortcut icon" type="image/png" href="favicon.png" />
|
|
13
|
-
<link rel="stylesheet" href="jasmine.css" />
|
|
14
|
-
<link rel="stylesheet" href="benchmark.css" />
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
/**
|
|
18
|
-
* Loads a script.
|
|
19
|
-
*
|
|
20
|
-
* @param options {{
|
|
21
|
-
* src: string,
|
|
22
|
-
* module?: boolean
|
|
23
|
-
* }}
|
|
24
|
-
*/
|
|
25
|
-
function loadScript(options) {
|
|
26
|
-
const script = document.createElement('script')
|
|
27
|
-
if (options.module) script.type = 'module'
|
|
28
|
-
script.src = options.src
|
|
29
|
-
script.async = false
|
|
30
|
-
document.head.appendChild(script)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const isModernBrowser = typeof BigInt !== 'undefined'
|
|
34
|
-
|
|
35
|
-
// Detects if this is a modern es2020 browser.
|
|
36
|
-
// Otherwise, loads the es5 version.
|
|
37
|
-
if (isModernBrowser) {
|
|
38
|
-
loadScript({
|
|
39
|
-
src: 'jasmineHtml.js',
|
|
40
|
-
module: true,
|
|
41
|
-
})
|
|
42
|
-
loadScript({
|
|
43
|
-
src: 'benchmark.js',
|
|
44
|
-
module: true,
|
|
45
|
-
})
|
|
46
|
-
} else {
|
|
47
|
-
loadScript({
|
|
48
|
-
src: 'jasmineHtml.es5.js',
|
|
49
|
-
})
|
|
50
|
-
loadScript({
|
|
51
|
-
src: 'benchmark.es5.js',
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
57
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
58
|
-
<link
|
|
59
|
-
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap"
|
|
60
|
-
rel="stylesheet"
|
|
61
|
-
/>
|
|
62
|
-
</head>
|
|
63
|
-
|
|
64
|
-
<body>
|
|
65
|
-
<div id="jasmineContainer"></div>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
package/dist/test/favicon.png
DELETED
|
Binary file
|
package/dist/test/index.html
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
~ Copyright (c) 2025. Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
3
|
-
-->
|
|
4
|
-
|
|
5
|
-
<!doctype html>
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="utf-8" />
|
|
9
|
-
<title>Jasmine Spec Runner</title>
|
|
10
|
-
|
|
11
|
-
<link rel="shortcut icon" type="image/png" href="favicon.png" />
|
|
12
|
-
<link rel="stylesheet" href="styles.css" />
|
|
13
|
-
<link rel="stylesheet" href="jasmine.css" />
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
/**
|
|
17
|
-
* Loads a script.
|
|
18
|
-
*
|
|
19
|
-
* @param options {{
|
|
20
|
-
* src: string,
|
|
21
|
-
* module?: boolean
|
|
22
|
-
* }}
|
|
23
|
-
*/
|
|
24
|
-
function loadScript(options) {
|
|
25
|
-
const script = document.createElement('script')
|
|
26
|
-
if (options.module) script.type = 'module'
|
|
27
|
-
script.src = options.src
|
|
28
|
-
script.async = false
|
|
29
|
-
document.head.appendChild(script)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const isModernBrowser = typeof BigInt !== 'undefined'
|
|
33
|
-
|
|
34
|
-
// Detects if this is a modern es2020 browser.
|
|
35
|
-
// Otherwise, loads the es5 version.
|
|
36
|
-
if (isModernBrowser) {
|
|
37
|
-
loadScript({
|
|
38
|
-
src: 'jasmineHtml.js',
|
|
39
|
-
module: true,
|
|
40
|
-
})
|
|
41
|
-
loadScript({
|
|
42
|
-
src: 'integ.js',
|
|
43
|
-
module: true,
|
|
44
|
-
})
|
|
45
|
-
} else {
|
|
46
|
-
loadScript({
|
|
47
|
-
src: 'jasmineHtml.es5.js',
|
|
48
|
-
})
|
|
49
|
-
loadScript({
|
|
50
|
-
src: 'integ.es5.js',
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
</script>
|
|
54
|
-
</head>
|
|
55
|
-
|
|
56
|
-
<body>
|
|
57
|
-
<div class="callout" id="unlockAudioPrompt" style="display: none">
|
|
58
|
-
<div class="instructions">Press any key or click to begin.</div>
|
|
59
|
-
</div>
|
|
60
|
-
</body>
|
|
61
|
-
</html>
|