@amazon/vinyl 1.2.1 → 1.2.2
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/index.cjs +13 -4
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +18 -9
- package/dist/index.js.map +3 -3
- package/dist/test/integ.es5.js +60 -60
- package/dist/test/integ.js +49 -4
- package/dist/test/integ.js.map +2 -2
- package/dist/types/current/ad/AdBreakInfo.d.ts.map +1 -1
- package/dist/types/current/ad/AdControllerImpl.d.ts +18 -2
- package/dist/types/current/ad/AdControllerImpl.d.ts.map +1 -1
- package/dist/types/current/ad/AdControllerImpl.js +58 -22
- package/dist/types/current/ad/discoverHlsInterstitials.d.ts.map +1 -1
- package/dist/types/current/ad/discoverHlsInterstitials.js +5 -3
- package/dist/types/current/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
- package/dist/types/current/drm/DrmControllerImpl.js +13 -1
- package/dist/types/current/playback/createStallDetector.d.ts +43 -0
- package/dist/types/current/playback/createStallDetector.d.ts.map +1 -0
- package/dist/types/current/playback/createStallDetector.js +101 -0
- package/dist/types/current/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/current/playback/createStallMonitor.d.ts.map +1 -0
- package/dist/types/current/playback/createStallMonitor.js +99 -0
- package/dist/types/current/streaming/AudioOptions.d.ts +27 -0
- package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -1
- package/dist/types/current/streaming/AudioOptions.js +5 -1
- package/dist/types/current/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/current/streaming/LoadMetric.d.ts.map +1 -1
- package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts.map +1 -0
- package/dist/types/current/streaming/createTimelineContentTypesValue.js +25 -0
- package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -1
- package/dist/types/current/text/SidecarTextTrackLoader.js +4 -4
- package/dist/types/current/text/TextTrack.d.ts.map +1 -1
- package/dist/types/current/text/discoverDashTextTracks.d.ts +2 -2
- package/dist/types/current/text/discoverDashTextTracks.js +4 -3
- package/dist/types/current/text/parseWebVtt.d.ts.map +1 -1
- package/dist/types/current/text/parseWebVtt.js +3 -2
- package/dist/types/current/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
- package/dist/types/current/track/mse/MseTrack.js +4 -5
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ts3.7/ad/AdControllerImpl.d.ts +18 -2
- package/dist/types/ts3.7/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts3.7/playback/createStallDetector.d.ts +43 -0
- package/dist/types/ts3.7/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/ts3.7/streaming/AudioOptions.d.ts +27 -0
- package/dist/types/ts3.7/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/ts3.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/ts3.7/text/discoverDashTextTracks.d.ts +2 -2
- package/dist/types/ts3.7/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/ts4.1/ad/AdControllerImpl.d.ts +18 -2
- package/dist/types/ts4.1/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts4.1/playback/createStallDetector.d.ts +43 -0
- package/dist/types/ts4.1/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/ts4.1/streaming/AudioOptions.d.ts +27 -0
- package/dist/types/ts4.1/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/ts4.1/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/ts4.1/text/discoverDashTextTracks.d.ts +2 -2
- package/dist/types/ts4.1/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/ts4.7/ad/AdControllerImpl.d.ts +18 -2
- package/dist/types/ts4.7/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts4.7/playback/createStallDetector.d.ts +43 -0
- package/dist/types/ts4.7/playback/createStallMonitor.d.ts +45 -0
- package/dist/types/ts4.7/streaming/AudioOptions.d.ts +27 -0
- package/dist/types/ts4.7/streaming/LoadMetric.d.ts +15 -1
- package/dist/types/ts4.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
- package/dist/types/ts4.7/text/discoverDashTextTracks.d.ts +2 -2
- package/dist/types/ts4.7/track/mse/MseTrack.d.ts +0 -1
- package/dist/unit/types/current/ad/AdControllerImpl.test.js +203 -5
- package/dist/unit/types/current/ad/discoverHlsInterstitials.test.js +2 -1
- package/dist/unit/types/current/drm/DrmControllerImpl.test.js +30 -1
- package/dist/unit/types/current/playback/createStallDetector.test.d.ts +2 -0
- package/dist/unit/types/current/playback/createStallDetector.test.d.ts.map +1 -0
- package/dist/unit/types/current/playback/createStallDetector.test.js +163 -0
- package/dist/unit/types/current/playback/createStallMonitor.test.d.ts +2 -0
- package/dist/unit/types/current/playback/createStallMonitor.test.d.ts.map +1 -0
- package/dist/unit/types/current/playback/createStallMonitor.test.js +163 -0
- package/dist/unit/types/current/streaming/MseTrack.test.js +15 -0
- package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts +2 -0
- package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts.map +1 -0
- package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.js +57 -0
- package/dist/unit/types/current/text/TextTrack.test.d.ts +2 -0
- package/dist/unit/types/current/text/TextTrack.test.d.ts.map +1 -0
- package/dist/unit/types/current/text/TextTrack.test.js +12 -0
- package/dist/unit/types/current/text/discoverDashTextTracks.test.js +17 -0
- package/dist/unit/types/current/text/parseWebVtt.test.js +26 -0
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioOptions.d.ts","sourceRoot":"","sources":["../../../../src/streaming/AudioOptions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"AudioOptions.d.ts","sourceRoot":"","sources":["../../../../src/streaming/AudioOptions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAQ5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;IAErD;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,CAAA;IAEnC;;;;;;OAMG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAA;IAE1C;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAEtC;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CACzC;AAED,eAAO,MAAM,mBAAmB,EAAE,YAGjC,CAAA;AAOD,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAAC,YAAY,CAK3D,CAAA"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { array, boolean, object, string } from '@amazon/vinyl-validation';
|
|
5
|
+
import { array, boolean, number, object, string, } from '@amazon/vinyl-validation';
|
|
6
6
|
export const defaultAudioOptions = {
|
|
7
7
|
selection: { language: null, descriptive: false },
|
|
8
|
+
disableSampleRateFilter: false,
|
|
8
9
|
};
|
|
9
10
|
const audioSelectionValidator = object({
|
|
10
11
|
language: string().or(array(string()).readonly()).orNull().optional(),
|
|
@@ -12,4 +13,7 @@ const audioSelectionValidator = object({
|
|
|
12
13
|
});
|
|
13
14
|
export const audioOptionsValidator = object({
|
|
14
15
|
selection: audioSelectionValidator.optional(),
|
|
16
|
+
disableSampleRateFilter: boolean().optional(),
|
|
17
|
+
maxSampleRate: number().maybe().optional(),
|
|
18
|
+
minSampleRate: number().maybe().optional(),
|
|
15
19
|
});
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { Timestamp } from '@amazon/vinyl-util';
|
|
2
2
|
import type { TrackUri } from '../track/Track';
|
|
3
|
+
import type { ContentType } from './MediaQualityMetadata';
|
|
3
4
|
/**
|
|
4
5
|
* The stage of the track-load journey a {@link LoadSpanMeasurement} describes.
|
|
5
6
|
*
|
|
6
7
|
* - `manifest`: fetching and parsing the DASH/HLS manifest.
|
|
8
|
+
* - `keySetup`: the EME/CDM setup, from session creation to the CDM's first
|
|
9
|
+
* license message. Precedes and is contiguous with `license`.
|
|
7
10
|
* - `license`: the DRM license request/response exchange.
|
|
8
11
|
* - `initSegment`: fetching the initialization segment.
|
|
9
12
|
* - `firstSegment`: fetching the first media segment.
|
|
10
13
|
*/
|
|
11
|
-
export type LoadSpanKind = 'manifest' | 'license' | 'initSegment' | 'firstSegment';
|
|
14
|
+
export type LoadSpanKind = 'manifest' | 'keySetup' | 'license' | 'initSegment' | 'firstSegment';
|
|
12
15
|
/**
|
|
13
16
|
* A timed span for one stage of a track load.
|
|
14
17
|
*
|
|
@@ -35,6 +38,17 @@ export interface LoadSpanMeasurement {
|
|
|
35
38
|
* buffering DRM info is set).
|
|
36
39
|
*/
|
|
37
40
|
readonly trackUri?: TrackUri;
|
|
41
|
+
/**
|
|
42
|
+
* The MIME type of the content this span was measured for, when known. Set
|
|
43
|
+
* for DRM `license` spans so a certificate exchange and the per-content-type
|
|
44
|
+
* license exchanges are distinguishable.
|
|
45
|
+
*/
|
|
46
|
+
readonly mimeType?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The content type this span was measured for, when known. Set alongside
|
|
49
|
+
* {@link mimeType} for DRM `license` spans.
|
|
50
|
+
*/
|
|
51
|
+
readonly contentType?: ContentType;
|
|
38
52
|
}
|
|
39
53
|
/**
|
|
40
54
|
* A {@link LoadSpanMeasurement} attributed to the track it was measured for.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadMetric.d.ts","sourceRoot":"","sources":["../../../../src/streaming/LoadMetric.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"LoadMetric.d.ts","sourceRoot":"","sources":["../../../../src/streaming/LoadMetric.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GACpB,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,cAAc,CAAA;AAExE;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAE3B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;IAE3B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAE1B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACtD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;CACnC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ContentTypesValue } from './ContentTypesValue';
|
|
2
|
+
import type { MediaTimeline } from './MediaTimeline';
|
|
3
|
+
import type { ObservableValue } from '@amazon/vinyl-observable';
|
|
4
|
+
export interface TimelineContentTypesValueDeps {
|
|
5
|
+
/**
|
|
6
|
+
* The filtered, playable timeline. Content types are derived from the
|
|
7
|
+
* qualities that survive filtering, so a content type whose renditions are
|
|
8
|
+
* all filtered out (e.g. every audio rendition dropped by the sample-rate
|
|
9
|
+
* filter) is not reported — it never gates readiness and no source buffer
|
|
10
|
+
* is expected for it, so the remaining content types still play.
|
|
11
|
+
*/
|
|
12
|
+
readonly mediaTimelineTransformed: ObservableValue<Promise<MediaTimeline>>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Provides the MSE content types to create source buffers for, derived from the
|
|
16
|
+
* qualities that survive timeline filtering rather than the raw manifest. Only
|
|
17
|
+
* `'audio'`/`'video'` are reported; text is a sidecar pipeline, never an MSE
|
|
18
|
+
* source buffer.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createTimelineContentTypesValue(deps: TimelineContentTypesValueDeps): ContentTypesValue;
|
|
21
|
+
//# sourceMappingURL=createTimelineContentTypesValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTimelineContentTypesValue.d.ts","sourceRoot":"","sources":["../../../../src/streaming/createTimelineContentTypesValue.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,MAAM,WAAW,6BAA6B;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,EAAE,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;CAC7E;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC3C,IAAI,EAAE,6BAA6B,GACpC,iBAAiB,CAgBnB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Provides the MSE content types to create source buffers for, derived from the
|
|
7
|
+
* qualities that survive timeline filtering rather than the raw manifest. Only
|
|
8
|
+
* `'audio'`/`'video'` are reported; text is a sidecar pipeline, never an MSE
|
|
9
|
+
* source buffer.
|
|
10
|
+
*/
|
|
11
|
+
export function createTimelineContentTypesValue(deps) {
|
|
12
|
+
return deps.mediaTimelineTransformed.map(async (timelinePromise) => {
|
|
13
|
+
const timeline = await timelinePromise;
|
|
14
|
+
const contentTypes = new Set();
|
|
15
|
+
for (const period of timeline.periods) {
|
|
16
|
+
for (const { metadata } of period.qualities) {
|
|
17
|
+
if (metadata.contentType === 'audio' ||
|
|
18
|
+
metadata.contentType === 'video') {
|
|
19
|
+
contentTypes.add(metadata.contentType);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return contentTypes;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidecarTextTrackLoader.d.ts","sourceRoot":"","sources":["../../../../src/text/SidecarTextTrackLoader.ts"],"names":[],"m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CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC/B,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { requestWithRetry, resolveUrl, sleep } from '@amazon/vinyl-util';
|
|
5
|
+
import { readResponseBody, requestWithRetry, resolveUrl, sleep, } from '@amazon/vinyl-util';
|
|
6
6
|
import { parseMediaPlaylist } from '@amazon/vinyl-hls-parser';
|
|
7
7
|
import { parseWebVtt } from './parseWebVtt';
|
|
8
8
|
/**
|
|
@@ -58,7 +58,7 @@ export async function loadWebVttCues(uri, options) {
|
|
|
58
58
|
}
|
|
59
59
|
const response = await requestWithRetry(uri, init, { abort });
|
|
60
60
|
const contentType = (response.headers.get('content-type') ?? '').toLowerCase();
|
|
61
|
-
const body = await response
|
|
61
|
+
const body = await readResponseBody(response, 'text');
|
|
62
62
|
if (contentType.includes('mpegurl') || body.startsWith('#EXTM3U')) {
|
|
63
63
|
return streamMediaPlaylistText({
|
|
64
64
|
text: body,
|
|
@@ -87,7 +87,7 @@ async function streamMediaPlaylist(ctx) {
|
|
|
87
87
|
const response = await requestWithRetry(ctx.uri, ctx.init, {
|
|
88
88
|
abort: ctx.abort,
|
|
89
89
|
});
|
|
90
|
-
const text = await response
|
|
90
|
+
const text = await readResponseBody(response, 'text');
|
|
91
91
|
return streamMediaPlaylistText({
|
|
92
92
|
...ctx,
|
|
93
93
|
text,
|
|
@@ -116,7 +116,7 @@ async function streamMediaPlaylistText(ctx) {
|
|
|
116
116
|
const res = await requestWithRetry(segUri, ctx.init, {
|
|
117
117
|
abort: ctx.abort,
|
|
118
118
|
});
|
|
119
|
-
const body = await res
|
|
119
|
+
const body = await readResponseBody(res, 'text');
|
|
120
120
|
const doc = parseWebVtt(body);
|
|
121
121
|
if (doc.cues.length > 0)
|
|
122
122
|
ctx.onCues(doc.cues);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextTrack.d.ts","sourceRoot":"","sources":["../../../../src/text/TextTrack.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAS5D;;GAEG;AACH,MAAM,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"TextTrack.d.ts","sourceRoot":"","sources":["../../../../src/text/TextTrack.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAS5D;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,WAAW,GAAG,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,CAAA;AAEvE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAE5B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IAExB;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;IAE3C;;OAEG;IACH,QAAQ,CAAC,GAAG,EA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AAE,kBAAkB,GAAG,IAAI,CAAA;CACjD;AAmBD,eAAO,MAAM,mCAAmC,EAAE,YAAY,CAAC,0BAA0B,CAInF,CAAA;AAEN,eAAO,MAAM,qBAAqB,0EAIuB,CAAA;AAEzD;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC;IACrF;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAA;IAE7C;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,aAAa,GAAG,IAAI,CAAA;IAE9C;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,2BAA2B;IACpE;;;;;OAKG;IACH,UAAU,IAAI,IAAI,CAAA;IAElB;;;;OAIG;IACH,QAAQ,IAAI,IAAI,CAAA;CACnB"}
|
|
@@ -5,8 +5,8 @@ import type { TextTrackInfo } from './TextTrack';
|
|
|
5
5
|
*
|
|
6
6
|
* Considers an `<AdaptationSet>` to carry text when one of:
|
|
7
7
|
* - `contentType="text"`
|
|
8
|
-
* - `mimeType
|
|
9
|
-
*
|
|
8
|
+
* - its `mimeType`, or that of one of its `<Representation>`s, starts with
|
|
9
|
+
* `text/` (e.g. `text/vtt`)
|
|
10
10
|
*
|
|
11
11
|
* Within a text adaptation set, each `<Representation>` becomes one
|
|
12
12
|
* {@link TextTrackInfo}. The `BaseURL` chain (MPD → Period → AdaptationSet →
|
|
@@ -8,8 +8,8 @@ import { resolveUrl } from '@amazon/vinyl-util';
|
|
|
8
8
|
*
|
|
9
9
|
* Considers an `<AdaptationSet>` to carry text when one of:
|
|
10
10
|
* - `contentType="text"`
|
|
11
|
-
* - `mimeType
|
|
12
|
-
*
|
|
11
|
+
* - its `mimeType`, or that of one of its `<Representation>`s, starts with
|
|
12
|
+
* `text/` (e.g. `text/vtt`)
|
|
13
13
|
*
|
|
14
14
|
* Within a text adaptation set, each `<Representation>` becomes one
|
|
15
15
|
* {@link TextTrackInfo}. The `BaseURL` chain (MPD → Period → AdaptationSet →
|
|
@@ -83,7 +83,8 @@ function isTextAdaptationSet(adaptationSet) {
|
|
|
83
83
|
const mt = adaptationSet.mimeType;
|
|
84
84
|
if (mt && mt.startsWith('text/'))
|
|
85
85
|
return true;
|
|
86
|
-
|
|
86
|
+
// `mimeType` may be declared on the Representation rather than the set.
|
|
87
|
+
return (adaptationSet.Representation ?? []).some((representation) => representation.mimeType?.startsWith('text/'));
|
|
87
88
|
}
|
|
88
89
|
function isSidecarTextMime(mimeType) {
|
|
89
90
|
// Permissive when manifest omits the MIME type, otherwise require a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseWebVtt.d.ts","sourceRoot":"","sources":["../../../../src/text/parseWebVtt.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAA;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CACrC;AAeD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"parseWebVtt.d.ts","sourceRoot":"","sources":["../../../../src/text/parseWebVtt.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAA;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CACrC;AAeD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAqGzD"}
|
|
@@ -44,9 +44,10 @@ export function parseWebVtt(input) {
|
|
|
44
44
|
// Per the WebVTT spec, everything from the `WEBVTT` signature up to (and
|
|
45
45
|
// including) the first blank line is the file header — metadata lines (e.g.
|
|
46
46
|
// HLS's `X-TIMESTAMP-MAP=...`) belong in that block and MUST NOT be
|
|
47
|
-
// interpreted as cue content.
|
|
47
|
+
// interpreted as cue content. The header also ends at a timing line, so a
|
|
48
|
+
// document that omits the blank line still has its first cue parsed.
|
|
48
49
|
let i = 1;
|
|
49
|
-
while (i < lines.length && lines[i] !== '')
|
|
50
|
+
while (i < lines.length && lines[i] !== '' && !lines[i].includes('-->'))
|
|
50
51
|
i++;
|
|
51
52
|
while (i < lines.length) {
|
|
52
53
|
// Skip blank lines between blocks.
|
|
@@ -26,7 +26,6 @@ export declare class MseTrack extends TrackBase {
|
|
|
26
26
|
get [Symbol.toStringTag](): string;
|
|
27
27
|
protected readonly deps: MseTrackDeps;
|
|
28
28
|
private readonly streams;
|
|
29
|
-
private readonly disposeAbort;
|
|
30
29
|
private lastPreloadOptions;
|
|
31
30
|
private activateOptions;
|
|
32
31
|
private readonly allFetchedRanges;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MseTrack.d.ts","sourceRoot":"","sources":["../../../../../src/track/mse/MseTrack.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"MseTrack.d.ts","sourceRoot":"","sources":["../../../../../src/track/mse/MseTrack.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EAKH,KAAK,cAAc,EACnB,KAAK,WAAW,EAGnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC1E,OAAO,KAAK,EACR,WAAW,EACX,oBAAoB,EACvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,KAAK,EACR,aAAa,EAGhB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAA;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC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AAyB;IAuBjC;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAsCtD,OAAO,CAAC,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,gBAAgB;IASxE,IAAI,YAAY,IAAI,WAAW,CAAC,WAAW,CAAC,CAE3C;IAED,IAAI,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,EAO/C;IAED,IAAI,SAAS,IAAI,SAAS,oBAAoB,EAAE,GAAG,IAAI,CAEtD;IAED,IAAI,mBAAmB,IAAI,SAAS,oBAAoB,EAAE,GAAG,IAAI,CAEhE;IAED,IAAI,aAAa,IAAI,cAAc,CAElC;IAED;;;;OAIG;IACH,aAAa;IAKb;;;OAGG;IACH,KAAK,IAAI,IAAI;IAUb,WAAW,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI;IAkChD,aAAa,IAAI,IAAI;IAUrB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,GAAG,IAAI;IAI1E,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,GAAG,IAAI;IAI1E,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,GAAG,IAAI;IAIzE;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,YAAY;IAOpB,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,OAAO,IAAI,IAAI;CAOlB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { TrackBase, } from '../TrackBase';
|
|
6
|
-
import {
|
|
6
|
+
import { equalDeep, IntersectionRanges, logDebug, redispatchEvents, } from '@amazon/vinyl-util';
|
|
7
7
|
import { createContainer } from '@amazon/vinyl-di';
|
|
8
8
|
import { getMediaPeriodAtTime, } from '../../streaming/MediaTimeline';
|
|
9
9
|
/**
|
|
@@ -14,7 +14,6 @@ export class MseTrack extends TrackBase {
|
|
|
14
14
|
return 'MseTrack';
|
|
15
15
|
}
|
|
16
16
|
streams = [];
|
|
17
|
-
disposeAbort = new Abort();
|
|
18
17
|
lastPreloadOptions = null;
|
|
19
18
|
activateOptions = null;
|
|
20
19
|
allFetchedRanges = [];
|
|
@@ -52,11 +51,11 @@ export class MseTrack extends TrackBase {
|
|
|
52
51
|
// DRM
|
|
53
52
|
this.on('streamingQualityChange', (event) => {
|
|
54
53
|
if (this.activateOptions) {
|
|
55
|
-
this.deps.drmController.initializeForPlayback(event.current, this.
|
|
54
|
+
this.deps.drmController.initializeForPlayback(event.current, this.drmSessionAbort.value);
|
|
56
55
|
}
|
|
57
56
|
});
|
|
58
57
|
this.on('bufferingQualityChange', (event) => {
|
|
59
|
-
this.deps.drmController.setBufferingDrmInfo(event.current, this.
|
|
58
|
+
this.deps.drmController.setBufferingDrmInfo(event.current, this.drmSessionAbort.value);
|
|
60
59
|
});
|
|
61
60
|
// Listen for timeline changes to update qualities.
|
|
62
61
|
add(deps.mediaTimelineTransformed.onData(() => {
|
|
@@ -216,7 +215,7 @@ export class MseTrack extends TrackBase {
|
|
|
216
215
|
// AirPlay not supported using managed media sources
|
|
217
216
|
this.deps.playbackSource.disableRemotePlayback = true;
|
|
218
217
|
this.streams.forEach((stream) => {
|
|
219
|
-
this.deps.drmController.initializeForPlayback(stream.streamingQuality, this.
|
|
218
|
+
this.deps.drmController.initializeForPlayback(stream.streamingQuality, this.drmSessionAbort.value);
|
|
220
219
|
});
|
|
221
220
|
this.deps.playbackSource.src =
|
|
222
221
|
this.deps.mediaSourceController.createUrl();
|